photo remaining

This commit is contained in:
Sampanna Rimal
2024-07-16 12:43:55 +05:45
parent 7ffe31e260
commit de0b041520
18 changed files with 273 additions and 198 deletions

View File

@ -143,6 +143,57 @@ class Vouchers extends CI_Controller
endif;
redirect("accounts/vouchers/listvouchers");
break;
case 'saveaccount':
if (isset($_POST['submit'])) {
if (!$this->checkifAccountExists($_POST['account_name'])) {
$TableData = array(
'accategory_id' => filter_var($_POST['accategory_id']),
// 'account_code' => generateAccountCode(filter_var($_POST['account_code'])),
'account_name' => filter_var($_POST['account_name']),
// 'account_type' => filter_var($_POST['account_type']),
// 'account_plcategory' => filter_var($_POST['account_plcategory']),
// 'account_currency' => filter_var($_POST['account_currency']),
// 'account_partyname' => filter_var($_POST['account_partyname']),
// 'account_partyaddress' => filter_var($_POST['account_partyaddress']),
// 'account_partypan' => filter_var($_POST['account_partypan']),
// 'account_partycontact' => filter_var($_POST['account_partycontact']),
// 'account_partyemail' => filter_var($_POST['account_partyemail']),
// 'account_partycontactperson' => filter_var($_POST['account_partycontactperson']),
// 'account_partycontactpersoncontact' => filter_var($_POST['account_partycontactpersoncontact']),
'created_on' => date('Y-m-d H:i:s'),
'created_by' => 'admin',
'remarks' => filter_var($_POST['remarks']),
'status' => 1,
);
$this->db->insert('tbl_accounts', $TableData);
$account_id = $this->db->insert_id();
$voucherData = array(
"voucher_id" => 0,
"transaction_date" => date("Y-m-d"),
"account_id" => $account_id,
"Dr" => 0,
"Cr" => 0,
"fiscalyear_id" => $this->session->userdata['FiscalYearID'],
"created_on" => date('Y-m-d H:i:s'),
"branch_id" => $this->session->userdata("BranchID"),
"created_by" => $this->session->userdata("loggedUser"),
"remarks" => "Opening Balance Entry",
"status" => 1
);
if ($_POST['opening_balance_drcr'] == "DR") $voucherData['Dr'] = $_POST['opening_balance'];
if ($_POST['opening_balance_drcr'] == "CR") $voucherData['Cr'] = $_POST['opening_balance'];
$this->db->insert('tbl_voucherdetails', $voucherData);
redirect("accounts/accountheads/list");
} else {
echo "Account Head Name Already Exists";
die;
}
}
loadView("accounts/accountheads/add", $data);
break;
default:
if ($VoucherType = $this->myaccounts->getVoucherType($alias)) {
$this->processVoucher($VoucherType);
@ -211,7 +262,7 @@ class Vouchers extends CI_Controller
$entry_no++;
redirect("accounts/vouchers/" . $VoucherType->voucher_alias . "/list");
echo json_encode(['status' => 'success']);
break;
}
@ -594,4 +645,8 @@ function footerfunctions()
?>";
file_put_contents($filename, $ListFileContent);
}
function checkifAccountExists($account_name)
{
return ($this->db->query("select * from tbl_accounts where UPPER(account_name)='" . strtoupper($account_name) . "'")->num_rows() > 0) ? true : false;
}
}