photo remaining
This commit is contained in:
@ -111,6 +111,7 @@ class Welcome extends CI_Controller
|
||||
`created_by` VARCHAR(50) NOT NULL,
|
||||
`remarks` TEXT NOT NULL,
|
||||
`status` int(11) DEFAULT NULL,
|
||||
`discount` DOUBLE(10, 2) NULL,
|
||||
PRIMARY KEY (`purchase_id`)
|
||||
)");
|
||||
$this->db->query("CREATE TABLE IF NOT EXISTS `tbl_purchasedetails` (
|
||||
@ -134,6 +135,7 @@ class Welcome extends CI_Controller
|
||||
`created_by` VARCHAR(50) NOT NULL,
|
||||
`remarks` TEXT NOT NULL,
|
||||
`status` int(11) DEFAULT NULL,
|
||||
`discount` DOUBLE(10, 2) NULL,
|
||||
PRIMARY KEY (`sales_id`)
|
||||
)");
|
||||
$this->db->query("CREATE TABLE IF NOT EXISTS `tbl_salesdetails` (
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -33,6 +33,7 @@ class Purchases extends CI_Controller
|
||||
'transaction_type' => "Purchase Entry",
|
||||
'accounts_id' => filter_var($_POST['accounts_id']),
|
||||
'purchase_date' => filter_var($_POST['purchase_date']),
|
||||
'discount' => filter_var($_POST['discountpercentage']),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
'remarks' => '',
|
||||
@ -91,6 +92,13 @@ class Purchases extends CI_Controller
|
||||
$data['PurchaseRecords'] = $this->MPurchases->getPurchaseRecords();
|
||||
loadView("inventory/purchases/register", $data);
|
||||
break;
|
||||
|
||||
case 'getunitbyitem':
|
||||
$id = $this->uri->segment(4);
|
||||
$unit = $this->MStocks->getUnitByItemId($id);
|
||||
echo json_encode($unit);
|
||||
break;
|
||||
|
||||
default:
|
||||
$data['PurchaseRecords'] = $this->MPurchases->getPurchaseRecords();
|
||||
loadView("inventory/purchases/list", $data);
|
||||
|
@ -19,6 +19,7 @@ class Reports extends CI_Controller
|
||||
$data['StockRecords']=$this->MStocks->getStockRecords();
|
||||
$data['PurchaseDetails'] = $this->MPurchases->getItemPurchases();
|
||||
$data['SalesDetails'] = $this->MSales->getItemSales();
|
||||
$data['StockItems'] = $this->MStocks->getStockSummary();
|
||||
loadview("inventory/reports/purchase_vs_sales", $data);
|
||||
break;
|
||||
default:
|
||||
|
@ -29,6 +29,7 @@ class Sales extends CI_Controller
|
||||
'transaction_type' => "Sales Entry",
|
||||
'accounts_id' => filter_var($_POST['accounts_id']),
|
||||
'sales_date' => filter_var($_POST['salesDate']),
|
||||
'discount' => filter_var($_POST['discountpercentage']),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
'remarks' => '',
|
||||
@ -79,6 +80,7 @@ class Sales extends CI_Controller
|
||||
'transaction_type' => filter_var($_POST['transaction_type']),
|
||||
'accounts_id' => filter_var($_POST['accounts_id']),
|
||||
'sales_date' => filter_var($_POST['sales_date']),
|
||||
'discount' => filter_var($_POST['discountpercentage']),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
@ -98,11 +100,20 @@ class Sales extends CI_Controller
|
||||
$this->db->delete('tbl_salesdetails');
|
||||
redirect("inventory/sales/list");
|
||||
break;
|
||||
|
||||
case 'getunitbyitem':
|
||||
$id = $this->uri->segment(4);
|
||||
$unit = $this->MStocks->getUnitByItemId($id);
|
||||
echo json_encode($unit);
|
||||
break;
|
||||
|
||||
default:
|
||||
$data['SalesRecords'] = $this->MSales->getSalesRecords();
|
||||
loadView("inventory/sales/list", $data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// public function getUnitByItemId($id) {
|
||||
// $unitName = $this->MStocks->getUnitByItemId($id);
|
||||
|
@ -91,7 +91,8 @@ class Accategories extends CI_Controller
|
||||
if (isset($_POST['submit'])) {
|
||||
|
||||
$TableData = array(
|
||||
'acgroup_id' => filter_var($_POST['acgroup_id']),
|
||||
'acgroup_id' => filter_var(getFieldfromValue("tbl_accategories", "acgroup_id", "accategory_id", $_POST['parent_category_id'])),
|
||||
// 'acgroup_id' => filter_var($_POST['acgroup_id']),
|
||||
'accategory_code' => generateACCategoryCode($_POST['acgroup_id']),
|
||||
'parent_category_id' => filter_var($_POST['parent_category_id']),
|
||||
'accategory_name' => filter_var($_POST['accategory_name']),
|
||||
@ -105,10 +106,13 @@ class Accategories extends CI_Controller
|
||||
redirect("master/accategories");
|
||||
}
|
||||
$data['AccountCategory'] = $this->db->query("select * from tbl_accategories where accategory_id =\"$id\" ")->row();
|
||||
loadView("accounts/accategories/edit", $data);
|
||||
$data['ACCategories'] = $this->myaccounts->getAccountCategories();
|
||||
$data['pageTitle'] = "Account Group";
|
||||
|
||||
loadView("accounts/accategories/list-childs-only", $data);
|
||||
break;
|
||||
case 'edit_parents':
|
||||
$id = $this->uri->segment(4);
|
||||
$id = $this->uri->segment(4);
|
||||
$data['pageTitle'] = "Edit Category";
|
||||
|
||||
if (isset($_POST['submit'])) {
|
||||
|
Reference in New Issue
Block a user