photo remaining
This commit is contained in:
parent
7ffe31e260
commit
de0b041520
@ -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'])) {
|
||||
|
@ -157,7 +157,7 @@ class myaccounts
|
||||
$ci = &get_instance();
|
||||
return $ci->db->where("status", 1)->where("account_id", $account_id)->select_sum('cr')->get("tbl_voucherdetails")->row()->cr;
|
||||
}
|
||||
function getAllAccountsTable($accategory_id = "")
|
||||
function getAllAccountsTable($accategory_id = "", $full = "")
|
||||
{
|
||||
$CI = &get_instance();
|
||||
if ($accategory_id != "") {
|
||||
@ -208,7 +208,9 @@ class myaccounts
|
||||
$html .= "<tr><td><a href=" . $Account->account_id . ">" . $Account->account_name . "</a></td><td class='col-2'>" . $Account->Category->accategory_name . "</td><td class='col-1'>" . (($balance >= 0) ? myCurrency($balance) : "") . "</td><td class='col-1'>" . (($balance < 0) ? myCurrency(abs($balance)) : "") . "</td><td class='col-2 text-center'><a title='Show Ledger' class='btn btn-info btn-xs ' onClick='showLedger(" . $Account->account_id . ")'><i class='fa fa-eye'></i></a></td></tr>";
|
||||
endforeach;
|
||||
$html .= "</tbody><tfoot>";
|
||||
$html .= "<tr><th colspan=2 class='text-right '>Total</th><th class='text-right'>" . myCurrency($BalanceTotal) . "</th><th class='text-right'>" . myCurrency($BalanceTotal) . "</th><th></th><th></th></tr>";
|
||||
if ($full==""){
|
||||
$html .= "<tr><th colspan=2 class='text-right '>Total</th><th class='text-right'>" . myCurrency($BalanceTotal) . "</th><th class='text-right'>" . myCurrency($BalanceTotal) . "</th><th></th><th></th></tr>";
|
||||
}
|
||||
$html .= "</tfoot></table>\n";
|
||||
$html .= " <div class=\"modal fade\" id=\"ledgerdetails_box\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"ledgerdetails_box\" aria-hidden=\"true\">
|
||||
<div class=\"modal-dialog modal-xl\" role=\"document\">
|
||||
@ -1013,7 +1015,9 @@ class myaccounts
|
||||
<tr>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<?php if ($showVoucherTypes) : ?>
|
||||
<td></td>
|
||||
<?php endif; ?>
|
||||
<td class="text-right text-bold">Total</td>
|
||||
<td class="text-right text-bold"><?php echo myCurrency($drTotal); ?></td>
|
||||
<td class="text-right text-bold"><?php echo myCurrency($crTotal); ?></td>
|
||||
|
@ -144,6 +144,7 @@ class MStocks extends CI_Model
|
||||
$Item->Item = $this->db->where("item_id", $item_id)->get("tbl_items")->row();
|
||||
$Item->qty = $this->db->where("items_id", $item_id)->select("sum(qty) as qty")->get("tbl_stocks")->row()->qty;
|
||||
$Item->amount = $this->db->where("items_id", $item_id)->select("sum(price * qty) as amount")->get("tbl_stocks")->row()->amount;
|
||||
$Item->Unit = $this->db->where("unit_id", $Item->Item->units_id)->get("tbl_units")->row();
|
||||
$Item->Opening = $this->getOpeningStock($item_id);
|
||||
$Item->Purchase = $this->getItemPurchaseStock($item_id);
|
||||
$Item->Sales = $this->getItemSalesStock($item_id);
|
||||
@ -208,13 +209,12 @@ class MStocks extends CI_Model
|
||||
$this->db->insert("tbl_stocks", $TableData);
|
||||
}
|
||||
}
|
||||
// public function getUnitByItemId($id)
|
||||
// {
|
||||
// $this->db->where('status', 1);
|
||||
// $Item = $this->db->where("item_id", $id)->get("tbl_items")->row();
|
||||
// $Unit = $this->db->where("unit_id", $Item->units_id)->get("tbl_units")->row();
|
||||
// $unitname = $Unit->title;
|
||||
// return $unitname;
|
||||
public function getUnitByItemId($id)
|
||||
{
|
||||
$this->db->where('status', 1);
|
||||
$Item = $this->db->where("item_id", $id)->get("tbl_items")->row();
|
||||
$Unit = $this->db->where("unit_id", $Item->units_id)->get("tbl_units")->row();
|
||||
return $Unit;
|
||||
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
@ -5,19 +5,25 @@
|
||||
<div class="col-3">
|
||||
<div class="card card-primary card-outline">
|
||||
<div class="card-header">
|
||||
<h5 class="m-0">Create <?php echo $pageTitle; ?>
|
||||
<h5 class="m-0"><?php echo isset($AccountCategory) ? 'Edit' : 'Create'; ?>
|
||||
<?php echo $pageTitle; ?>
|
||||
<!-- <a href="<?php //echo site_url("master/accategories/list");
|
||||
?>" class="btn btn-sm btn-primary float-right">List <?php //echo $pageTitle;
|
||||
?></a> -->
|
||||
</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form method=POST action="<?php echo site_url("master/accategories/add_child");?>" enctype="multipart/form-data" name="tbl_accategories">
|
||||
<form method="POST" action="<?php echo isset($AccountCategory) ? site_url($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/edit/" . $AccountCategory->accategory_id) : site_url($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/add_child"); ?>" enctype="multipart/form-data" name="tbl_accategories">
|
||||
<!-- <form method=POST action="<?php //echo site_url("master/accategories/add_child");?>" enctype="multipart/form-data" name="tbl_accategories"> -->
|
||||
<div class="row">
|
||||
<!--COL START-->
|
||||
<div class="col">
|
||||
<div class="form-group">
|
||||
<label for="accategory_name">Group Name <span style="color:#ff0000">*</span></label><input type="text" class="form-control" id="accategory_name" value="" name="accategory_name" required>
|
||||
<!-- <?php
|
||||
// $html_groupname="<label for=\"accategory_name\">Group Name <span style=\"color:#ff0000\">*</span></label><input type=\"text\" class=\"form-control\" id=\"accategory_name\" value=\"\" name=\"accategory_name\" required>";
|
||||
// echo isset($AccountCategory) ? fillComboWithValue("acgroup_id","Group Name","acgroup_id","tbl_acgroups", "acgroup_name", "acgroup_id", $default=$AccountCategory->acgroup_id,$CSSclass="",$multiple=false,$condition="status=1") : $html_groupname ;
|
||||
?> -->
|
||||
<label for="accategory_name">Group Name <span style="color:#ff0000">*</span></label><input type="text" class="form-control" id="accategory_name" value="<?php echo isset($AccountCategory) ? $AccountCategory->accategory_name : "" ; ?>" name="accategory_name" required>
|
||||
</div>
|
||||
</div>
|
||||
<!--COL END-->
|
||||
@ -26,7 +32,11 @@
|
||||
<!--COL START-->
|
||||
<div class="col">
|
||||
<div class="form-group">
|
||||
<?php $this->myaccounts->showFixedAccountsCategoriesCombo("parent_category_id", " Under", "parent_category_id", "status=1", $default = "", $CSSclass = ""); ?>
|
||||
<?php
|
||||
// $this->myaccounts->showFixedAccountsCategoriesCombo("parent_category_id", " Under", "parent_category_id", "status=1", $default = "", $CSSclass = "");
|
||||
echo isset($AccountCategory) ? fillComboWithValue("parent_category_id", "Under", "parent_category_id", "tbl_accategories", "accategory_name", "accategory_id", $default = $AccountCategory->parent_category_id, $CSSclass = "", $multiple = false, $condition = "status=1") : $this->myaccounts->showFixedAccountsCategoriesCombo("parent_category_id", " Under", "parent_category_id", "status=1", $default = "", $CSSclass = "");
|
||||
|
||||
?>
|
||||
|
||||
<?php //fillComboWithValue("parent_category_id", "Parent Category", "parent_category_id", "tbl_accategories", "accategory_name", "accategory_id", $default = "", $CSSclass = "", $multiple = false, $condition = "status=1");
|
||||
?>
|
||||
@ -38,7 +48,7 @@
|
||||
<!--COL START-->
|
||||
<div class="col">
|
||||
<div class="form-group"> <label for="remarks">Remarks</label>
|
||||
<textarea class="form-control" id="remarks" name="remarks"></textarea>
|
||||
<textarea class="form-control" id="remarks" name="remarks"><?php echo isset($AccountCategory) ? $AccountCategory->remarks : ""; ?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<!--COL END-->
|
||||
@ -59,7 +69,7 @@
|
||||
</h5>
|
||||
</div>
|
||||
<div class="card-body table-responsive ">
|
||||
<?php $TableData = $ACCategories; ?>
|
||||
<?php $AccountCategory = $ACCategories; ?>
|
||||
<table class="table table-bordered table-striped longdataTable mt-3">
|
||||
<thead>
|
||||
<tr>
|
||||
@ -74,7 +84,7 @@
|
||||
<tbody>
|
||||
|
||||
<?php $sn = 0;
|
||||
foreach ($TableData as $TableRow) : $sn++; ?>
|
||||
foreach ($AccountCategory as $TableRow) : $sn++; ?>
|
||||
<?php foreach ($TableRow as $cols) : $id = $cols;
|
||||
break;
|
||||
endforeach; ?>
|
||||
|
@ -90,112 +90,5 @@ function displayCategoryTree($tree) {
|
||||
|
||||
|
||||
</div>
|
||||
<section class="content">
|
||||
<div class="container-fluid">
|
||||
|
||||
<div class="card">
|
||||
|
||||
<!-- ./card-header -->
|
||||
<div class="card-body p-0">
|
||||
|
||||
|
||||
<table class="table table-head-fixed text-nowrap table-bordered" id="treeTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th rowspan="2" class="col-6">Particulars</th>
|
||||
<th colspan="2" class="text-center col-2">Opening</th>
|
||||
<th colspan="2" class="text-center col-2">This Year</th>
|
||||
<th colspan="2" class="text-center col-2">Closing</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="text-center">Dr. Amount</th>
|
||||
<th class="text-center">Cr. Amount</th>
|
||||
<th class="text-center">Dr. Amount</th>
|
||||
<th class="text-center">Cr. Amount</th>
|
||||
<th class="text-center">Dr. Amount</th>
|
||||
<th class="text-center">Cr. Amount</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="parent">
|
||||
<td></td>
|
||||
<td>10</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="child">
|
||||
<td><span class="caret" onclick="toggleNode(this)">Current Assets</span></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="grandchild">
|
||||
<td><span class="caret" onclick="toggleNode(this)">Bank Assets</span></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="great-grandchild">
|
||||
<td>Nabil Bank</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="great-grandchild">
|
||||
<td>RBB Bank</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="grandchild">
|
||||
<td><span class="caret" onclick="toggleNode(this)">Another Grandchild</span></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="great-grandchild">
|
||||
<td>Child 1</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="great-grandchild">
|
||||
<td>Child 2</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<!-- /.card-body -->
|
||||
</div>
|
||||
|
||||
</div><!-- /.container-fluid -->
|
||||
</section>
|
||||
|
||||
<!-- /.content -->
|
@ -11,7 +11,7 @@
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div id="dataTable_wrapper">
|
||||
<?php $this->myaccounts->getAllAccountsTable(); ?>
|
||||
<?php $this->myaccounts->getAllAccountsTable($accategory_id = "", $full=-1); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -243,7 +243,7 @@ button:hover {
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form method=POST action="" enctype="multipart/form-data" name="tbl_accounts">
|
||||
<form id="myForm" method=POST action="" enctype="multipart/form-data" name="tbl_accounts">
|
||||
<div class="modal-body">
|
||||
|
||||
<div class="row">
|
||||
@ -301,7 +301,7 @@ button:hover {
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">Close</button>
|
||||
|
||||
<button class="btn btn-primary btn-sm" type="submit" name="submit">Save</button>
|
||||
<button class="btn btn-primary btn-sm" type="submit" name="action" value="saveacc">Save</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@ -333,6 +333,31 @@ button:hover {
|
||||
</script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#myForm').submit(function(event) {
|
||||
// event.preventDefault();
|
||||
|
||||
var formData = new FormData(this);
|
||||
|
||||
$.ajax({
|
||||
url: '<?php echo site_url("accounts/Vouchers/saveaccount/"); ?>',
|
||||
type: 'POST',
|
||||
data: formData,
|
||||
contentType: false,
|
||||
processData: false,
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
alert("saved");
|
||||
$('#exampleModal').modal('hide');
|
||||
$('#myForm')[0].reset();
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.log(error);
|
||||
alert("Error submitting form.");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("#posting_side_selector").change(function(e) {
|
||||
var posting_side = $("#posting_side_selector").val();
|
||||
if (posting_side == "debit") {
|
||||
@ -410,8 +435,8 @@ button:hover {
|
||||
} else {
|
||||
msg = "Account Head Not Selected!";
|
||||
}
|
||||
$("#account_id_cr").val() = 0;
|
||||
$("#account_id_dr").val() = 0;
|
||||
$("#account_id_cr").val('').trigger('change');
|
||||
$("#account_id_dr").val('').trigger('change');
|
||||
$("#errorBox h5").html(msg);
|
||||
$("#errorBox").fadeTo(2000, 500).slideUp(500, function() {
|
||||
$("#errorBox").slideUp(500);
|
||||
|
@ -142,9 +142,9 @@
|
||||
<tbody class="purchase-details-section">
|
||||
<tr class="purchase-detail">
|
||||
<td class="text-center bbsn">1</td>
|
||||
<td width=40%> <?php fillComboWithValue("item_id[]", "", "", "tbl_items", "title", "item_id"); ?></td>
|
||||
<td width=40%> <?php fillComboWithValue("item_id[]", "", "", "tbl_items", "title", "item_id", "", "select_item"); ?></td>
|
||||
<td width=10%> <input type="text" class="form-control input-group-sm" name="quantity[]"></td>
|
||||
<td width=5%><input type="text" class="form-control" name="pcs/dozen/kgs" required> </td>
|
||||
<td width=5%><input type="text" class="form-control item_unit" name="pcs/dozen/kgs" required> </td>
|
||||
<td width=15%><input type="text" class="form-control" name="rate[]"></td>
|
||||
<td width=15%><input type="text" class="form-control" name="total[]"></td>
|
||||
<td width="5%">
|
||||
@ -331,6 +331,33 @@
|
||||
var newPurchaseDetail = purchaseDetailClone.clone();
|
||||
$(".purchase-details-section").append(newPurchaseDetail);
|
||||
});
|
||||
|
||||
$(document).on('change', '.select_item', function(){
|
||||
|
||||
var selectedOption = $(this).find(':selected');
|
||||
var selectedValue = selectedOption.val();
|
||||
var unitInput = $(this).closest('.purchase-detail').find('.item_unit');
|
||||
if (selectedValue) {
|
||||
$.ajax({
|
||||
url: "<?php echo site_url("inventory/Purchases/getunitbyitem/"); ?>" + selectedValue,
|
||||
async: true,
|
||||
dataType:"json",
|
||||
method: 'POST',
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
var unitName = response.title;
|
||||
unitInput.val(unitName);
|
||||
},
|
||||
error: function() {
|
||||
console.log(error);
|
||||
alert("Error retrieving unit data.");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
unitInput.val('');
|
||||
alert("No item selected.");
|
||||
}
|
||||
});
|
||||
// Remove Purchase Detail
|
||||
$(document).on("click", ".remove-purchase-detail", function() {
|
||||
$(this).closest(".purchase-detail").remove();
|
||||
|
@ -65,12 +65,19 @@
|
||||
<?php endforeach; ?>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<?php $discount = $Purchase->discount ?>
|
||||
<div class="row bill-footer">
|
||||
<div class="col text-right">
|
||||
<p><strong>Subtotal:</strong> <?php echo myCurrency($total,true); ?></p>
|
||||
<p><strong>Tax (13%):</strong> <?php echo myCurrency($tax=($total*13)/100,true); ?></p>
|
||||
<p><strong>Total:</strong> <?php echo myCurrency(($total+$tax),true); ?></p>
|
||||
<p><strong>Discount percent:</strong> <?php echo myCurrency($discount,true); ?></p>
|
||||
<?php $discounted = ($total*$discount/100) ?>
|
||||
<p><strong>Discount amount:</strong> <?php echo myCurrency($discounted,true); ?></p>
|
||||
<?php $taxable = $total - $discounted ?>
|
||||
<p><strong>Taxable amount:</strong> <?php echo myCurrency($taxable,true); ?></p>
|
||||
<p><strong>Tax (13%):</strong> <?php echo myCurrency($tax=($taxable*13)/100,true); ?></p>
|
||||
<p><strong>Total:</strong> <?php echo myCurrency(($taxable+$tax),true); ?></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -147,10 +147,10 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<!-- <tr>
|
||||
<td>1</td>
|
||||
<td>Education</td>
|
||||
<td>Pcs</td>
|
||||
<td>Example</td>
|
||||
<td>Example</td>
|
||||
<td class="text-center">1000</td>
|
||||
<td class="text-right">1000</td>
|
||||
<td class="text-right">200000</td>
|
||||
@ -165,43 +165,64 @@
|
||||
|
||||
|
||||
<td class="text-center">100%</td>
|
||||
</tr>
|
||||
</tr> -->
|
||||
<?php
|
||||
$spuramount = 0;
|
||||
$ssalamount = 0;
|
||||
$sclqty = 0;
|
||||
$sclamount = 0;
|
||||
$scogs = 0;
|
||||
?>
|
||||
<?php $a = 0;
|
||||
foreach ($StockRecords as $Stock) : $a++; ?>
|
||||
foreach ($StockItems as $Stock) : $a++; ?>
|
||||
<tr>
|
||||
<td><?php echo $a; ?></td>
|
||||
<td><?php echo $Stock->Item->title; ?></td>
|
||||
<td><?php echo $Stock->Item->Unit->title; ?></td>
|
||||
<td class="text-right"><?php echo $Stock->qty; ?></td>
|
||||
<td class="text-right"><?php echo $Stock->price; ?></td>
|
||||
<td class="text-right"><?php echo $Stock->qty * $Stock->price; ?></td>
|
||||
<td> </td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td><?php echo $Stock->Summary->Unit->title; ?></td>
|
||||
<td class="text-right"><?php echo $Stock->Summary->Purchase->qty; ?></td>
|
||||
<td class="text-right"><?php echo myCurrency($Stock->Summary->Purchase->rate); ?></td>
|
||||
<td class="text-right"><?php echo myCurrency($puramount=$Stock->Summary->Purchase->amount); ?></td>
|
||||
<td class="text-right"><?php echo $Stock->Summary->Sales->qty; ?></td>
|
||||
<td class="text-right"><?php echo myCurrency($Stock->Summary->Sales->rate); ?></td>
|
||||
<td class="text-right"><?php echo myCurrency($salamount = $Stock->Summary->Sales->amount); ?></td>
|
||||
<?php $soldinventory = ((($Stock->Summary->Opening->qty)-($Stock->Summary->Closing->qty))/($Stock->Summary->Opening->qty))*100; ?>
|
||||
<td class="text-center"><?php echo $soldinventory . "%"; ?></td>
|
||||
<?php $remaininventory = 100 - $soldinventory; ?>
|
||||
<td class="text-center"><?php echo $remaininventory . "%"; ?></td>
|
||||
<td class="text-right"><?php echo $clqty = $Stock->Summary->Closing->qty; ?></td>
|
||||
<td class="text-right"><?php echo myCurrency($clamount = $Stock->Summary->Closing->amount); ?></td>
|
||||
<?php $cogs = ($Stock->Summary->Sales->qty) * ($Stock->Summary->Purchase->rate); ?>
|
||||
<td class="text-right"><?php echo myCurrency($cogs); ?></td>
|
||||
<?php $gp=($Stock->Summary->Sales->qty) - $cogs; ?>
|
||||
<?php $gpm = ($Stock->Summary->Sales->amount > 0) ? (($Stock->Summary->Sales->amount - $cogs) / $Stock->Summary->Sales->amount) * 100 : 0; ?>
|
||||
<td class="text-center"><?php echo number_format($gpm, 2) . "%"; ?></td>
|
||||
<td></td>
|
||||
<?php
|
||||
|
||||
$spuramount += $puramount;
|
||||
$ssalamount += $salamount;
|
||||
$sclqty += $clqty;
|
||||
$sclamount += $clamount;
|
||||
$scogs += $cogs;
|
||||
|
||||
?>
|
||||
</tr>
|
||||
<?php //pre($Stock);
|
||||
endforeach; ?>
|
||||
</tbody>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="5" class="text-right text-bold">Grand Total</td>
|
||||
<td class="text-right text-bold">5000</td>
|
||||
<td class="text-right text-bold">5000</td>
|
||||
<td class="text-right text-bold">ad</td>
|
||||
<td class="text-right text-bold">5000</td>
|
||||
<td class="text-right text-bold">5000</td>
|
||||
<td class="text-right text-bold">5000</td>
|
||||
<td class="text-right text-bold">5000</td>
|
||||
<td class="text-right text-bold">5000</td>
|
||||
<td class="text-right text-bold">5000</td>
|
||||
<td class="text-right text-bold">5000</td>
|
||||
<td class="text-right text-bold"><?php echo $spuramount ?></td>
|
||||
<td class="text-right text-bold"></td>
|
||||
<td class="text-right text-bold"></td>
|
||||
<td class="text-right text-bold"><?php echo $ssalamount ?></td>
|
||||
<td class="text-right text-bold"></td>
|
||||
<td class="text-right text-bold"></td>
|
||||
<td class="text-right text-bold"><?php echo $sclqty ?></td>
|
||||
<td class="text-right text-bold"><?php echo $sclamount ?></td>
|
||||
<td class="text-right text-bold"><?php echo $scogs ?></td>
|
||||
<td class="text-right text-bold"></td>
|
||||
|
||||
</tr>
|
||||
</tfoot>
|
||||
|
@ -57,14 +57,14 @@
|
||||
<tbody id="salesDetails">
|
||||
<tr class="sales-detail-duplicator">
|
||||
|
||||
<td> <select name="item_id[]" class="form-control" required>
|
||||
<td> <select name="item_id[]" class="form-control select_item" required>
|
||||
<option value="">Select Item</option>
|
||||
<?php foreach ($items as $item) : ?>
|
||||
<option value="<?php echo $item->item_id; ?>" required><?php echo $item->title; ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select></td>
|
||||
<td> <input type="text" class="form-control input-group-sm" name="qty[]" required></td>
|
||||
<td><input type="text" class="form-control" name="pcs/dozen/kgs" required> </td>
|
||||
<td><input type="text" class="form-control item_unit" name="pcs/dozen/kgs" required> </td>
|
||||
<td><input type="text" class="form-control" name="rate[]" required></td>
|
||||
<td><input type="text" class="form-control" name="ltotal[]" required></td>
|
||||
<td>
|
||||
@ -87,7 +87,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-right">
|
||||
<input class="form-control1" type="text" name="discountpercentage" id="discountpercentage" value="5" width="2%"> <b>% Discount</b>
|
||||
<input class="form-control1" type="text" name="discountpercentage" id="discountpercentage" value="0" width="2%"> <b>% Discount</b>
|
||||
</td>
|
||||
<td class="text-right"><b> <input type="text" class="form-control" id="discount"></b></td>
|
||||
<td></td>
|
||||
@ -175,30 +175,32 @@
|
||||
// calculateTotals();
|
||||
});
|
||||
|
||||
// $(document).on('change', '.select_item', function(){
|
||||
$(document).on('change', '.select_item', function(){
|
||||
|
||||
// var selectedOption = $(this).find(':selected');
|
||||
// var selectedValue = selectedOption.val();
|
||||
// alert(selectedValue);
|
||||
// var unitInput = $(this).closest('.sales-detail-duplicator').find('.item_unit');
|
||||
// if (selectedValue) {
|
||||
// $.ajax({
|
||||
// url: '<?php //echo base_url(); ?>application/controllers/inventory/Sales/getUnitByItemId/' + selectedValue,
|
||||
// method: 'POST',
|
||||
// success: function(response) {
|
||||
// console.log(response);
|
||||
// unitInput.val(unitName);
|
||||
// alert("Selected Item Value: " + selectedValue + "\nUnit: " + unitName);
|
||||
// },
|
||||
// error: function() {
|
||||
// alert("Error retrieving unit data.");
|
||||
// }
|
||||
// });
|
||||
// } else {
|
||||
// unitInput.val('');
|
||||
// alert("No item selected.");
|
||||
// }
|
||||
// });
|
||||
var selectedOption = $(this).find(':selected');
|
||||
var selectedValue = selectedOption.val();
|
||||
var unitInput = $(this).closest('.sales-detail-duplicator').find('.item_unit');
|
||||
if (selectedValue) {
|
||||
$.ajax({
|
||||
url: "<?php echo site_url("inventory/Sales/getunitbyitem/"); ?>" + selectedValue,
|
||||
async: true,
|
||||
dataType:"json",
|
||||
method: 'POST',
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
var unitName = response.title;
|
||||
unitInput.val(unitName);
|
||||
},
|
||||
error: function() {
|
||||
console.log(error);
|
||||
alert("Error retrieving unit data.");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
unitInput.val('');
|
||||
alert("No item selected.");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// $(document).on("click", ".remove-sales-detail", function() {
|
||||
|
@ -63,19 +63,24 @@
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; endforeach; ?>
|
||||
|
||||
<?php $discount = $Sales->discount ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row bill-footer">
|
||||
<div class="col text-right">
|
||||
<p><strong>Subtotal:</strong> <?php echo myCurrency($total,true); ?></p>
|
||||
<p><strong>Tax (13%):</strong> <?php echo myCurrency($tax=($total*13)/100,true); ?></p>
|
||||
<p><strong>Total:</strong> <?php echo myCurrency(($total+$tax),true); ?></p>
|
||||
<p><strong>Discount percent:</strong> <?php echo myCurrency($discount,true); ?></p>
|
||||
<?php $discounted = ($total*$discount/100) ?>
|
||||
<p><strong>Discount amount:</strong> <?php echo myCurrency($discounted,true); ?></p>
|
||||
<?php $taxable = $total - $discounted ?>
|
||||
<p><strong>Taxable amount:</strong> <?php echo myCurrency($taxable,true); ?></p>
|
||||
<p><strong>Tax (13%):</strong> <?php echo myCurrency($tax=($taxable*13)/100,true); ?></p>
|
||||
<p><strong>Total:</strong> <?php echo myCurrency(($taxable+$tax),true); ?></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user