This commit is contained in:
Raju Shrestha
2024-08-25 18:37:52 +05:45
parent 78670b1b95
commit 161703be17
11 changed files with 100 additions and 263 deletions

View File

@ -5,7 +5,6 @@ function generateACCategoryCode($group_id)
$acgroup_code = $ci->db->where("acgroup_id=$group_id")->get("tbl_acgroups")->row()->acgroup_code;
$lastACCategoryCode = $ci->db->select_max("accategory_code")->where("acgroup_id=$group_id")->get("tbl_accategories")->row()->accategory_code;
$category_part = substr($lastACCategoryCode, 1);
$category_part = (float)$category_part + 1;
//if($category_part<10)$category_part="00".$category_part;
if ($category_part < 10) $category_part = "00" . $category_part;
@ -18,7 +17,6 @@ function generateAccountCode($category_id)
$accategory_code = $ci->db->where("accategory_id=$category_id")->get("tbl_accategories")->row()->accategory_code;
$lastAccountCode = $ci->db->select_max("account_code")->where("accategory_id=$category_id")->get("tbl_accounts")->row()->account_code;
$account_part = substr($lastAccountCode, 4);
$account_part = (float)$account_part + 1;
//if($category_part<10)$category_part="00".$category_part;
if ($account_part < 10) $account_part = "00" . $account_part;
@ -54,13 +52,10 @@ function showAccountCategoriesSelector($fieldName, $fieldID, $condition = "1=1",
$html .= " required";
}
$html .= ">";
$html .= "<option value='' " . (($selectedID == '') ? "SELECTED" : "") . ">Select Account Category</option>";
foreach ($AccountCategories as $AccountCategory) {
$html .= "<option value='$AccountCategory->accategory_id'" . (($selectedID == $AccountCategory->accategory_id) ? "selected" : "") . ">" . getFieldfromValue("tbl_acgroups", "acgroup_name", "acgroup_id", $AccountCategory->acgroup_id) . " >> $AccountCategory->accategory_name</option>";
}
$html .= "</select>";
echo $html;
}
@ -68,7 +63,6 @@ function showAccountCategoriesByIds($AccountCategories = array())
{
// pre($AccountCategories); //die;
$ci = &get_instance();
if ($AccountCategories) {
$AccountCategories_a = $ci->db->where("status", 1);
$AccountCategories_a = $AccountCategories_a->where_in("accategory_id", $AccountCategories);
@ -80,22 +74,19 @@ function showAccountCategoriesByIds($AccountCategories = array())
echo implode(", ", $html);
}
}
function linkVoucher($voucher_id)
{
if($voucher_id!=0) {
$ci = &get_instance();
$Voucher = $ci->db->where("voucher_id", $voucher_id)->get("tbl_vouchers")->row();
$Name = $ci->db->where("vouchertype_id", $Voucher->voucher_type)->get("tbl_vouchertypes")->row()->voucher_type . " Voucher # " . $Voucher->voucher_no;
echo "<a class='link' target='_blank' href='" . site_url("accounts/vouchers/show_voucher/" . $voucher_id) . "'>$Name</a>";
if ($voucher_id != 0) {
$ci = &get_instance();
$Voucher = $ci->db->where("voucher_id", $voucher_id)->get("tbl_vouchers")->row();
$Name = $ci->db->where("vouchertype_id", $Voucher->voucher_type)->get("tbl_vouchertypes")->row()->voucher_type . " Voucher # " . $Voucher->voucher_no;
echo "<a class='link' target='_blank' href='" . site_url("accounts/vouchers/show_voucher/" . $voucher_id) . "'>$Name</a>";
} else {
echo "";
}
}
function linkLedger($Account)
{
$ci = &get_instance();
echo "<a class='link' target='_blank' href='" . site_url("accounts/ledger/partyledger?from_date=" . FYStart() . "&to_date=" . FYEnd() . "&account_id=" . $Account->account_id . "&show_ledger=true") . "'>$Account->account_name</a>";
}
@ -143,15 +134,11 @@ function generateVoucherNo($vouchertype_id = "")
{
$ci = &get_instance();
$voucherTypeCondition = ($vouchertype_id != "") ? " WHERE voucher_type = '$vouchertype_id'" : "";
$query = $ci->db->query("SELECT MAX(voucher_no) AS voucher_no FROM tbl_vouchers" . $voucherTypeCondition);
$row = $query->row();
$newVoucherNo = ($row->voucher_no !== null) ? $row->voucher_no + 1 : 1;
return $newVoucherNo;
}
function countChildCategories($acgroup_id)
{
$ci = &get_instance();