commitall
This commit is contained in:
905
account/application/controllers/Ajax.php
Normal file
905
account/application/controllers/Ajax.php
Normal file
@ -0,0 +1,905 @@
|
||||
<?php
|
||||
|
||||
class Ajax extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('MUsers');
|
||||
$this->load->helper("accounts");
|
||||
checkLogin();
|
||||
}
|
||||
function deleteVoucher($voucher_id)
|
||||
{
|
||||
$this->myaccounts->deleteVoucher($voucher_id);
|
||||
}
|
||||
function getVoucherDetailsTable($voucher_id)
|
||||
{
|
||||
$VD = $this->db->where("voucher_id", $voucher_id)->get("tbl_voucherdetails")->result();
|
||||
$html = "<table class='table table-bordered'>";
|
||||
$html .= "<tr><th>Account</th><th>Narration</th><th>Dr</th><th>Cr</th></tr>";
|
||||
foreach ($VD as $T) {
|
||||
$html .= "<tr>";
|
||||
$html .= "<td class='col-3'>" . getFieldfromValue("tbl_accounts", "account_name", "account_id", $T->account_id) . "</td>";
|
||||
$html .= "<td>" . $T->narration . "</td>";
|
||||
$html .= "<td class='col-2'>" . myCurrency($T->dr) . "</td>";
|
||||
$html .= "<td class='col-2'>" . myCurrency($T->cr) . "</td>";
|
||||
$html .= "</tr>";
|
||||
}
|
||||
$html .= "</table>";
|
||||
echo $html;
|
||||
}
|
||||
function getAccountsTableByCategory($accategory_id)
|
||||
{
|
||||
|
||||
$this->myaccounts->getAccountsTableByCategory($accategory_id);
|
||||
}
|
||||
function getAllAccountsTable()
|
||||
{
|
||||
|
||||
$this->myaccounts->getAllAccountsTable();
|
||||
}
|
||||
function dragDrop()
|
||||
{
|
||||
}
|
||||
function updatePrivilege($id)
|
||||
{
|
||||
$user = $this->MUsers->getUsers($id);
|
||||
$privileges = (array) json_decode($user->user_privilege); ?>
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
|
||||
<!-- Modal Header -->
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title">Edit Privileges For <?php echo $user->user_name; ?> (<?php echo $user->user_email; ?>)</h4>
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
</div>
|
||||
<form action="<?php echo base_url('users/update/' . $user->user_id); ?>" method="post">
|
||||
|
||||
<!-- Modal body -->
|
||||
<div class="modal-body">
|
||||
<table class="table">
|
||||
<?php
|
||||
$controllers = $this->config->item('checkControllers');
|
||||
|
||||
foreach ($controllers as $controller) :
|
||||
$val = 0;
|
||||
if (!empty($privileges[$controller])) {
|
||||
$val = $privileges[$controller];
|
||||
}
|
||||
changePrivilege($controller, $val);
|
||||
endforeach;
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- Modal footer -->
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-danger" type="submit">Update</button>
|
||||
<button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
function changePassword($id)
|
||||
{
|
||||
$inputArray = array(
|
||||
'user_password' => $_POST['password'],
|
||||
);
|
||||
$this->MUsers->UpdateUser($inputArray, $id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
function changePrivilege($name, $value)
|
||||
{
|
||||
?>
|
||||
<tr>
|
||||
<td style="text-transform: capitalize"><?php echo $name; ?></td>
|
||||
<td><label><input type="checkbox" value="1" <?php if ($value >= 1) echo 'checked'; ?> name="<?php echo $name; ?>"> view</label></td>
|
||||
<td><label><input type="checkbox" value="2" <?php if ($value >= 2) echo 'checked'; ?> name="<?php echo $name; ?>"> add/update</label></td>
|
||||
<td><label><input type="checkbox" value="3" <?php if ($value >= 3) echo 'checked'; ?> name="<?php echo $name; ?>"> delete</label></td>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
function showpodetails($po_id)
|
||||
{
|
||||
$t = "select * from tbl_podetails where po_id=$po_id";
|
||||
$PoDetails = $this->db->query($t)->result();
|
||||
foreach ($PoDetails as $details) {
|
||||
$details->item_name = $this->db->query("select * from tbl_items where item_id=$details->item_id")->row();
|
||||
}
|
||||
$t = "select * from tbl_po where po_id=$po_id";
|
||||
$Po = $this->db->query($t)->row();
|
||||
$vendor_name = $this->db->query("select * from tbl_vendors where vendor_id=$Po->vendor_id")->row();
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>YR tyres invoice</title>
|
||||
<link rel="stylesheet" href="<?php echo base_url(); ?>uploads/style.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<header class="tp-hdr-sec">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-3 col-lg-3 algn-cntr">
|
||||
<div class="logo-sec">
|
||||
<img src="<?php echo base_url(); ?>uploads/logo.png" alt="Yr tyres">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-5 col-lg-5">
|
||||
<div class="yr-tpdetas">
|
||||
<h1 class="yr0tryoe">Y.R TYRE</h1>
|
||||
<h3>INDUSTRIES PVT. LTD.</h3>
|
||||
<h4>Strength | Speed | Grip</h4>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4 col-lg-4">
|
||||
<div class="rgt-sec_prt">
|
||||
<ul>
|
||||
<li><i class="fa fa-globe"></i> YR Estate bld, Thir Bam Sadak-5, Baluwatar, Kathmandu, Nepal</li>
|
||||
<li><i class="fa fa-globe"></i> +977 1 4421615, 4421587</li>
|
||||
<li><i class="fa fa-globe"></i> mail@yrtyres.com</li>
|
||||
<li><i class="fa fa-globe"></i> www.yrtyres.com</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<section class="purchs-ord">
|
||||
<div class="container">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12 purc-bgprt">
|
||||
<span>Purchase Order</span>
|
||||
</div>
|
||||
<div class="col-lg-12 col-md-12 rgt-pt-20">
|
||||
<label for="date">Date</label>
|
||||
<input type="text" name="date" class="mb-10 inpt-wdt" value=" <?php echo $Po->po_date ?>"><br>
|
||||
<label for="po">PO#</label>
|
||||
<input type="text" name="po" class="inpt-wdt"><br>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section class="vedr-sph">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-md-6">
|
||||
<div class="wst-100-bg">
|
||||
<span>VENDOR</span>
|
||||
</div>
|
||||
<ul class="ul_sec-prst">
|
||||
<li>Qingdao Yonghe International Trade Co. Ltd. </li>
|
||||
<li>NO.1275, WANGSHA ROAD, CHENGYANG DISTRICT, QINGDAO CITY, CHINA</li>
|
||||
<li>yh@qdyhltd.com</li>
|
||||
<li>+86-532- 86468187-0</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6">
|
||||
<div class="wst-100-bg">
|
||||
<span>SHIP TO</span>
|
||||
</div>
|
||||
<ul class="ul_sec-prst">
|
||||
<li>Y. R. Tye Industries Pvt. Ltd. </li>
|
||||
<li>YR Estate Building, Thirbam Sadak, Baluwatar-4, Kathmandu, Nepa</li>
|
||||
<li>mail@yrtyres.com</li>
|
||||
<li>+977-1-4421615, 4421587 </li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
<div class="col-lg-12 col-md-12 txt-rgt-prt">
|
||||
<p>VAT: 606532363</p>
|
||||
<p>EXIM: 6065323630128NP</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="upr_tbl-secprt">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<table class="tg">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="tg-0pky">EQUISITIONER</th>
|
||||
<th class="tg-0pky">SHIP VIA</th>
|
||||
<th class="tg-0pky">Delivery To</th>
|
||||
<th class="tg-0pky">SHIPPING TERMS</th>
|
||||
<th class="tg-0pky">CUSTOM ENTRY POINT</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="tg-0pky"> </td>
|
||||
<td class="tg-0pky"></td>
|
||||
<td class="tg-0pky">Chitwan, Nepal</td>
|
||||
<td class="tg-0pky"></td>
|
||||
<td class="tg-0pky">Tatopani-Nepal</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
<section class="lwr_tbl-secprt">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<table class="tg">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="tg-0pky">ITEMS #</th>
|
||||
<th class="tg-0pky">DESCRIPTION</th>
|
||||
<th class="tg-0pky">QTY</th>
|
||||
<th class="tg-0pky">UNIT PRICE</th>
|
||||
<th class="tg-0pky">TOTAL</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<?php $a = 0;
|
||||
foreach ($PoDetails as $details) : $a++; ?>
|
||||
<tr>
|
||||
<td><?php echo $a; ?></td>
|
||||
<td><?php echo $details->item_name->item_name; ?></td>
|
||||
<td><?php echo $details->item_qty; ?></td>
|
||||
<td>USD <?php echo $details->est_price; ?></td>
|
||||
<?php $total[$a] = $details->item_qty * $details->est_price; ?>
|
||||
<td>USD <?php echo $total[$a]; ?></td>
|
||||
</tr>
|
||||
|
||||
<?php endforeach; ?>
|
||||
<?php for ($x = $a; $x <= 9; $x++) { ?>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
|
||||
<td></td>
|
||||
</tr>
|
||||
|
||||
|
||||
<?php } ?>
|
||||
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
<section class="trms-cnd-ttl">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-md-6">
|
||||
<div class="wst-100-bg">
|
||||
<span>Terms: </span>
|
||||
</div>
|
||||
<div class="trsm-cnd_prt ttms-trs-1">
|
||||
<ul>
|
||||
<li>1. Payment Terms: 100% TT before dispatch. </li>
|
||||
<li>2. Desired Dispatch period: 35 days from the date of PO
|
||||
issued. </li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6">
|
||||
<div class="trsm-cnd_prt">
|
||||
<ul>
|
||||
<li><span>Subtotal:</span>
|
||||
<p>USD <?php echo array_sum($total) ?></p>
|
||||
</li>
|
||||
<li><span>Discount:</span>
|
||||
<p>USD 10.00</p>
|
||||
</li>
|
||||
<li><span>After dis:</span>
|
||||
<p>USD 2,400.00</p>
|
||||
</li>
|
||||
<li><span>Tax:</span> </li>
|
||||
<li><span> Net:</span>
|
||||
<p>USD 2,400.00</p>
|
||||
</li>
|
||||
<li><span>In Words:</span>
|
||||
<p>Two Thousand four hundred only.</p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section class="end_secprt">
|
||||
<div class="container">
|
||||
<div class="sdr_cenr-tr">
|
||||
<h5>For:</h5>
|
||||
<ul>
|
||||
<li>Y. R. Tyre Industries Pvt. Ltd.</li>
|
||||
<li>Yugma Malla</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="lwr-rd-prt">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-6 col-lg-6">
|
||||
<p class="pb-0-p-prt">Factory Address: KALIKA MUNICIPALITY-8,
|
||||
NEURENI CHITWAN, NEPAL</p>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6 col-lg-6">
|
||||
<p class="pb-0-p-prt">Dedicated for Vehicle Tyre Manufacturing</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
}
|
||||
|
||||
function showsodetails($so_id)
|
||||
{
|
||||
$t = "select * from tbl_salesorderdetails where salesorder_id=$so_id";
|
||||
$SoDetails = $this->db->query($t)->result();
|
||||
$t = "select * from tbl_salesorders where salesorder_id=$so_id";
|
||||
$So = $this->db->query($t)->row();
|
||||
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Form</title>
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
|
||||
|
||||
<style type="text/css">
|
||||
.tg {
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
}
|
||||
|
||||
.tg td {
|
||||
border-color: black;
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
font-family: Arial, sans-serif;
|
||||
font-size: 14px;
|
||||
overflow: hidden;
|
||||
padding: 10px 5px;
|
||||
word-break: normal;
|
||||
}
|
||||
|
||||
.tg th {
|
||||
border-color: black;
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
font-family: Arial, sans-serif;
|
||||
font-size: 14px;
|
||||
font-weight: normal;
|
||||
overflow: hidden;
|
||||
padding: 10px 5px;
|
||||
word-break: normal;
|
||||
}
|
||||
|
||||
.tg .tg-0lax {
|
||||
text-align: left;
|
||||
vertical-align: top;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.snd-prt-tp {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.lft-prt-tp {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.rgt-prt-tp {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: end;
|
||||
}
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.pt-50 {
|
||||
padding-top: 50px;
|
||||
}
|
||||
|
||||
.txt-cntr {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
input {
|
||||
height: 35px;
|
||||
}
|
||||
|
||||
.bdr-sec {
|
||||
border: 1px solid #000;
|
||||
}
|
||||
|
||||
.lwr-sc-sec {
|
||||
padding: 40px 0px;
|
||||
}
|
||||
|
||||
.pd-l {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.mg-r {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.mg-40 {
|
||||
padding-bottom: 40px;
|
||||
}
|
||||
|
||||
.inr-brd-sec {
|
||||
padding-left: 50px;
|
||||
padding-top: 20px;
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
|
||||
label {
|
||||
width: 20%;
|
||||
}
|
||||
|
||||
.frm-grp-prt {
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
.wd-30 {
|
||||
width: 30%;
|
||||
}
|
||||
|
||||
.wd-50 {
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.wd-45 {
|
||||
width: 45%;
|
||||
}
|
||||
|
||||
.pb-40 {
|
||||
padding-bottom: 40px;
|
||||
}
|
||||
|
||||
td {
|
||||
min-width: 130px;
|
||||
}
|
||||
|
||||
.tbl-sec-prt {
|
||||
border: 1px solid #000;
|
||||
padding: 60px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.txt-rgt {
|
||||
text-align: right !important;
|
||||
}
|
||||
|
||||
.mn-wd-400 {
|
||||
min-width: 400px;
|
||||
}
|
||||
|
||||
.bfr-prt h4 {
|
||||
font-size: 18px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.mgtp-40 {
|
||||
margin-top: 40px;
|
||||
}
|
||||
|
||||
.tct-cntr {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.bfr-prt h4::before {
|
||||
content: " ";
|
||||
position: absolute;
|
||||
background: #000;
|
||||
height: 1px;
|
||||
width: 200px;
|
||||
bottom: -6px;
|
||||
left: 22%;
|
||||
}
|
||||
|
||||
@media (min-width: 992px) {
|
||||
.modal-lg {
|
||||
max-width: 1200px !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<?php
|
||||
$d = strtotime($So->created_date);
|
||||
$date = date("Y-m-d", $d); ?>
|
||||
|
||||
<body class="pt-50">
|
||||
<div class="container">
|
||||
<div class="heading-prt txt-cntr pb-40">
|
||||
<h1>Sales Order</h1>
|
||||
</div>
|
||||
<div class="snd-prt-tp">
|
||||
<div class="lft-prt-tp">
|
||||
<label for="creat-dt">Created Date:</label>
|
||||
<input type="text" name="creat-dt" value="<?php echo $date; ?>">
|
||||
</div>
|
||||
<div class="rgt-prt-tp">
|
||||
<label for="ord-dt">Order Date:</label>
|
||||
<input type="text" name="ord-dt" value="<?php echo $date; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="lwr-sc-sec">
|
||||
<div class="row">
|
||||
<div class="col-md-6 col-lg-6 ">
|
||||
<div class="bdr-sec mg-r inr-brd-sec">
|
||||
<div class="ttl-tp-prt">
|
||||
<h3>Buyer Info</h3>
|
||||
</div>
|
||||
<div class="frm-prt-lwsd">
|
||||
<div class="frm-grp-prt">
|
||||
<label for="creat-dt" class="wd-30">Name</label>
|
||||
<input type="text" name="name" class="wd-50" value="<?php echo $So->name; ?>">
|
||||
</div>
|
||||
<div class="frm-grp-prt">
|
||||
<label for="address" class="wd-30">Address</label>
|
||||
<input type="text" name="address" class="wd-50" value="<?php echo $So->address; ?>">
|
||||
</div>
|
||||
<div class="frm-grp-prt">
|
||||
<label for="phone" class="wd-30">Phone</label>
|
||||
<input type="text" name="phone" class="wd-50" value="<?php echo $So->phone; ?>">
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="frm-grp-prt">
|
||||
<label for="bilname" class="wd-45">Billing Name</label>
|
||||
<input type="text" name="billing_name" class="wd-50" value="<?php echo $So->billing_name; ?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="frm-grp-prt">
|
||||
<label for="pan" class="wd-30">Pan/VAT </label>
|
||||
<input type="text" name="pan" class="wd-50" value="<?php echo $So->pan; ?>">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6 col-lg-6 ">
|
||||
<div class="bdr-sec mg-l inr-brd-sec">
|
||||
<div class="ttl-tp-prt">
|
||||
<h3>Offical Info</h3>
|
||||
</div>
|
||||
<div class="frm-prt-lwsd">
|
||||
<div class="frm-grp-prt">
|
||||
<label for="dltby" class="wd-30">Dealt By</label>
|
||||
<input type="text" name="dltby" class="wd-50" value="<?php echo $So->name; ?>">
|
||||
</div>
|
||||
<div class="frm-grp-prt">
|
||||
<div class="frm-grp-prt">
|
||||
<label for="darea" class="wd-30">Distribution Area</label>
|
||||
<input type="text" name="darea" class="wd-50" value="<?php echo $So->name; ?>">
|
||||
</div>
|
||||
<div class="frm-grp-prt">
|
||||
<label for="pmode" class="wd-30">Payment Mode</label>
|
||||
<input type="text" name="pmode" class="wd-50" value="<?php echo $So->name; ?>">
|
||||
</div>
|
||||
<div class="frm-grp-prt">
|
||||
<label for="trans" class="wd-30">Transportation</label>
|
||||
<input type="text" name="trans" class="wd-50" value="<?php echo $So->name; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="thd-sec-prt">
|
||||
<div class="tbl-sec-prt">
|
||||
<table class="tg">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="">Sn</th>
|
||||
<th class="tg-0lax">Description</th>
|
||||
<th class="tg-0lax">Qty</th>
|
||||
<th class="tg-0lax">Rate</th>
|
||||
<th class="tg-0lax">Total</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php $a = 0;
|
||||
foreach ($SoDetails as $SoDetail) : $a++; ?>
|
||||
<tr>
|
||||
<td class="tg-0lax"><?php echo $a ?> </td>
|
||||
<td class="tg-0lax mn-wd-400"><?php echo $SoDetail->item_id ?> </td>
|
||||
<td class="tg-0lax"><?php echo $SoDetail->qty ?></td>
|
||||
<td class="tg-0lax"><?php echo $SoDetail->rate ?></td>
|
||||
<td class="tg-0lax"><?php echo ($SoDetail->qty * $SoDetail->rate); ?>
|
||||
<?php $total[$a] = ($SoDetail->qty * $SoDetail->rate) ?> </td>
|
||||
</tr>
|
||||
|
||||
<?php endforeach; ?>
|
||||
<tr>
|
||||
<td class="tg-0lax"> </td>
|
||||
<td class="tg-0lax txt-rgt">Total</td>
|
||||
<td class="tg-0lax"></td>
|
||||
<td class="tg-0lax"></td>
|
||||
<td class="tg-0lax"><?php $total = array_sum($total);
|
||||
echo $total ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tg-0lax"></td>
|
||||
<td class="tg-0lax txt-rgt">Vat Amount</td>
|
||||
<td class="tg-0lax"></td>
|
||||
<td class="tg-0lax"></td>
|
||||
<td class="tg-0lax"><?php $vat = ($total * 13 / 100);
|
||||
echo $vat ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tg-0lax"></td>
|
||||
<td class="tg-0lax txt-rgt">Grand Total</td>
|
||||
<td class="tg-0lax"></td>
|
||||
<td class="tg-0lax"></td>
|
||||
<td class="tg-0lax"><?php echo ($vat + $total) ?></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="lst-sec-prt mgtp-40 tct-cntr">
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="bfr-prt">
|
||||
<h4>Prepared By</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="bfr-prt">
|
||||
<h4>Verified By</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="bfr-prt">
|
||||
<h4>Approved By</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
<?php
|
||||
|
||||
|
||||
}
|
||||
function showemployee($id)
|
||||
{
|
||||
$t = "select * from tbl_employees where employee_id=$id";
|
||||
$Employee = $this->db->query($t)->row();
|
||||
$Employee->employee_type = $this->db->query("select * from tbl_employeetype where employeetype_id=$Employee->employeetype_id")->row();
|
||||
$Employee->employee_department = $this->db->query("select * from tbl_departments where department_id=$Employee->department_id")->row();
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h2> </h2>
|
||||
<table class="table table-condensed table-striped">
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<td><?php echo $Employee->employee_name ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Employee Type</th>
|
||||
<td><?php echo $Employee->employee_type->employeetype_name ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Gender</th>
|
||||
<td><?php echo $Employee->employee_gender ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Department</th>
|
||||
<td><?php echo $Employee->employee_department->department_name ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Address</th>
|
||||
<td><?php echo $Employee->employee_address ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>DOB</th>
|
||||
<td><?php echo $Employee->employee_dob ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>DOJ</th>
|
||||
<td><?php echo $Employee->employee_doj ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>PAN</th>
|
||||
<td><?php echo $Employee->employee_pan ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Email</th>
|
||||
<td><?php echo $Employee->employee_email ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Contact</th>
|
||||
<td><?php echo $Employee->employee_contact ?></td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
function UpdateAttendance()
|
||||
{
|
||||
$arraydata = array(
|
||||
'attendance' => $_POST['attendance'],
|
||||
'reason' => $_POST['reason'],
|
||||
'status' => 1,
|
||||
|
||||
);
|
||||
$this->db->where('employee_id', $_POST['employee_id']);
|
||||
$this->db->update('tbl_attendances', $arraydata);
|
||||
}
|
||||
|
||||
function updateholiday()
|
||||
{
|
||||
$arraydata = array(
|
||||
|
||||
'day_holiday' => $_POST['day_holiday'],
|
||||
'day_work' => $_POST['day_work'],
|
||||
|
||||
|
||||
);
|
||||
$this->db->where('day_id', $_POST['day_id']);
|
||||
$this->db->update('tbl_officecalendar', $arraydata);
|
||||
redirect($_POST['url']);
|
||||
}
|
||||
function updatefactoryholiday()
|
||||
{
|
||||
$arraydata = array(
|
||||
|
||||
'day_holiday' => $_POST['day_holiday'],
|
||||
'day_work' => $_POST['day_work'],
|
||||
|
||||
|
||||
);
|
||||
$this->db->where('day_id', $_POST['day_id']);
|
||||
$this->db->update('tbl_factorycalendar', $arraydata);
|
||||
redirect($_POST['url']);
|
||||
}
|
||||
function UpdateStock()
|
||||
{
|
||||
$stockcheck = $this->db->query("select * from tbl_stocks where item_id='" . $_POST['item_id'] . "' and stockdate='" . date('Y-m-d') . "'")->row();
|
||||
|
||||
$arraydata = array(
|
||||
'stock_value' => $_POST['stock_value'],
|
||||
'stockdate' => date('Y-m-d'),
|
||||
|
||||
'status' => 1,
|
||||
|
||||
);
|
||||
if ($stockcheck == '') {
|
||||
$arraydata['item_id'] = $_POST['item_id'];
|
||||
$this->db->insert('tbl_stocks', $arraydata);
|
||||
} else {
|
||||
$this->db->where('item_id', $_POST['item_id']);
|
||||
$this->db->update('tbl_stocks', $arraydata);
|
||||
}
|
||||
}
|
||||
|
||||
function UpdateStocks()
|
||||
{
|
||||
|
||||
// $stockcheck=$this->db->query("select * from tbl_stock where item_id='".$_POST['item_id']."' and category_id= '".$_POST['category_id']."' and stockdate='".date('Y-m-d')."'")->row();
|
||||
|
||||
$arraydata = array(
|
||||
'stock_in_value' => $_POST['stock_value'],
|
||||
'stockdate' => date('Y-m-d'),
|
||||
'category_id' => $_POST['category_id'],
|
||||
'status' => 1,
|
||||
|
||||
);
|
||||
// print_r($_POST);
|
||||
|
||||
$arraydata['item_id'] = $_POST['item_id'];
|
||||
$this->db->insert('tbl_stock', $arraydata);
|
||||
}
|
||||
function TransferStock()
|
||||
{
|
||||
$itemalias = $this->db->query("select * from tbl_items where item_id=" . $_POST['item_id'])->row();
|
||||
$transferStockCheck = $this->db->query("select * from tbl_items where item_alias='" . $_POST['item_alias'] . "' and category_id='5'")->row();
|
||||
|
||||
$stockcheck = $this->db->query("select * from tbl_stocks where item_id='" . $transferStockCheck->item_id . "' and stockdate='" . date('Y-m-d') . "'")->row();
|
||||
|
||||
$arraydata = array(
|
||||
'stock_value' => $_POST['stock_value'],
|
||||
'stockdate' => date('Y-m-d'),
|
||||
|
||||
'status' => 1,
|
||||
|
||||
);
|
||||
if ($stockcheck == '') {
|
||||
$arraydata['item_id'] = $transferStockCheck->item_id;
|
||||
$this->db->insert('tbl_stocks', $arraydata);
|
||||
} else {
|
||||
$this->db->where('item_id', $transferStockCheck->item_id);
|
||||
$this->db->update('tbl_stocks', $arraydata);
|
||||
}
|
||||
}
|
||||
}
|
8
account/application/controllers/AjaxDrag.php
Normal file
8
account/application/controllers/AjaxDrag.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
$position = $_POST['position'];
|
||||
$i=1;
|
||||
foreach($position as $k=>$v){
|
||||
$sql = "Update tbl_studyabroads SET display_order=".$i." WHERE studyabroad_id=".$v;
|
||||
return $this->db->query($sql);
|
||||
$i++;
|
||||
}
|
15
account/application/controllers/Dbbackup.php
Normal file
15
account/application/controllers/Dbbackup.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Dbbackup extends CI_Controller {
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
|
||||
}
|
||||
|
||||
public function index() {
|
||||
$this->myaccounts->backupDatabase();
|
||||
|
||||
}
|
||||
}
|
38
account/application/controllers/Defaults.php
Normal file
38
account/application/controllers/Defaults.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
class Defaults extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
checkLogin();
|
||||
}
|
||||
public function index()
|
||||
{
|
||||
$data['dataValue'] = $this->session;
|
||||
$query = $this->db->select('bbnepal_category, accategory_id')
|
||||
->from('tbl_acdefaults')
|
||||
->get();
|
||||
$dataA = array();
|
||||
foreach ($query->result() as $row) {
|
||||
$dataA[$row->bbnepal_category] = $row->accategory_id;
|
||||
}
|
||||
$data['Defaults'] = $dataA;
|
||||
if ($_POST) {
|
||||
pre($_POST);
|
||||
|
||||
$students_section = $_POST['students_section'];
|
||||
$teachers_section = $_POST['teachers_section'];
|
||||
$fee_types_section = $_POST['fee_types_section'];
|
||||
$expenses_section = $_POST['expenses_section'];
|
||||
$inventory_purchase_section = $_POST['inventory_purchase_section'];
|
||||
$inventory_sales_section = $_POST['inventory_sales_section'];
|
||||
|
||||
|
||||
$student_defaults = $this->db->query("SELECT * FROM tbl_acdefaults WHERE ");
|
||||
|
||||
|
||||
die;
|
||||
}
|
||||
loadView('setup/defaults', $data);
|
||||
}
|
||||
}
|
18
account/application/controllers/Login.php
Normal file
18
account/application/controllers/Login.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Login extends CI_Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$data['re'] = '';
|
||||
if (isset($_GET['url'])) {
|
||||
$data['re'] = $_GET['url'];
|
||||
}
|
||||
if (isset($_POST['email'])) {
|
||||
authenticateUser($_POST['email'], $_POST['password'], $data['re']);
|
||||
}
|
||||
$this->load->view("login",$data);
|
||||
}
|
||||
|
||||
}
|
10
account/application/controllers/Logout.php
Normal file
10
account/application/controllers/Logout.php
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Logout extends CI_Controller {
|
||||
public function index()
|
||||
{
|
||||
$this->session->sess_destroy();
|
||||
redirect("");
|
||||
}
|
||||
}
|
7
account/application/controllers/Page404.php
Normal file
7
account/application/controllers/Page404.php
Normal file
@ -0,0 +1,7 @@
|
||||
<?php
|
||||
class Page404 extends CI_Controller
|
||||
{
|
||||
public function index(){
|
||||
loadview('404page');
|
||||
}
|
||||
}
|
819
account/application/controllers/Setup.php
Normal file
819
account/application/controllers/Setup.php
Normal file
@ -0,0 +1,819 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Setup extends CI_Controller {
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
checkLogin();
|
||||
}
|
||||
public function index()
|
||||
{
|
||||
$data['dataValue']=$this->session;
|
||||
loadView('setup/tables',$data);
|
||||
}
|
||||
public function officecalendar()
|
||||
{
|
||||
/* Setup - Initialize a calendar
|
||||
$startDate=new DateTime('2010-01-01');
|
||||
$endDate=new DateTime('2040-12-31');
|
||||
//$t=array();
|
||||
for($i=$startDate;$i<=$endDate;$i->modify('+1 day'))
|
||||
{
|
||||
$day_ad=$i->format("Y-m-d");
|
||||
$day_bs=NepaliDate($day_ad);
|
||||
$day_weekday=$i->format("l");
|
||||
$day_work=($day_weekday=="Saturday")?0:1;
|
||||
$day_holiday=($day_weekday=="Saturday")?"Saturday":"";
|
||||
$remarks="";
|
||||
$status=1;
|
||||
$t="insert into tbl_officecalendar (day_ad, day_bs, day_weekday, day_work, day_holiday, remarks, status) values ('".$day_ad."', '".$day_bs."', '".$day_weekday."', '".$day_work."', '".$day_holiday."', '".$remarks."', '".$status."')";
|
||||
$this->db->query($t);
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
$data['dataValue']=$this->session;
|
||||
$data['pageTitle']="Setup Official Calendar";
|
||||
loadView("setup/officecalendar",$data);
|
||||
}
|
||||
public function factorycalendar()
|
||||
{
|
||||
/* Setup - Initialize a calendar
|
||||
$startDate=new DateTime('2010-01-01');
|
||||
$endDate=new DateTime('2040-12-31');
|
||||
//$t=array();
|
||||
for($i=$startDate;$i<=$endDate;$i->modify('+1 day'))
|
||||
{
|
||||
$day_ad=$i->format("Y-m-d");
|
||||
$day_bs=NepaliDate($day_ad);
|
||||
$day_weekday=$i->format("l");
|
||||
$day_work=($day_weekday=="Saturday")?0:1;
|
||||
$day_holiday=($day_weekday=="Saturday")?"Saturday":"";
|
||||
$remarks="";
|
||||
$status=1;
|
||||
$t="insert into tbl_officecalendar (day_ad, day_bs, day_weekday, day_work, day_holiday, remarks, status) values ('".$day_ad."', '".$day_bs."', '".$day_weekday."', '".$day_work."', '".$day_holiday."', '".$remarks."', '".$status."')";
|
||||
$this->db->query($t);
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
$data['dataValue']=$this->session;
|
||||
$data['pageTitle']="Setup Factory Work Calendar";
|
||||
loadView("setup/factorycalendar",$data);
|
||||
}
|
||||
public function itemcategories($alias="",$params=array())
|
||||
|
||||
{
|
||||
|
||||
$data['dataValue']=$this->session;
|
||||
|
||||
$data['pageTitle']="Item Categories";
|
||||
|
||||
switch($alias)
|
||||
{
|
||||
case 'add':
|
||||
if(isset($_POST['submit'])){
|
||||
$TableData=array(
|
||||
'category_name'=>filter_var($_POST['category_name'],FILTER_SANITIZE_STRING),
|
||||
'category_desc'=>filter_var($_POST['category_desc'],FILTER_SANITIZE_STRING),
|
||||
'created_by'=>'admin',
|
||||
'created_on'=>date('Y-m-d H:i:s'),
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
'status'=>1,
|
||||
'parent_category'=>filter_var($_POST['parent_category'],FILTER_SANITIZE_STRING),
|
||||
);
|
||||
$this->db->insert('tbl_itemcategories',$TableData);
|
||||
redirect("setup/itemcategories");
|
||||
} loadView("setup/additemcategories",$data);
|
||||
break;
|
||||
case 'edit':
|
||||
if(isset($_POST['submit'])){
|
||||
$id=$this->uri->segment(4);
|
||||
$TableData=array(
|
||||
'category_name'=>filter_var($_POST['category_name'],FILTER_SANITIZE_STRING),
|
||||
'category_alias'=>filter_var($_POST['category_alias'],FILTER_SANITIZE_STRING),
|
||||
'category_desc'=>filter_var($_POST['category_desc'],FILTER_SANITIZE_STRING),
|
||||
'created_by'=>'admin',
|
||||
'created_on'=>date('Y-m-d H:i:s'),
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
'status'=>1,
|
||||
'parent_category'=>filter_var($_POST['parent_category'],FILTER_SANITIZE_STRING),
|
||||
);
|
||||
$this->db->where('category_id',$id);
|
||||
$this->db->update('tbl_itemcategories',$TableData);
|
||||
redirect("setup/itemcategories");
|
||||
} loadView("setup/edititemcategories",$data);
|
||||
break;
|
||||
case 'delete':
|
||||
$id=$this->uri->segment(4);
|
||||
$this->db->where('category_id',$id);
|
||||
$this->db->delete('tbl_itemcategories');
|
||||
redirect("setup/itemcategories");
|
||||
break;
|
||||
default:
|
||||
loadView("setup/listitemcategories",$data);
|
||||
}
|
||||
}
|
||||
public function items($alias="",$params=array())
|
||||
|
||||
{
|
||||
|
||||
$data['dataValue']=$this->session;
|
||||
|
||||
$data['pageTitle']="Items";
|
||||
|
||||
switch($alias)
|
||||
{
|
||||
case 'add':
|
||||
if(isset($_POST['submit'])){
|
||||
$TableData=array(
|
||||
'category_id'=>filter_var($_POST['category_id'],FILTER_SANITIZE_STRING),
|
||||
'item_name'=>filter_var($_POST['item_name'],FILTER_SANITIZE_STRING),
|
||||
'item_alias'=>getalias($_POST['item_name'], 'item_alias', 'tbl_items'),
|
||||
'item_desc'=>filter_var($_POST['item_desc'],FILTER_SANITIZE_STRING),
|
||||
'item_units'=>filter_var($_POST['item_units'],FILTER_SANITIZE_STRING),
|
||||
'created_on'=>date('Y-m-d H:i:s'),
|
||||
'created_by'=>'admin',
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
'status'=>1,
|
||||
);
|
||||
$this->db->insert('tbl_items',$TableData);
|
||||
redirect("setup/items");
|
||||
} loadView("setup/additems",$data);
|
||||
break;
|
||||
case 'edit':
|
||||
if(isset($_POST['submit'])){
|
||||
$id=$this->uri->segment(4);
|
||||
$TableData=array(
|
||||
'category_id'=>filter_var($_POST['category_id'],FILTER_SANITIZE_STRING),
|
||||
'item_name'=>filter_var($_POST['item_name'],FILTER_SANITIZE_STRING),
|
||||
'item_alias'=>getalias($_POST['item_name'], 'item_alias', 'tbl_items'),
|
||||
'item_desc'=>filter_var($_POST['item_desc'],FILTER_SANITIZE_STRING),
|
||||
'item_units'=>filter_var($_POST['item_units'],FILTER_SANITIZE_STRING),
|
||||
'created_on'=>date('Y-m-d H:i:s'),
|
||||
'created_by'=>'admin',
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
'status'=>1,
|
||||
);
|
||||
$this->db->where('item_id',$id);
|
||||
$this->db->update('tbl_items',$TableData);
|
||||
redirect("setup/items");
|
||||
} loadView("setup/edititems",$data);
|
||||
break;
|
||||
case 'delete':
|
||||
$id=$this->uri->segment(4);
|
||||
$this->db->where('item_id',$id);
|
||||
$this->db->delete('tbl_items');
|
||||
redirect("setup/items");
|
||||
break;
|
||||
default:
|
||||
if(isset($_GET['item_category']))
|
||||
{
|
||||
if($_GET['item_category']!="")
|
||||
$data['TableData']=$this->MItems->getItemsByAlias($_GET['item_category']);
|
||||
else
|
||||
$data['TableData']=$this->MItems->getItems();
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['TableData']=$this->MItems->getItems();
|
||||
}
|
||||
|
||||
loadView("setup/listitems",$data);
|
||||
}
|
||||
}
|
||||
|
||||
public function vendors($alias="",$params=array())
|
||||
|
||||
{
|
||||
|
||||
$data['dataValue']=$this->session;
|
||||
|
||||
$data['pageTitle']="Vendor";
|
||||
|
||||
switch($alias)
|
||||
{
|
||||
case 'add':
|
||||
if(isset($_POST['submit'])){
|
||||
$TableData=array(
|
||||
'vendor_type'=>filter_var($_POST['vendor_type'],FILTER_SANITIZE_STRING),
|
||||
'vendor_name'=>filter_var($_POST['vendor_name'],FILTER_SANITIZE_STRING),
|
||||
'vendor_country'=>filter_var($_POST['vendor_country'],FILTER_SANITIZE_STRING),
|
||||
'vendor_contact'=>filter_var($_POST['vendor_contact'],FILTER_SANITIZE_STRING),
|
||||
'created_on'=>date('Y-m-d H:i:s'),
|
||||
'created_by'=>'admin',
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
'status'=>1,
|
||||
);
|
||||
$this->db->insert('tbl_vendors',$TableData);
|
||||
redirect("setup/vendors");
|
||||
} loadView("setup/addvendors",$data);
|
||||
break;
|
||||
case 'edit':
|
||||
if(isset($_POST['submit'])){
|
||||
$id=$this->uri->segment(4);
|
||||
$TableData=array(
|
||||
'vendor_type'=>filter_var($_POST['vendor_type'],FILTER_SANITIZE_STRING),
|
||||
'vendor_name'=>filter_var($_POST['vendor_name'],FILTER_SANITIZE_STRING),
|
||||
'vendor_country'=>filter_var($_POST['vendor_country'],FILTER_SANITIZE_STRING),
|
||||
'vendor_contact'=>filter_var($_POST['vendor_contact'],FILTER_SANITIZE_STRING),
|
||||
'created_on'=>date('Y-m-d H:i:s'),
|
||||
'created_by'=>'admin',
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
'status'=>1,
|
||||
);
|
||||
$this->db->where('vendor_id',$id);
|
||||
$this->db->update('tbl_vendors',$TableData);
|
||||
redirect("setup/vendors");
|
||||
} loadView("setup/editvendors",$data);
|
||||
break;
|
||||
case 'delete':
|
||||
$id=$this->uri->segment(4);
|
||||
$this->db->where('vendor_id',$id);
|
||||
$this->db->delete('tbl_vendors');
|
||||
redirect("setup/vendors");
|
||||
break;
|
||||
default:
|
||||
loadView("setup/listvendors",$data);
|
||||
}
|
||||
}
|
||||
public function branches($alias="",$params=array())
|
||||
|
||||
{
|
||||
|
||||
$data['dataValue']=$this->session;
|
||||
|
||||
$data['pageTitle']="Company Branches";
|
||||
|
||||
switch($alias)
|
||||
{
|
||||
case 'add':
|
||||
if(isset($_POST['submit'])){
|
||||
$TableData=array(
|
||||
'branch_name'=>filter_var($_POST['branch_name'],FILTER_SANITIZE_STRING),
|
||||
'branch_alias'=>getalias($_POST['branch_name'], 'branch_alias', 'tbl_branches'),
|
||||
'branch_address'=>filter_var($_POST['branch_address'],FILTER_SANITIZE_STRING),
|
||||
'created_by'=>'admin',
|
||||
'created_on'=>date('Y-m-d H:i:s'),
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
'status'=>1,
|
||||
);
|
||||
$this->db->insert('tbl_branches',$TableData);
|
||||
redirect("setup/branches");
|
||||
} loadView("setup/addbranches",$data);
|
||||
break;
|
||||
case 'edit':
|
||||
if(isset($_POST['submit'])){
|
||||
$id=$this->uri->segment(4);
|
||||
$TableData=array(
|
||||
'branch_name'=>filter_var($_POST['branch_name'],FILTER_SANITIZE_STRING),
|
||||
'branch_alias'=>getalias($_POST['branch_name'], 'branch_alias', 'tbl_branches'),
|
||||
'branch_address'=>filter_var($_POST['branch_address'],FILTER_SANITIZE_STRING),
|
||||
'created_by'=>'admin',
|
||||
'created_on'=>date('Y-m-d H:i:s'),
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
'status'=>1,
|
||||
);
|
||||
$this->db->where('branch_id',$id);
|
||||
$this->db->update('tbl_branches',$TableData);
|
||||
redirect("setup/branches");
|
||||
} loadView("setup/editbranches",$data);
|
||||
break;
|
||||
case 'delete':
|
||||
$id=$this->uri->segment(4);
|
||||
$this->db->where('branch_id',$id);
|
||||
$this->db->delete('tbl_branches');
|
||||
redirect("setup/branches");
|
||||
break;
|
||||
default:
|
||||
loadView("setup/listbranches",$data);
|
||||
}
|
||||
}
|
||||
public function departments($alias="",$params=array())
|
||||
|
||||
{
|
||||
|
||||
$data['dataValue']=$this->session;
|
||||
|
||||
$data['pageTitle']="Work Department";
|
||||
|
||||
switch($alias)
|
||||
{
|
||||
case 'add':
|
||||
if(isset($_POST['submit'])){
|
||||
$TableData=array(
|
||||
'department_name'=>filter_var($_POST['department_name'],FILTER_SANITIZE_STRING),
|
||||
'department_alias'=>getalias($_POST['department_name'], 'department_alias', 'tbl_departments'),
|
||||
'branch_id'=>filter_var($_POST['branch_id'],FILTER_SANITIZE_STRING),
|
||||
'created_on'=>date('Y-m-d H:i:s'),
|
||||
'created_by'=>'admin',
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
'status'=>1,
|
||||
);
|
||||
$this->db->insert('tbl_departments',$TableData);
|
||||
redirect("setup/departments");
|
||||
} loadView("setup/adddepartments",$data);
|
||||
break;
|
||||
case 'edit':
|
||||
if(isset($_POST['submit'])){
|
||||
$id=$this->uri->segment(4);
|
||||
$TableData=array(
|
||||
'department_name'=>filter_var($_POST['department_name'],FILTER_SANITIZE_STRING),
|
||||
'department_alias'=>getalias($_POST['department_name'], 'department_alias', 'tbl_departments'),
|
||||
'branch_id'=>filter_var($_POST['branch_id'],FILTER_SANITIZE_STRING),
|
||||
'created_on'=>date('Y-m-d H:i:s'),
|
||||
'created_by'=>'admin',
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
'status'=>1,
|
||||
);
|
||||
$this->db->where('department_id',$id);
|
||||
$this->db->update('tbl_departments',$TableData);
|
||||
redirect("setup/departments");
|
||||
} loadView("setup/editdepartments",$data);
|
||||
break;
|
||||
case 'delete':
|
||||
$id=$this->uri->segment(4);
|
||||
$this->db->where('department_id',$id);
|
||||
$this->db->delete('tbl_departments');
|
||||
redirect("setup/departments");
|
||||
break;
|
||||
default:
|
||||
loadView("setup/listdepartments",$data);
|
||||
}
|
||||
}
|
||||
public function employeetype($alias="",$params=array())
|
||||
|
||||
{
|
||||
|
||||
$data['dataValue']=$this->session;
|
||||
|
||||
$data['pageTitle']="Employee Types";
|
||||
|
||||
switch($alias)
|
||||
{
|
||||
case 'add':
|
||||
if(isset($_POST['submit'])){
|
||||
$TableData=array(
|
||||
'employeetype_name'=>filter_var($_POST['employeetype_name'],FILTER_SANITIZE_STRING),
|
||||
'employeetype_alias'=>getalias($_POST['employeetype_name'], 'employeetype_alias', 'tbl_employeetype'),
|
||||
'created_by'=>'admin',
|
||||
'created_on'=>date('Y-m-d H:i:s'),
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
'status'=>1,
|
||||
);
|
||||
$this->db->insert('tbl_employeetype',$TableData);
|
||||
redirect("setup/employeetype");
|
||||
} loadView("setup/addemployeetype",$data);
|
||||
break;
|
||||
case 'edit':
|
||||
if(isset($_POST['submit'])){
|
||||
$id=$this->uri->segment(4);
|
||||
$TableData=array(
|
||||
'employeetype_name'=>filter_var($_POST['employeetype_name'],FILTER_SANITIZE_STRING),
|
||||
'employeetype_alias'=>getalias($_POST['employeetype_name'], 'employeetype_alias', 'tbl_employeetype'),
|
||||
'created_by'=>'admin',
|
||||
'created_on'=>date('Y-m-d H:i:s'),
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
'status'=>1,
|
||||
);
|
||||
$this->db->where('employeetype_id',$id);
|
||||
$this->db->update('tbl_employeetype',$TableData);
|
||||
redirect("setup/employeetype");
|
||||
} loadView("setup/editemployeetype",$data);
|
||||
break;
|
||||
case 'delete':
|
||||
$id=$this->uri->segment(4);
|
||||
$this->db->where('employeetype_id',$id);
|
||||
$this->db->delete('tbl_employeetype');
|
||||
redirect("setup/employeetype");
|
||||
break;
|
||||
default:
|
||||
loadView("setup/listemployeetype",$data);
|
||||
}
|
||||
}
|
||||
public function salarytypes($alias="",$params=array())
|
||||
|
||||
{
|
||||
|
||||
$data['dataValue']=$this->session;
|
||||
|
||||
$data['pageTitle']="Salary Types";
|
||||
|
||||
switch($alias)
|
||||
{
|
||||
case 'add':
|
||||
if(isset($_POST['submit'])){
|
||||
$TableData=array(
|
||||
'salarytype_name'=>filter_var($_POST['salarytype_name'],FILTER_SANITIZE_STRING),
|
||||
'salarytype_alias'=>getalias($_POST['salarytype_name'], 'salarytype_alias', 'tbl_salarytypes'),
|
||||
'created_on'=>date('Y-m-d H:i:s'),
|
||||
'created_by'=>'admin',
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
'status'=>1,
|
||||
);
|
||||
$this->db->insert('tbl_salarytypes',$TableData);
|
||||
redirect("setup/salarytypes");
|
||||
} loadView("setup/addsalarytypes",$data);
|
||||
break;
|
||||
case 'edit':
|
||||
if(isset($_POST['submit'])){
|
||||
$id=$this->uri->segment(4);
|
||||
$TableData=array(
|
||||
'salarytype_name'=>filter_var($_POST['salarytype_name'],FILTER_SANITIZE_STRING),
|
||||
'salarytype_alias'=>getalias($_POST['salarytype_name'], 'salarytype_alias', 'tbl_salarytypes'),
|
||||
'created_on'=>date('Y-m-d H:i:s'),
|
||||
'created_by'=>'admin',
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
'status'=>1,
|
||||
);
|
||||
$this->db->where('salarytype_id',$id);
|
||||
$this->db->update('tbl_salarytypes',$TableData);
|
||||
redirect("setup/salarytypes");
|
||||
} loadView("setup/editsalarytypes",$data);
|
||||
break;
|
||||
case 'delete':
|
||||
$id=$this->uri->segment(4);
|
||||
$this->db->where('salarytype_id',$id);
|
||||
$this->db->delete('tbl_salarytypes');
|
||||
redirect("setup/salarytypes");
|
||||
break;
|
||||
default:
|
||||
loadView("setup/listsalarytypes",$data);
|
||||
}
|
||||
}
|
||||
public function workshifts($alias="",$params=array())
|
||||
|
||||
{
|
||||
|
||||
$data['dataValue']=$this->session;
|
||||
|
||||
$data['pageTitle']="Work Shift";
|
||||
|
||||
switch($alias)
|
||||
{
|
||||
case 'add':
|
||||
if(isset($_POST['submit'])){
|
||||
$TableData=array(
|
||||
'workshift_name'=>filter_var($_POST['workshift_name'],FILTER_SANITIZE_STRING),
|
||||
'workshift_alias'=>getalias($_POST['workshift_name'], 'workshift_alias', 'tbl_workshifts'),
|
||||
'workshift_desc'=>filter_var($_POST['workshift_desc'],FILTER_SANITIZE_STRING),
|
||||
'created_by'=>'admin',
|
||||
'created_on'=>date('Y-m-d H:i:s'),
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
'status'=>1,
|
||||
);
|
||||
$this->db->insert('tbl_workshifts',$TableData);
|
||||
redirect("setup/workshifts");
|
||||
} loadView("setup/addworkshifts",$data);
|
||||
break;
|
||||
case 'edit':
|
||||
if(isset($_POST['submit'])){
|
||||
$id=$this->uri->segment(4);
|
||||
$TableData=array(
|
||||
'workshift_name'=>filter_var($_POST['workshift_name'],FILTER_SANITIZE_STRING),
|
||||
'workshift_alias'=>getalias($_POST['workshift_name'], 'workshift_alias', 'tbl_workshifts'),
|
||||
'workshift_desc'=>filter_var($_POST['workshift_desc'],FILTER_SANITIZE_STRING),
|
||||
'created_by'=>'admin',
|
||||
'created_on'=>date('Y-m-d H:i:s'),
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
'status'=>1,
|
||||
);
|
||||
$this->db->where('workshift_id',$id);
|
||||
$this->db->update('tbl_workshifts',$TableData);
|
||||
redirect("setup/workshifts");
|
||||
} loadView("setup/editworkshifts",$data);
|
||||
break;
|
||||
case 'delete':
|
||||
$id=$this->uri->segment(4);
|
||||
$this->db->where('workshift_id',$id);
|
||||
$this->db->delete('tbl_workshifts');
|
||||
redirect("setup/workshifts");
|
||||
break;
|
||||
default:
|
||||
loadView("setup/listworkshifts",$data);
|
||||
}
|
||||
}
|
||||
public function propertytype($alias="",$params=array())
|
||||
{
|
||||
$data['dataValue']=$this->session;
|
||||
$data['pageTitle']="Property Types";
|
||||
switch($alias)
|
||||
{
|
||||
case 'add':
|
||||
if(isset($_POST['submit'])){
|
||||
$TableData=array(
|
||||
'propertytype_name'=>filter_var($_POST['propertytype_name'],FILTER_SANITIZE_STRING),
|
||||
'propertytype_alias'=>getalias($_POST['propertytype_name'], 'propertytype_alias', 'tbl_propertytypes'),
|
||||
'propertytype_desc'=>filter_var($_POST['propertytype_desc'],FILTER_SANITIZE_STRING),
|
||||
'created_on'=>date('Y-m-d H:i:s'),
|
||||
'created_by'=>'admin',
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
'status'=>1,
|
||||
);
|
||||
$this->db->insert('tbl_propertytypes',$TableData);
|
||||
redirect('setup/propertytype');
|
||||
}
|
||||
loadView('setup/addpropertytypes',$data);
|
||||
break;
|
||||
case 'edit':
|
||||
if(isset($_POST['submit'])){
|
||||
$id=$params[0];
|
||||
$TableData=array(
|
||||
'propertytype_name'=>filter_var($_POST['propertytype_name'],FILTER_SANITIZE_STRING),
|
||||
'propertytype_alias'=>getalias($_POST['propertytype_name'], 'propertytype_alias', 'tbl_propertytypes'),
|
||||
'propertytype_desc'=>filter_var($_POST['propertytype_desc'],FILTER_SANITIZE_STRING),
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
);
|
||||
$this->db->where('propertytype_id',$id);
|
||||
$this->db->update('tbl_propertytypes',$TableData);
|
||||
redirect('setup/propertytype');
|
||||
}
|
||||
loadView('setup/editpropertytypes',$data);
|
||||
break;
|
||||
case 'delete':
|
||||
$id=$this->uri->segment(4);
|
||||
$this->db->where('propertytype_id',$id);
|
||||
$this->db->delete('tbl_propertytypes');
|
||||
redirect('setup/propertytype');
|
||||
break;
|
||||
default:
|
||||
loadView('setup/propertytypes',$data);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
public function rentingproperty($alias="",$params=array())
|
||||
|
||||
{
|
||||
|
||||
$data['dataValue']=$this->session;
|
||||
|
||||
$data['pageTitle']="Rentable Properties";
|
||||
|
||||
switch($alias)
|
||||
{
|
||||
case 'add':
|
||||
if(isset($_POST['submit'])){
|
||||
$TableData=array(
|
||||
'propertyType_id'=>filter_var($_POST['propertyType_id'],FILTER_SANITIZE_STRING),
|
||||
'property_name'=>filter_var($_POST['property_name'],FILTER_SANITIZE_STRING),
|
||||
'property_desc'=>filter_var($_POST['property_desc'],FILTER_SANITIZE_STRING),
|
||||
'created_on'=>date('Y-m-d H:i:s'),
|
||||
'created_by'=>'admin',
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
'status'=>1,
|
||||
);
|
||||
$this->db->insert('tbl_properties',$TableData);
|
||||
redirect("setup/rentingproperty");
|
||||
} loadView("setup/addproperties",$data);
|
||||
break;
|
||||
case 'edit':
|
||||
if(isset($_POST['submit'])){
|
||||
$id=$this->uri->segment(4);
|
||||
$TableData=array(
|
||||
'propertyType_id'=>filter_var($_POST['propertyType_id'],FILTER_SANITIZE_STRING),
|
||||
'property_name'=>filter_var($_POST['property_name'],FILTER_SANITIZE_STRING),
|
||||
'property_desc'=>filter_var($_POST['property_desc'],FILTER_SANITIZE_STRING),
|
||||
'created_on'=>date('Y-m-d H:i:s'),
|
||||
'created_by'=>'admin',
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
'status'=>1,
|
||||
);
|
||||
$this->db->where('property_id',$id);
|
||||
$this->db->update('tbl_properties',$TableData);
|
||||
redirect("setup/rentingproperty");
|
||||
} loadView("setup/editproperties",$data);
|
||||
break;
|
||||
case 'delete':
|
||||
$id=$this->uri->segment(4);
|
||||
$this->db->where('property_id',$id);
|
||||
$this->db->delete('tbl_properties');
|
||||
redirect("setup/rentingproperty");
|
||||
break;
|
||||
default:
|
||||
loadView("setup/listproperties",$data);
|
||||
}
|
||||
}
|
||||
public function submeters($alias="",$params=array())
|
||||
|
||||
{
|
||||
|
||||
$data['dataValue']=$this->session;
|
||||
|
||||
$data['pageTitle']="Setup Sub-Meters";
|
||||
|
||||
switch($alias)
|
||||
{
|
||||
case 'add':
|
||||
if(isset($_POST['submit'])){
|
||||
$TableData=array(
|
||||
'submeter_name'=>filter_var($_POST['submeter_name'],FILTER_SANITIZE_STRING),
|
||||
'property_id'=>filter_var($_POST['property_id'],FILTER_SANITIZE_STRING),
|
||||
'installed_date'=>filter_var($_POST['installed_date'],FILTER_SANITIZE_STRING),
|
||||
'installed_location'=>filter_var($_POST['installed_location'],FILTER_SANITIZE_STRING),
|
||||
'initial_reading'=>filter_var($_POST['initial_reading'],FILTER_SANITIZE_STRING),
|
||||
'identification_mark'=>filter_var($_POST['identification_mark'],FILTER_SANITIZE_STRING),
|
||||
'created_on'=>date('Y-m-d H:i:s'),
|
||||
'created_by'=>'admin',
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
'status'=>1,
|
||||
);
|
||||
$this->db->insert('tbl_submeters',$TableData);
|
||||
redirect("setup/submeters");
|
||||
} loadView("setup/addsubmeters",$data);
|
||||
break;
|
||||
case 'edit':
|
||||
if(isset($_POST['submit'])){
|
||||
$id=$this->uri->segment(4);
|
||||
$TableData=array(
|
||||
'submeter_name'=>filter_var($_POST['submeter_name'],FILTER_SANITIZE_STRING),
|
||||
'property_id'=>filter_var($_POST['property_id'],FILTER_SANITIZE_STRING),
|
||||
'installed_date'=>filter_var($_POST['installed_date'],FILTER_SANITIZE_STRING),
|
||||
'installed_location'=>filter_var($_POST['installed_location'],FILTER_SANITIZE_STRING),
|
||||
'initial_reading'=>filter_var($_POST['initial_reading'],FILTER_SANITIZE_STRING),
|
||||
'identification_mark'=>filter_var($_POST['identification_mark'],FILTER_SANITIZE_STRING),
|
||||
'created_on'=>date('Y-m-d H:i:s'),
|
||||
'created_by'=>'admin',
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
'status'=>1,
|
||||
);
|
||||
$this->db->where('submeter_id',$id);
|
||||
$this->db->update('tbl_submeters',$TableData);
|
||||
redirect("setup/submeters");
|
||||
} loadView("setup/editsubmeters",$data);
|
||||
break;
|
||||
case 'delete':
|
||||
$id=$this->uri->segment(4);
|
||||
$this->db->where('submeter_id',$id);
|
||||
$this->db->delete('tbl_submeters');
|
||||
redirect("setup/submeters");
|
||||
break;
|
||||
default:
|
||||
loadView("setup/listsubmeters",$data);
|
||||
}
|
||||
}
|
||||
public function utilities($alias="",$params=array())
|
||||
|
||||
{
|
||||
|
||||
$data['dataValue']=$this->session;
|
||||
|
||||
$data['pageTitle']="Utilities for Renting";
|
||||
|
||||
switch($alias)
|
||||
{
|
||||
case 'add':
|
||||
if(isset($_POST['submit'])){
|
||||
$TableData=array(
|
||||
'utility_name'=>filter_var($_POST['utility_name'],FILTER_SANITIZE_STRING),
|
||||
'utility_desc'=>filter_var($_POST['utility_desc'],FILTER_SANITIZE_STRING),
|
||||
'created_on'=>date('Y-m-d H:i:s'),
|
||||
'created_by'=>'admin',
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
'status'=>1,
|
||||
);
|
||||
$this->db->insert('tbl_utilities',$TableData);
|
||||
redirect("setup/utilities");
|
||||
} loadView("setup/addutilities",$data);
|
||||
break;
|
||||
case 'edit':
|
||||
if(isset($_POST['submit'])){
|
||||
$id=$this->uri->segment(4);
|
||||
$TableData=array(
|
||||
'utility_name'=>filter_var($_POST['utility_name'],FILTER_SANITIZE_STRING),
|
||||
'utility_desc'=>filter_var($_POST['utility_desc'],FILTER_SANITIZE_STRING),
|
||||
'created_on'=>date('Y-m-d H:i:s'),
|
||||
'created_by'=>'admin',
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
'status'=>1,
|
||||
);
|
||||
$this->db->where('utility_id',$id);
|
||||
$this->db->update('tbl_utilities',$TableData);
|
||||
redirect("setup/utilities");
|
||||
} loadView("setup/editutilities",$data);
|
||||
break;
|
||||
case 'delete':
|
||||
$id=$this->uri->segment(4);
|
||||
$this->db->where('utility_id',$id);
|
||||
$this->db->delete('tbl_utilities');
|
||||
redirect("setup/utilities");
|
||||
break;
|
||||
default:
|
||||
loadView("setup/listutilities",$data);
|
||||
}
|
||||
}
|
||||
public function utilityrates($alias="",$params=array())
|
||||
|
||||
{
|
||||
|
||||
$data['dataValue']=$this->session;
|
||||
|
||||
$data['pageTitle']="Utility Rates";
|
||||
|
||||
switch($alias)
|
||||
{
|
||||
case 'add':
|
||||
if(isset($_POST['submit'])){
|
||||
$TableData=array(
|
||||
'utility_id'=>filter_var($_POST['utility_id'],FILTER_SANITIZE_STRING),
|
||||
'property_id'=>filter_var($_POST['property_id'],FILTER_SANITIZE_STRING),
|
||||
'rentalperiod_id'=>filter_var($_POST['rentalperiod_id'],FILTER_SANITIZE_STRING),
|
||||
'utility_rate'=>filter_var($_POST['utility_rate'],FILTER_SANITIZE_STRING),
|
||||
'created_on'=>date('Y-m-d H:i:s'),
|
||||
'created_by'=>'admin',
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
'status'=>1,
|
||||
);
|
||||
$this->db->insert('tbl_utilityrates',$TableData);
|
||||
redirect("setup/utilityrates");
|
||||
} loadView("setup/addutilityrates",$data);
|
||||
break;
|
||||
case 'edit':
|
||||
if(isset($_POST['submit'])){
|
||||
$id=$this->uri->segment(4);
|
||||
$TableData=array(
|
||||
'utility_id'=>filter_var($_POST['utility_id'],FILTER_SANITIZE_STRING),
|
||||
'property_id'=>filter_var($_POST['property_id'],FILTER_SANITIZE_STRING),
|
||||
'rentalperiod_id'=>filter_var($_POST['rentalperiod_id'],FILTER_SANITIZE_STRING),
|
||||
'utility_rate'=>filter_var($_POST['utility_rate'],FILTER_SANITIZE_STRING),
|
||||
'created_on'=>date('Y-m-d H:i:s'),
|
||||
'created_by'=>'admin',
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
'status'=>1,
|
||||
);
|
||||
$this->db->where('utilityrate_id',$id);
|
||||
$this->db->update('tbl_utilityrates',$TableData);
|
||||
redirect("setup/utilityrates");
|
||||
} loadView("setup/editutilityrates",$data);
|
||||
break;
|
||||
case 'delete':
|
||||
$id=$this->uri->segment(4);
|
||||
$this->db->where('utilityrate_id',$id);
|
||||
$this->db->delete('tbl_utilityrates');
|
||||
redirect("setup/utilityrates");
|
||||
break;
|
||||
default:
|
||||
loadView("setup/listutilityrates",$data);
|
||||
}
|
||||
}
|
||||
public function rentalperiods($alias="",$params=array())
|
||||
|
||||
{
|
||||
|
||||
$data['dataValue']=$this->session;
|
||||
|
||||
$data['pageTitle']="Rental Periods";
|
||||
|
||||
switch($alias)
|
||||
{
|
||||
case 'add':
|
||||
if(isset($_POST['submit'])){
|
||||
$TableData=array(
|
||||
'rentalperiod_name'=>filter_var($_POST['rentalperiod_name'],FILTER_SANITIZE_STRING),
|
||||
'rentalperiod_alias'=>getalias($_POST['rentalperiod_name'], 'rentalperiod_alias', 'tbl_rentalperiods'),
|
||||
'rentalperiod_desc'=>filter_var($_POST['rentalperiod_desc'],FILTER_SANITIZE_STRING),
|
||||
'rentalperiod_duration'=>filter_var($_POST['rentalperiod_duration'],FILTER_SANITIZE_STRING),
|
||||
'created_on'=>date('Y-m-d H:i:s'),
|
||||
'created_by'=>'admin',
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
'status'=>1,
|
||||
);
|
||||
$this->db->insert('tbl_rentalperiods',$TableData);
|
||||
redirect("setup/rentalperiods");
|
||||
} loadView("setup/addrentalperiods",$data);
|
||||
break;
|
||||
case 'edit':
|
||||
if(isset($_POST['submit'])){
|
||||
$id=$this->uri->segment(4);
|
||||
$TableData=array(
|
||||
'rentalperiod_name'=>filter_var($_POST['rentalperiod_name'],FILTER_SANITIZE_STRING),
|
||||
'rentalperiod_alias'=>getalias($_POST['rentalperiod_name'], 'rentalperiod_alias', 'tbl_rentalperiods'),
|
||||
'rentalperiod_desc'=>filter_var($_POST['rentalperiod_desc'],FILTER_SANITIZE_STRING),
|
||||
'rentalperiod_duration'=>filter_var($_POST['rentalperiod_duration'],FILTER_SANITIZE_STRING),
|
||||
'created_on'=>date('Y-m-d H:i:s'),
|
||||
'created_by'=>'admin',
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
'status'=>1,
|
||||
);
|
||||
$this->db->where('rentalperiod_id',$id);
|
||||
$this->db->update('tbl_rentalperiods',$TableData);
|
||||
redirect("setup/rentalperiods");
|
||||
} loadView("setup/editrentalperiods",$data);
|
||||
break;
|
||||
case 'delete':
|
||||
$id=$this->uri->segment(4);
|
||||
$this->db->where('rentalperiod_id',$id);
|
||||
$this->db->delete('tbl_rentalperiods');
|
||||
redirect("setup/rentalperiods");
|
||||
break;
|
||||
default:
|
||||
loadView("setup/listrentalperiods",$data);
|
||||
}
|
||||
}
|
||||
public function tables()
|
||||
{
|
||||
$data['dataValue']=$this->session;
|
||||
loadView('setup/tables',$data);
|
||||
}
|
||||
}
|
16
account/application/controllers/Sync.php
Normal file
16
account/application/controllers/Sync.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Sync extends CI_Controller {
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
public function clients()
|
||||
{
|
||||
header('Content-Type: application/json');
|
||||
print_r($_POST);
|
||||
|
||||
}
|
||||
|
||||
}
|
14
account/application/controllers/Togglelanguage.php
Normal file
14
account/application/controllers/Togglelanguage.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class Togglelanguage extends CI_Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
if ($this->session->userdata("language") == "np") :
|
||||
$this->session->set_userdata("language","eng");
|
||||
else : $this->session->set_userdata("language","np");
|
||||
endif;
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
}
|
63
account/application/controllers/Users.php
Normal file
63
account/application/controllers/Users.php
Normal file
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
class Users extends CI_Controller{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
checkLogin();
|
||||
isViewPermitted();
|
||||
$this->load->model('MUsers');
|
||||
}
|
||||
public function index(){
|
||||
$data['Users']=$this->MUsers->getUsers();
|
||||
loadView('users/view',$data);
|
||||
}
|
||||
|
||||
public function add(){
|
||||
$privilege=$_POST;
|
||||
array_splice($privilege, 0, 3);
|
||||
if (isset($_POST['user_name'])){
|
||||
$inputArray=array(
|
||||
'user_name'=>$_POST['user_name'],
|
||||
'user_password'=>$_POST['user_password'],
|
||||
'user_email'=>$_POST['user_email'],
|
||||
'user_privilege'=>json_encode($privilege),
|
||||
'status'=>2
|
||||
);
|
||||
$this->MUsers->addUser($inputArray);
|
||||
redirect('users');
|
||||
}
|
||||
$data['Users']=$this->MUsers->getUsers();
|
||||
//pre($data);die;
|
||||
loadView('users/add',$data);
|
||||
}
|
||||
|
||||
function edit($id){
|
||||
$privilege=$_POST;
|
||||
array_splice($privilege, 0, 3);
|
||||
if (isset($_POST['user_name'])){
|
||||
$inputArray=array(
|
||||
'user_name'=>$_POST['user_name'],
|
||||
'user_password'=>$_POST['user_password'],
|
||||
'user_email'=>$_POST['user_email'],
|
||||
'user_privilege'=>json_encode($privilege),
|
||||
);
|
||||
$this->MUsers->UpdateUser($inputArray,$id);
|
||||
redirect('users');
|
||||
}
|
||||
$data['User']=$this->MUsers->getUsers();
|
||||
$data['Users']=$this->MUsers->getUserById($id);
|
||||
//pre($data);die;
|
||||
loadView('users/edit',$data);
|
||||
}
|
||||
|
||||
function delete($id){
|
||||
$this->MUsers->deleteuser($id);
|
||||
redirect('users');
|
||||
$data['Users']=$this->MUsers->getUserById($id);
|
||||
loadView('users/delete',$data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
201
account/application/controllers/Welcome.php
Normal file
201
account/application/controllers/Welcome.php
Normal file
@ -0,0 +1,201 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class Welcome extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
checkLogin();
|
||||
}
|
||||
public function index()
|
||||
{
|
||||
$data['dataValue'] = $this->session;
|
||||
$this->initDB();
|
||||
loadView('index', $data);
|
||||
// $this->myaccounts->backupDatabase();
|
||||
}
|
||||
public function dbbackup()
|
||||
{
|
||||
$this->myaccounts->backupDatabase();
|
||||
}
|
||||
public function initDB()
|
||||
{
|
||||
|
||||
$this->db->query("CREATE TABLE IF NOT EXISTS `tbl_units` (
|
||||
`unit_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`title` varchar(255) DEFAULT NULL,
|
||||
`alias` varchar(255) DEFAULT NULL,
|
||||
`description` text DEFAULT NULL,
|
||||
`display_order` int(11) DEFAULT NULL,
|
||||
`status` int(11) DEFAULT NULL,
|
||||
`remarks` text DEFAULT NULL,
|
||||
`created_on` DATE NOT NULL,
|
||||
`created_by` VARCHAR(50) NOT NULL,
|
||||
PRIMARY KEY (`unit_id`)
|
||||
)");
|
||||
$this->db->query("CREATE TABLE IF NOT EXISTS `tbl_paymentmodes` (
|
||||
`paymentmode_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`title` varchar(255) DEFAULT NULL,
|
||||
`alias` varchar(255) DEFAULT NULL,
|
||||
`description` text DEFAULT NULL,
|
||||
`display_order` int(11) DEFAULT NULL,
|
||||
`status` int(11) DEFAULT NULL,
|
||||
`remarks` text DEFAULT NULL,
|
||||
`created_on` DATE NOT NULL,
|
||||
`created_by` VARCHAR(50) NOT NULL,
|
||||
PRIMARY KEY (`paymentmode_id`)
|
||||
)");
|
||||
$this->db->query("CREATE TABLE IF NOT EXISTS `tbl_itemcategories` (
|
||||
`itemcategory_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`units_id` int(11) NOT NULL,
|
||||
`title` varchar(255) DEFAULT NULL,
|
||||
`alias` varchar(255) DEFAULT NULL,
|
||||
`description` text DEFAULT NULL,
|
||||
`display_order` int(11) DEFAULT NULL,
|
||||
`status` int(11) DEFAULT NULL,
|
||||
`remarks` text DEFAULT NULL,
|
||||
`created_on` DATE NOT NULL,
|
||||
`created_by` VARCHAR(50) NOT NULL,
|
||||
PRIMARY KEY (`itemcategory_id`)
|
||||
)");
|
||||
$this->db->query("CREATE TABLE IF NOT EXISTS `tbl_items` (
|
||||
`item_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`itemcategories_id` int(11) DEFAULT NULL,
|
||||
`item_code` varchar(255) DEFAULT NULL,
|
||||
`title` varchar(255) DEFAULT NULL,
|
||||
`alias` varchar(255) DEFAULT NULL,
|
||||
`description` text DEFAULT NULL,
|
||||
`display_order` int(11) DEFAULT NULL,
|
||||
`status` int(11) DEFAULT NULL,
|
||||
`remarks` text DEFAULT NULL,
|
||||
`created_on` DATE NOT NULL,
|
||||
`created_by` VARCHAR(50) NOT NULL,
|
||||
PRIMARY KEY (`item_id`)
|
||||
)");
|
||||
$this->db->query("CREATE TABLE IF NOT EXISTS `tbl_stocklocations` (
|
||||
`stocklocation_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`title` varchar(255) DEFAULT NULL,
|
||||
`alias` varchar(255) DEFAULT NULL,
|
||||
`description` text DEFAULT NULL,
|
||||
`display_order` int(11) DEFAULT NULL,
|
||||
`status` int(11) DEFAULT NULL,
|
||||
`remarks` text DEFAULT NULL,
|
||||
`created_on` DATE NOT NULL,
|
||||
`created_by` VARCHAR(50) NOT NULL,
|
||||
PRIMARY KEY (`stocklocation_id`)
|
||||
)");
|
||||
$this->db->query("CREATE TABLE IF NOT EXISTS `tbl_stocks` (
|
||||
`stock_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`stocklocations_id` int(11) DEFAULT NULL,
|
||||
`ref_id` int(11) DEFAULT NULL,
|
||||
`title` varchar(255) DEFAULT NULL,
|
||||
`items_id` int(11) DEFAULT NULL,
|
||||
`qty` int(11) DEFAULT NULL,
|
||||
`price` double(10,2) DEFAULT NULL,
|
||||
`display_order` int(11) DEFAULT NULL,
|
||||
`status` int(11) DEFAULT NULL,
|
||||
`remarks` text DEFAULT NULL,
|
||||
`created_on` DATE NOT NULL,
|
||||
`created_by` VARCHAR(50) NOT NULL,
|
||||
PRIMARY KEY (`stock_id`)
|
||||
)");
|
||||
|
||||
$this->db->query("CREATE TABLE IF NOT EXISTS `tbl_purchases` (
|
||||
`purchase_id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`purchase_ref` VARCHAR(50) NULL,
|
||||
`transaction_type` VARCHAR(50) NULL,
|
||||
`accounts_id` INT(11) NOT NULL COMMENT 'Vendors Account', -- Adding comment here,
|
||||
`purchase_date` DATE NOT NULL,
|
||||
`created_on` DATE NOT NULL,
|
||||
`created_by` VARCHAR(50) NOT NULL,
|
||||
`remarks` TEXT NOT NULL,
|
||||
`status` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`purchase_id`)
|
||||
)");
|
||||
$this->db->query("CREATE TABLE IF NOT EXISTS `tbl_purchasedetails` (
|
||||
`purchasedetails_id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`purchases_id` INT(11) NOT NULL,
|
||||
`items_id` VARCHAR(50) NOT NULL,
|
||||
`qty` DOUBLE(10,2) NOT NULL,
|
||||
`rate` DOUBLE(10,2) NOT NULL,
|
||||
`created_on` DATE NOT NULL,
|
||||
`created_by` VARCHAR(50) NOT NULL,
|
||||
`remarks` TEXT NOT NULL,
|
||||
`status` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`purchasedetails_id`)
|
||||
)");
|
||||
$this->db->query("CREATE TABLE IF NOT EXISTS `tbl_sales` (
|
||||
`sales_id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`transaction_type` VARCHAR(50) NOT NULL,
|
||||
`accounts_id` INT(11) NOT NULL COMMENT 'Customer Accounts - Sundry Debitors', -- Adding comment here,
|
||||
`sales_date` DATE NOT NULL,
|
||||
`created_on` DATE NOT NULL,
|
||||
`created_by` VARCHAR(50) NOT NULL,
|
||||
`remarks` TEXT NOT NULL,
|
||||
`status` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`sales_id`)
|
||||
)");
|
||||
$this->db->query("CREATE TABLE IF NOT EXISTS `tbl_salesdetails` (
|
||||
`salesdetails_id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`sales_id` INT(11) NOT NULL,
|
||||
`items_id` VARCHAR(50) NOT NULL,
|
||||
`qty` DOUBLE(10,2) NOT NULL,
|
||||
`rate` DOUBLE(10,2) NOT NULL,
|
||||
`created_on` DATE NOT NULL,
|
||||
`created_by` VARCHAR(50) NOT NULL,
|
||||
`remarks` TEXT NOT NULL,
|
||||
`status` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`salesdetails_id`)
|
||||
)");
|
||||
$this->db->query("CREATE TABLE IF NOT EXISTS `tbl_transactions` (
|
||||
`transaction_id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`transaction_type` VARCHAR(50) NOT NULL,
|
||||
`stocks_id` INT(11) NOT NULL,
|
||||
`qty` INT(11) NOT NULL,
|
||||
`transaction_date` DATE NOT NULL,
|
||||
`created_on` DATE NOT NULL,
|
||||
`created_by` VARCHAR(50) NOT NULL,
|
||||
`remarks` TEXT NOT NULL,
|
||||
PRIMARY KEY (`transaction_id`)
|
||||
)");
|
||||
if (!$this->db->get("tbl_stocklocations")->num_rows() > 0) {
|
||||
$this->db->query("truncate table tbl_stocklocations");
|
||||
$this->db->query("insert into tbl_stocklocations set title='Main Stock', status=1");
|
||||
}
|
||||
if (!$this->db->get("tbl_units")->num_rows() > 0) {
|
||||
$this->db->query("truncate table tbl_units");
|
||||
$this->db->query("insert into tbl_units set title='Pcs', status=1");
|
||||
}
|
||||
if (!$this->db->get("tbl_paymentmodes")->num_rows() > 0) {
|
||||
$this->db->query("truncate table tbl_paymentmodes");
|
||||
$this->db->query("insert into tbl_paymentmodes set title='Cash', status=1");
|
||||
}
|
||||
|
||||
$query = $this->db->query("SHOW COLUMNS FROM tbl_purchases LIKE 'purchase_ref'");
|
||||
|
||||
// If the column doesn't exist, alter the table to add it
|
||||
if ($query->num_rows() == 0) {
|
||||
$this->db->query("ALTER TABLE tbl_purchases ADD COLUMN purchase_ref VARCHAR(50)");
|
||||
}
|
||||
$query = $this->db->query("SHOW COLUMNS FROM tbl_branches LIKE 'vat'");
|
||||
|
||||
// If the column doesn't exist, alter the table to add it
|
||||
if ($query->num_rows() == 0) {
|
||||
$this->db->query("ALTER TABLE tbl_branches ADD COLUMN vat int(11)");
|
||||
}
|
||||
$query = $this->db->query("SHOW COLUMNS FROM tbl_branches LIKE 'pan'");
|
||||
|
||||
// If the column doesn't exist, alter the table to add it
|
||||
if ($query->num_rows() == 0) {
|
||||
$this->db->query("ALTER TABLE tbl_branches ADD COLUMN pan VARCHAR(20)");
|
||||
}
|
||||
$query = $this->db->query("SHOW COLUMNS FROM tbl_items LIKE 'units_id'");
|
||||
|
||||
// If the column doesn't exist, alter the table to add it
|
||||
if ($query->num_rows() == 0) {
|
||||
$this->db->query("ALTER TABLE tbl_items ADD COLUMN units_id INT(11)");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
253
account/application/controllers/_Accounts.php
Normal file
253
account/application/controllers/_Accounts.php
Normal file
@ -0,0 +1,253 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
class Accounts extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->helper("accounts");
|
||||
checkLogin();
|
||||
}
|
||||
public function _remap($alias = "", $params = array())
|
||||
{
|
||||
|
||||
$data['dataValue'] = $this->session;
|
||||
|
||||
$data['pageTitle'] = "Account Head";
|
||||
switch ($alias) {
|
||||
case 'add':
|
||||
if (isset($_POST['submit'])) {
|
||||
$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);
|
||||
redirect("accounts");
|
||||
}
|
||||
loadView("accounts/add", $data);
|
||||
break;
|
||||
case 'edit':
|
||||
if (isset($_POST['submit'])) {
|
||||
$id = $this->uri->segment(3);
|
||||
$TableData = array(
|
||||
'accategory_id' => filter_var($_POST['accategory_id']),
|
||||
//'account_code' => 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->where('account_id', $id);
|
||||
$this->db->update('tbl_accounts', $TableData);
|
||||
redirect("accounts");
|
||||
}
|
||||
loadView("accounts/edit", $data);
|
||||
break;
|
||||
case 'delete':
|
||||
$id = $this->uri->segment(3);
|
||||
$this->db->set('status', "-1");
|
||||
$this->db->set('remarks', "Deleted on" . date("Y-m-d H:i:s") . " by " . $this->session->userdata("loggedUser"));
|
||||
$this->db->where('account_id', $id);
|
||||
$this->db->update('tbl_accounts');
|
||||
redirect("accounts");
|
||||
break;
|
||||
case 'getdetails':
|
||||
$id = $this->uri->segment(3);
|
||||
$this->db->where("account_id", $id);
|
||||
$data['Account'] = $this->db->get("tbl_accounts")->row();
|
||||
$this->load->view("accounts/details", $data);
|
||||
break;
|
||||
case 'renumerate':
|
||||
$Accounts = $this->db->where("status=1")->get("tbl_accounts")->result();
|
||||
foreach ($Accounts as $Account) :
|
||||
$AccountCode = generateAccountCode($Account->accategory_id);
|
||||
$this->db->where("account_id", $Account->account_id)->set("account_code", $AccountCode)->update("tbl_accounts");
|
||||
endforeach;
|
||||
redirect("accounts");
|
||||
break;
|
||||
case 'listvouchers':
|
||||
$data['pageTitle'] = "Journal Voucher";
|
||||
loadView("accounts/listvouchers", $data);
|
||||
break;
|
||||
case 'addvoucher':
|
||||
$data['pageTitle'] = "Journal Voucher";
|
||||
if (isset($_POST['submit']) && !isVoucherExists($_POST['voucher_no'])) {
|
||||
$TableData = array(
|
||||
'voucher_no' => filter_var($_POST['voucher_no']),
|
||||
//'voucher_ref' => filter_var($_POST['voucher_ref']), // If the voucher is raised against other transactions
|
||||
'voucher_date' => NepaliToEnglishDate(filter_var($_POST['voucher_date'])),
|
||||
'voucher_state' => 'Entered', // Different stages of voucher Entered/Reversed/Cancel/Deleted/Locked/Draft etc.
|
||||
'voucher_type' => 'Journal', //Different types of Vouchers like Cash/Bank/Payment/Receipt/advance etc.
|
||||
'fiscalyear_id' => $this->session->userdata("FiscalYearID"),
|
||||
'branch_id' => $this->session->userdata("BranchID"),
|
||||
'created_by' => $this->session->userdata("loggedUser"),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
'status' => 1
|
||||
);
|
||||
$this->db->insert('tbl_vouchers', $TableData);
|
||||
$voucher_id = $this->db->insert_id();
|
||||
$account_ids = $_POST['account_ids'];
|
||||
$narrations = $_POST['narration'];
|
||||
$debits = $_POST['debit'];
|
||||
$credits = $_POST['credit'];
|
||||
$entry_no = 0;
|
||||
for ($entry_no = 0; $entry_no < sizeof($account_ids); $entry_no++) {
|
||||
$TableData = array();
|
||||
|
||||
$TableData = array(
|
||||
'voucher_id' => $voucher_id,
|
||||
'entry_no' => $entry_no,
|
||||
'transaction_date' => NepaliToEnglishDate(filter_var($_POST['voucher_date'])),
|
||||
'account_id' => $account_ids[$entry_no],
|
||||
'narration' => $narrations[$entry_no],
|
||||
'dr' => $debits[$entry_no],
|
||||
'cr' => $credits[$entry_no],
|
||||
// 'cheque' => filter_var($_POST['cheque']),
|
||||
// 'cheque_details' => filter_var($_POST['cheque_details']),
|
||||
'currency' => 'NPR',
|
||||
// 'exrate' => filter_var($_POST['exrate']),
|
||||
// 'fcdr' => filter_var($_POST['fcdr']),
|
||||
// 'fccr' => filter_var($_POST['fccr']),
|
||||
'branch_id' => $this->session->userdata("BranchID"),
|
||||
'fiscalyear_id' => $this->session->userdata("FiscalYearID"),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => $this->session->userdata("loggedUser"),
|
||||
// 'remarks' => filter_var($_POST['remarks']),
|
||||
'status' => 1
|
||||
);
|
||||
$this->db->insert('tbl_voucherdetails', $TableData);
|
||||
}
|
||||
redirect("accounts/listvouchers");
|
||||
break;
|
||||
}
|
||||
|
||||
loadView("accounts/addvoucher", $data);
|
||||
break;
|
||||
case 'voucherdetails':
|
||||
$voucher_id = $this->uri->segment(3);
|
||||
$Voucher = $this->db->where("voucher_id", $voucher_id)->get("tbl_vouchers")->row();
|
||||
$Voucher->Details = $this->db->where("voucher_id", $voucher_id)->get("tbl_voucherdetails")->result();
|
||||
$data['Voucher'] = $Voucher;
|
||||
$this->load->view("accounts/voucherdetails", $data);
|
||||
break;
|
||||
case 'show_voucher':
|
||||
$data['pageTitle']="Voucher Entries";
|
||||
$voucher_id = $this->uri->segment(3);
|
||||
$Voucher = $this->db->where("voucher_id", $voucher_id)->get("tbl_vouchers")->row();
|
||||
$Voucher->Details = $this->db->where("voucher_id", $voucher_id)->get("tbl_voucherdetails")->result();
|
||||
$data['Voucher'] = $Voucher;
|
||||
loadview("accounts/show_voucher", $data);
|
||||
break;
|
||||
case 'reversal':
|
||||
$voucher_id = $this->uri->segment(3);
|
||||
if (isVoucherReverseable($voucher_id)) :
|
||||
$VoucherDetails = $this->db->where("voucher_id", $voucher_id)->get("tbl_voucherdetails")->result();
|
||||
$entry_no = 0;
|
||||
foreach ($VoucherDetails as $VoucherDetail) :
|
||||
$TableData = array(
|
||||
'voucher_id' => $voucher_id,
|
||||
'entry_no' => $entry_no,
|
||||
'transaction_date' => $VoucherDetail->transaction_date,
|
||||
'account_id' => $VoucherDetail->account_id,
|
||||
'narration' => "Reversal of Voucher #" . getFieldfromValue("tbl_vouchers", "voucher_no", "voucher_id", $VoucherDetail->voucher_id),
|
||||
'dr' => $VoucherDetail->cr,
|
||||
'cr' => $VoucherDetail->dr,
|
||||
// 'cheque' => filter_var($_POST['cheque']),
|
||||
// 'cheque_details' => filter_var($_POST['cheque_details']),
|
||||
'currency' => 'NPR',
|
||||
// 'exrate' => filter_var($_POST['exrate']),
|
||||
// 'fcdr' => filter_var($_POST['fcdr']),
|
||||
// 'fccr' => filter_var($_POST['fccr']),
|
||||
'branch_id' => $this->session->userdata("BranchID"),
|
||||
'fiscalyear_id' => $this->session->userdata("FiscalYearID"),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => $this->session->userdata("loggedUser"),
|
||||
// 'remarks' => filter_var($_POST['remarks']),
|
||||
'status' => 1
|
||||
);
|
||||
$this->db->insert('tbl_voucherdetails', $TableData);
|
||||
$entry_no++;
|
||||
endforeach;
|
||||
$this->db->where("voucher_id", $voucher_id)->set("voucher_state", 'Reversed')->update("tbl_vouchers");
|
||||
endif;
|
||||
redirect("accounts/listvouchers");
|
||||
break;
|
||||
case 'ledger':
|
||||
$data['pageTitle'] = "Ledger";
|
||||
$AccountGroups = $this->db->where("status", 1)->get("tbl_acgroups")->result();
|
||||
foreach ($AccountGroups as $AccountGroup) {
|
||||
$AccountGroup->AccountCategories = $this->db->where("status", 1)->where("acgroup_id", $AccountGroup->acgroup_id)->get("tbl_accategories")->result();
|
||||
}
|
||||
$data['AccountGroups'] = $AccountGroups;
|
||||
loadView("accounts/ledger", $data);
|
||||
break;
|
||||
case 'ledgerall':
|
||||
$data['pageTitle'] = "Ledger";
|
||||
$Accounts = $this->db->where("status", 1)->get("tbl_accounts")->result();
|
||||
foreach ($Accounts as $Account) :
|
||||
|
||||
|
||||
endforeach;
|
||||
$AccountGroups = $this->db->where("status", 1)->get("tbl_acgroups")->result();
|
||||
$data['Accounts'] = $Accounts;
|
||||
$data['AccountGroups'] = $AccountGroups;
|
||||
loadView("accounts/ledgerall", $data);
|
||||
break;
|
||||
case 'getledgersummary':
|
||||
$account_id = $this->uri->segment(3);
|
||||
$data['pageTitle'] = "Ledger";
|
||||
$Transactions = $this->db->where("status", 1)->where("account_id", $account_id)->get("tbl_voucherdetails")->result();
|
||||
$Account = $this->db->where("status", 1)->where("account_id", $account_id)->get("tbl_accounts")->row();
|
||||
foreach ($Transactions as $T) {
|
||||
//$T->AccountCategory=$this->db->where("status",1)->where("accategory_id",$AccountGroup->acgroup_id)->get("tbl_accategories")->result();
|
||||
$T->Voucher = $this->db->where("status", 1)->where("voucher_id", $T->voucher_id)->get("tbl_vouchers")->row();
|
||||
}
|
||||
$data['Transactions'] = $Transactions;
|
||||
$data['Account'] = $Account;
|
||||
$data['account_id'] = $account_id;
|
||||
$this->load->view("accounts/ledgersummary", $data);
|
||||
break;
|
||||
case 'trialbalance':
|
||||
$data['pageTitle'] = "Trial Balance";
|
||||
$AccountGroups = $this->db->where("status", 1)->get("tbl_acgroups")->result();
|
||||
foreach ($AccountGroups as $AccountGroup) {
|
||||
$AccountGroup->AccountCategories = $this->db->where("status", 1)->where("acgroup_id", $AccountGroup->acgroup_id)->get("tbl_accategories")->result();
|
||||
foreach ($AccountGroup->AccountCategories as $AccountCategory) {
|
||||
$AccountCategory->Accounts = $this->db->where("status", 1)->where("accategory_id", $AccountCategory->accategory_id)->get("tbl_accounts")->result();
|
||||
}
|
||||
}
|
||||
$data['AccountGroups'] = $AccountGroups;
|
||||
loadView("accounts/trialbalance", $data);
|
||||
break;
|
||||
default:
|
||||
loadView("accounts/list", $data);
|
||||
}
|
||||
}
|
||||
}
|
159
account/application/controllers/accounts/Accountheads.php
Normal file
159
account/application/controllers/accounts/Accountheads.php
Normal file
@ -0,0 +1,159 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
class Accountheads extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->helper("accounts");
|
||||
checkLogin();
|
||||
}
|
||||
public function _remap($alias = "", $params = array())
|
||||
{
|
||||
$data['dataValue'] = $this->session;
|
||||
$data['pageTitle'] = "Account Head";
|
||||
switch ($alias) {
|
||||
case 'add':
|
||||
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;
|
||||
case 'edit':
|
||||
$id = $this->uri->segment(4);
|
||||
if (isset($_POST['submit'])) {
|
||||
$TableData = array(
|
||||
'accategory_id' => filter_var($_POST['accategory_id']),
|
||||
//'account_code' => 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->where('account_id', $id);
|
||||
$this->db->update('tbl_accounts', $TableData);
|
||||
$voucherData = array(
|
||||
"Dr" => 0,
|
||||
"Cr" => 0,
|
||||
);
|
||||
if ($_POST['opening_balance_drcr'] == "DR") $voucherData['Dr'] = $_POST['opening_balance'];
|
||||
if ($_POST['opening_balance_drcr'] == "CR") $voucherData['Cr'] = $_POST['opening_balance'];
|
||||
$v = $this->db->query("select * from tbl_voucherdetails where account_id =\"$id\" and voucher_id=\"0\" ")->row();
|
||||
if ($v) {
|
||||
$this->db->where('account_id', $id);
|
||||
$this->db->where('voucher_id', 0);
|
||||
$this->db->update('tbl_voucherdetails', $voucherData);
|
||||
} else {
|
||||
$voucherData = array(
|
||||
"voucher_id" => 0,
|
||||
"transaction_date" => date("Y-m-d"),
|
||||
"account_id" => $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");
|
||||
}
|
||||
$data['Account'] = $this->db->query("select * from tbl_accounts where account_id =\"$id\" ")->row();
|
||||
$data['Account']->OpeningEntry = $this->db->query("select * from tbl_voucherdetails where account_id =\"$id\" and voucher_id=\"0\"")->row();
|
||||
loadView("accounts/accountheads/edit", $data);
|
||||
break;
|
||||
case 'delete':
|
||||
$id = $this->uri->segment(4);
|
||||
if (!$this->myaccounts->hasTransaction("account", $id)) {
|
||||
$this->db->set('status', "-1");
|
||||
$this->db->set('remarks', "Deleted on" . date("Y-m-d H:i:s") . " by " . $this->session->userdata("loggedUser"));
|
||||
$this->db->where('account_id', $id);
|
||||
$this->db->update('tbl_accounts');
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "Transaction Exists!!! Can't Delete";die;
|
||||
}
|
||||
redirect("accounts/accountheads/list");
|
||||
break;
|
||||
case 'getdetails':
|
||||
$id = $this->uri->segment(4);
|
||||
$this->db->where("account_id", $id);
|
||||
$data['Account'] = $this->db->get("tbl_accounts")->row();
|
||||
$this->load->view("accounts/accountheads/details", $data);
|
||||
break;
|
||||
case 'renumerate':
|
||||
$Accounts = $this->db->where("status=1")->get("tbl_accounts")->result();
|
||||
foreach ($Accounts as $Account) :
|
||||
$AccountCode = generateAccountCode($Account->accategory_id);
|
||||
$this->db->where("account_id", $Account->account_id)->set("account_code", $AccountCode)->update("tbl_accounts");
|
||||
endforeach;
|
||||
redirect("accounts/accountheads/");
|
||||
break;
|
||||
default:
|
||||
loadView("accounts/accountheads/list", $data);
|
||||
}
|
||||
}
|
||||
function checkifAccountExists($account_name)
|
||||
{
|
||||
return ($this->db->query("select * from tbl_accounts where UPPER(account_name)='" . strtoupper($account_name) . "'")->num_rows() > 0) ? true : false;
|
||||
}
|
||||
}
|
107
account/application/controllers/accounts/Ledger.php
Normal file
107
account/application/controllers/accounts/Ledger.php
Normal file
@ -0,0 +1,107 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
class Ledger extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->helper("accounts");
|
||||
checkLogin();
|
||||
}
|
||||
public function _remap($alias = "", $params = array())
|
||||
{
|
||||
|
||||
$data['dataValue'] = $this->session;
|
||||
|
||||
$data['pageTitle'] = "Account Head";
|
||||
switch ($alias) {
|
||||
case 'navigate':
|
||||
$data['pageTitle'] = "Ledger";
|
||||
$AccountGroups = $this->db->where("status", 1)->get("tbl_acgroups")->result();
|
||||
foreach ($AccountGroups as $AccountGroup) {
|
||||
$AccountGroup->AccountCategories = $this->db->where("status", 1)->where("acgroup_id", $AccountGroup->acgroup_id)->get("tbl_accategories")->result();
|
||||
}
|
||||
$data['AccountGroups'] = $AccountGroups;
|
||||
loadView("accounts/ledger/navigate", $data);
|
||||
break;
|
||||
case 'getledgersummary':
|
||||
$account_id = $this->uri->segment(3);
|
||||
$data['pageTitle'] = "Ledger";
|
||||
$Transactions = $this->db->where("status", 1)->where("account_id", $account_id)->get("tbl_voucherdetails")->result();
|
||||
$Account = $this->db->where("status", 1)->where("account_id", $account_id)->get("tbl_accounts")->row();
|
||||
foreach ($Transactions as $T) {
|
||||
//$T->AccountCategory=$this->db->where("status",1)->where("accategory_id",$AccountGroup->acgroup_id)->get("tbl_accategories")->result();
|
||||
$T->Voucher = $this->db->where("status", 1)->where("voucher_id", $T->voucher_id)->get("tbl_vouchers")->row();
|
||||
}
|
||||
$data['Transactions'] = $Transactions;
|
||||
$data['Account'] = $Account;
|
||||
$data['account_id'] = $account_id;
|
||||
$this->load->view("accounts/ledgersummary", $data);
|
||||
break;
|
||||
case 'partyledger':
|
||||
$data['pageTitle'] = "View Party Ledger";
|
||||
// $_GET['show_ledger'];
|
||||
if (isset($_GET['show_ledger'])) {
|
||||
$fromDate_Nepali = $_GET['from_date'];
|
||||
$toDate_Nepali = $_GET['to_date'];
|
||||
$data['fromDate'] = NepaliToEnglishDate($fromDate_Nepali);
|
||||
$data['toDate'] = NepaliToEnglishDate($toDate_Nepali);
|
||||
$data['fromDate_Nepali'] = $fromDate_Nepali;
|
||||
$data['toDate_Nepali'] = $toDate_Nepali;
|
||||
$data['account_id'] = $_GET['account_id'];
|
||||
}
|
||||
loadView("accounts/ledger/partywise", $data);
|
||||
break;
|
||||
case 'print':
|
||||
$account_id = $this->uri->segment(4);
|
||||
$fromDate=(isset($_GET['from_date'])?$_GET['from_date']:NepaliDate(($this->session->userdata('FiscalYear'))->fiscalyear_from));
|
||||
$toDate=(isset($_GET['to_date'])?$_GET['to_date']:NepaliDate(($this->session->userdata('FiscalYear'))->fiscalyear_to));
|
||||
$LedgerPDF=$this->myaccounts->ledgerPDF($account_id,NepaliToEnglishDate($fromDate), NepaliToEnglishDate($toDate));
|
||||
$data['PDFFile']=site_url("pdf/ledgers/".$LedgerPDF);
|
||||
if(isset($_GET['modal']))
|
||||
$this->load->view("accounts/pdfviewer",$data);
|
||||
else
|
||||
loadView("accounts/pdfviewer",$data);
|
||||
break;
|
||||
case 'getaccountbalance':
|
||||
$account_id = $this->uri->segment(4);
|
||||
$AccountDetails=$this->myaccounts->getAccountDetails($account_id);
|
||||
$AccountDetails->BalanceRaw=$AccountDetails->Balance;
|
||||
$AccountDetails->Balance=myCurrency($AccountDetails->Balance);
|
||||
echo json_encode($AccountDetails);
|
||||
break;
|
||||
case 'day_book':
|
||||
$data['pageTitle'] = "Day Book";
|
||||
loadView("accounts/daybook", $data);
|
||||
break;
|
||||
case 'bank_book':
|
||||
$data['pageTitle'] = "Bank Book";
|
||||
loadView("accounts/ledger_bankbook", $data);
|
||||
break;
|
||||
case 'cash_book':
|
||||
$data['pageTitle'] = "Cash Book";
|
||||
loadView("accounts/ledger_cashbook", $data);
|
||||
break;
|
||||
case 'receiveables':
|
||||
$data['pageTitle'] = "Accounts Receiveables";
|
||||
loadView("accounts/ledger_receiveables", $data);
|
||||
break;
|
||||
case 'payables':
|
||||
$data['pageTitle'] = "Accounts Payables";
|
||||
loadView("accounts/ledger_payables", $data);
|
||||
break;
|
||||
default:
|
||||
$data['pageTitle'] = "Ledger";
|
||||
$Accounts = $this->db->where("status", 1)->get("tbl_accounts")->result();
|
||||
foreach ($Accounts as $Account) :
|
||||
|
||||
|
||||
endforeach;
|
||||
$AccountGroups = $this->db->where("status", 1)->get("tbl_acgroups")->result();
|
||||
$data['Accounts'] = $Accounts;
|
||||
$data['AccountGroups'] = $AccountGroups;
|
||||
loadView("accounts/ledgerall", $data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
86
account/application/controllers/accounts/Openingbalance.php
Normal file
86
account/application/controllers/accounts/Openingbalance.php
Normal file
@ -0,0 +1,86 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
class Openingbalance extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->helper("accounts");
|
||||
checkLogin();
|
||||
}
|
||||
public function _remap($alias = "", $params = array())
|
||||
{
|
||||
|
||||
$data['dataValue'] = $this->session;
|
||||
|
||||
$data['pageTitle'] = "Opening Balance";
|
||||
switch ($alias) {
|
||||
case 'add':
|
||||
// if (isset($_POST['submit'])) {
|
||||
// $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);
|
||||
// redirect("accounts/accountheads/list");
|
||||
// }
|
||||
// loadView("accounts/accountheads/add", $data);
|
||||
break;
|
||||
case 'edit':
|
||||
// $id = $this->uri->segment(4);
|
||||
// if (isset($_POST['submit'])) {
|
||||
// $TableData = array(
|
||||
// 'accategory_id' => filter_var($_POST['accategory_id']),
|
||||
// //'account_code' => 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->where('account_id', $id);
|
||||
// $this->db->update('tbl_accounts', $TableData);
|
||||
// redirect("accounts/accountheads/list");
|
||||
// }
|
||||
// $data['Account'] = $this->db->query("select * from tbl_accounts where account_id =\"$id\" ")->row();
|
||||
// loadView("accounts/accountheads/edit", $data);
|
||||
// break;
|
||||
case 'delete':
|
||||
// $id = $this->uri->segment(4);
|
||||
// $this->db->set('status', "-1");
|
||||
// $this->db->set('remarks', "Deleted on" . date("Y-m-d H:i:s") . " by " . $this->session->userdata("loggedUser"));
|
||||
// $this->db->where('account_id', $id);
|
||||
// $this->db->update('tbl_accounts');
|
||||
// redirect("accounts/accountheads/list");
|
||||
break;
|
||||
|
||||
default:
|
||||
loadView("accounts/openingbalance/entry", $data);
|
||||
}
|
||||
}
|
||||
}
|
210
account/application/controllers/accounts/Reports.php
Normal file
210
account/application/controllers/accounts/Reports.php
Normal file
@ -0,0 +1,210 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
class Reports extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->helper("accounts");
|
||||
checkLogin();
|
||||
}
|
||||
public function _remap($alias = "", $params = array())
|
||||
{
|
||||
$data['dataValue'] = $this->session;
|
||||
$data['pageTitle'] = "Account Head";
|
||||
switch ($alias) {
|
||||
case 'accounts':
|
||||
$data['pageTitle'] = "List of Accounts";
|
||||
loadView("accounts/accounts/list", $data);
|
||||
break;
|
||||
case 'ledger':
|
||||
$data['pageTitle'] = "Ledger";
|
||||
$AccountGroups = $this->db->where("status", 1)->get("tbl_acgroups")->result();
|
||||
foreach ($AccountGroups as $AccountGroup) {
|
||||
$AccountGroup->AccountCategories = $this->db->where("status", 1)->where("acgroup_id", $AccountGroup->acgroup_id)->get("tbl_accategories")->result();
|
||||
}
|
||||
$data['AccountGroups'] = $AccountGroups;
|
||||
loadView("accounts/ledger", $data);
|
||||
break;
|
||||
case 'ledgerall':
|
||||
$data['pageTitle'] = "Ledger";
|
||||
$Accounts = $this->db->where("status", 1)->get("tbl_accounts")->result();
|
||||
foreach ($Accounts as $Account) :
|
||||
|
||||
|
||||
endforeach;
|
||||
$AccountGroups = $this->db->where("status", 1)->get("tbl_acgroups")->result();
|
||||
$data['Accounts'] = $Accounts;
|
||||
$data['AccountGroups'] = $AccountGroups;
|
||||
loadView("accounts/ledgerall", $data);
|
||||
break;
|
||||
case 'getledgersummary':
|
||||
$account_id = $this->uri->segment(3);
|
||||
$data['pageTitle'] = "Ledger";
|
||||
$Transactions = $this->db->where("status", 1)->where("account_id", $account_id)->get("tbl_voucherdetails")->result();
|
||||
$Account = $this->db->where("status", 1)->where("account_id", $account_id)->get("tbl_accounts")->row();
|
||||
foreach ($Transactions as $T) {
|
||||
// $T->AccountCategory=$this->db->where("status",1)->where("accategory_id",$AccountGroup->acgroup_id)->get("tbl_accategories")->result();
|
||||
$T->Voucher = $this->db->where("status", 1)->where("voucher_id", $T->voucher_id)->get("tbl_vouchers")->row();
|
||||
}
|
||||
$data['Transactions'] = $Transactions;
|
||||
$data['Account'] = $Account;
|
||||
$data['account_id'] = $account_id;
|
||||
$this->load->view("accounts/ledgersummary", $data);
|
||||
break;
|
||||
case 'trialbalance_old':
|
||||
$data['pageTitle'] = "Trial Balance";
|
||||
$AccountGroups = $this->db->where("status", 1)->get("tbl_acgroups")->result();
|
||||
foreach ($AccountGroups as $AccountGroup) {
|
||||
$AccountGroup->AccountCategories = $this->db->where("status", 1)->where("acgroup_id", $AccountGroup->acgroup_id)->get("tbl_accategories")->result();
|
||||
foreach ($AccountGroup->AccountCategories as $AccountCategory) {
|
||||
$AccountCategory->Accounts = $this->db->where("status", 1)->where("accategory_id", $AccountCategory->accategory_id)->get("tbl_accounts")->result();
|
||||
}
|
||||
}
|
||||
$data['AccountGroups'] = $AccountGroups;
|
||||
loadView("accounts/trialbalance", $data);
|
||||
break;
|
||||
case 'trialbalance':
|
||||
$data['pageTitle'] = "Trial Balance";
|
||||
loadView("accounts/trialbalance_new", $data);
|
||||
break;
|
||||
case 'trialbalance_raw':
|
||||
$data['pageTitle'] = "Trial Balance";
|
||||
|
||||
|
||||
loadView("accounts/trialbalance_raw", $data);
|
||||
break;
|
||||
case 'trialbalance_table':
|
||||
$data['pageTitle'] = "Trial Balance";
|
||||
|
||||
loadView("accounts/trialbalance_table", $data);
|
||||
break;
|
||||
case 'show_voucher':
|
||||
$data['voucher_id'] = $this->uri->segment(4);
|
||||
loadView("accounts/vouchers/show_voucher", $data);
|
||||
break;
|
||||
case 'balance_by_type':
|
||||
$data['pageTitle'] = "Account Balances By Types";
|
||||
loadView("accounts/balances/bytype", $data);
|
||||
break;
|
||||
case 'balance_by_category':
|
||||
$acgroup_id = 0;
|
||||
$data['pageTitle'] = "Account Balances By Category";
|
||||
if (isset($_GET['group'])) {
|
||||
$acgroup_id = ($_GET['group']) ? $_GET['group'] : 0;
|
||||
}
|
||||
if ($acgroup_id != 0) {
|
||||
$group = getFieldfromValue("tbl_acgroups", "acgroup_name", "acgroup_id", $acgroup_id);
|
||||
$data['pageTitle'] = "Account Balances By " . $group;
|
||||
}
|
||||
$data['acgroup_id'] = $acgroup_id;
|
||||
loadView("accounts/balances/bycategory", $data);
|
||||
break;
|
||||
case 'balance_by_group':
|
||||
$accategory_id = 0;
|
||||
$data['pageTitle'] = "Account Balances By Group";
|
||||
if (isset($_GET['category'])) {
|
||||
$accategory_id = ($_GET['category']) ? $_GET['category'] : 0;
|
||||
}
|
||||
if ($accategory_id != 0) {
|
||||
$group = getFieldfromValue("tbl_accategories", "accategory_name", "accategory_id", $accategory_id);
|
||||
$data['pageTitle'] = "Account Balances By " . $group;
|
||||
}
|
||||
loadView("accounts/balances/bygroup", $data);
|
||||
break;
|
||||
case 'balance_by_ledger':
|
||||
$accategory_id = 0;
|
||||
$data['pageTitle'] = "Account Balances By Group";
|
||||
if (isset($_GET['group'])) {
|
||||
$accategory_id = ($_GET['group']) ? $_GET['group'] : 0;
|
||||
}
|
||||
if ($accategory_id != 0) {
|
||||
$group = getFieldfromValue("tbl_accategories", "accategory_name", "accategory_id", $accategory_id);
|
||||
$data['pageTitle'] = "Account Balances By " . $group;
|
||||
}
|
||||
$data['accategory_id'] = $accategory_id;
|
||||
loadView("accounts/balances/byledger", $data);
|
||||
break;
|
||||
case 'pl_old':
|
||||
$data['pageTitle'] = "Profit & Loss Statement";
|
||||
loadView("accounts/pl", $data);
|
||||
break;
|
||||
case 'pl':
|
||||
$data['pageTitle'] = "Profit & Loss Statement";
|
||||
loadView("accounts/pl_new", $data);
|
||||
break;
|
||||
|
||||
case 'pl_grouped':
|
||||
$data['pageTitle'] = "Profit & Loss Statement";
|
||||
loadView("accounts/bib_pl", $data);
|
||||
break;
|
||||
case 'balance_sheet_old':
|
||||
$data['pageTitle'] = "Balance Sheet";
|
||||
loadView("accounts/balancesheet", $data);
|
||||
break;
|
||||
case 'balance_sheet':
|
||||
$data['pageTitle'] = "Balance Sheet";
|
||||
loadView("accounts/balancesheet_new", $data);
|
||||
break;
|
||||
case 'balance_sheet_vertical':
|
||||
$data['pageTitle'] = "Balance Sheet";
|
||||
loadView("accounts/balance_sheet_vertical", $data);
|
||||
break;
|
||||
case 'cash_flow':
|
||||
$data['pageTitle'] = "Cash Flow";
|
||||
loadView("accounts/cash_flow", $data);
|
||||
break;
|
||||
case 'receipts_payments':
|
||||
$data['pageTitle'] = "Cash Flow";
|
||||
loadView("accounts/receipts_payments", $data);
|
||||
break;
|
||||
case 'incomes_and_expenses':
|
||||
$data['pageTitle'] = "Cash Flow";
|
||||
loadView("accounts/incomes_expenses", $data);
|
||||
break;
|
||||
case 'receipt_and_payment':
|
||||
$data['pageTitle'] = "Cash Flow";
|
||||
loadView("accounts/receipt_and_payment", $data);
|
||||
break;
|
||||
case 'ratio_analysis':
|
||||
$data['pageTitle'] = "Cash Flow";
|
||||
loadView("accounts/ratio_analysis", $data);
|
||||
break;
|
||||
case 'sales_register':
|
||||
$data['pageTitle'] = "Sales Register";
|
||||
loadView("accounts/sales_register", $data);
|
||||
break;
|
||||
case 'purchase_register':
|
||||
$data['pageTitle'] = "Purchase Register";
|
||||
loadView("accounts/purchase_register", $data);
|
||||
break;
|
||||
case 'ajax':
|
||||
$ajaxCommand = $this->uri->segment(4);
|
||||
$this->processAjax($ajaxCommand);
|
||||
break;
|
||||
default:
|
||||
loadView("accounts/list", $data);
|
||||
}
|
||||
}
|
||||
private function processAjax($command)
|
||||
{
|
||||
switch ($command) {
|
||||
case 'accountsbycategory':
|
||||
$accategory_id = $this->uri->segment(5);
|
||||
$this->myaccounts->getAccountsTableByCategory($accategory_id);
|
||||
break;
|
||||
case 'getallaccounts':
|
||||
$this->myaccounts->getAllAccountsTable();
|
||||
break;
|
||||
case 'getledgersummary':
|
||||
$account_id = $this->uri->segment(5);
|
||||
$this->myaccounts->showLedger($account_id);
|
||||
|
||||
|
||||
break;
|
||||
case 'default':
|
||||
//show_404();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
83
account/application/controllers/accounts/Setup.php
Normal file
83
account/application/controllers/accounts/Setup.php
Normal file
@ -0,0 +1,83 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
class Setup extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->helper("accounts");
|
||||
checkLogin();
|
||||
}
|
||||
public function _remap($alias = "", $params = array())
|
||||
{
|
||||
|
||||
$data['dataValue'] = $this->session;
|
||||
|
||||
$data['pageTitle'] = "Account Setup";
|
||||
switch ($alias) {
|
||||
// case 'addsingleentryvoucher':
|
||||
// $data['pageTitle'] = "Single Entry Voucher";
|
||||
// if (isset($_POST['submit'])) {
|
||||
// $TableData = array(
|
||||
// 'voucher_type' => 'SINGLE-ENTRY',
|
||||
// 'voucher_name' => filter_var($_POST['voucher_name']),
|
||||
// 'voucher_alias' => createalias(filter_var($_POST['voucher_name'])),
|
||||
// 'default_account' => filter_var($_POST['default_account']),
|
||||
// 'default_accountside' => filter_var($_POST['default_accountside']),
|
||||
// 'voucher_options' => filter_var($_POST['voucher_options']),
|
||||
// 'created_on' => date('Y-m-d H:i:s'),
|
||||
// 'created_by' => $this->session->userdata("loggedUser"),
|
||||
// 'remarks' => filter_var($_POST['remarks']),
|
||||
// 'status' => 1,
|
||||
// );
|
||||
// $this->db->insert('tbl_vouchertypes', $TableData);
|
||||
// redirect("accounts/setup/singleentryvoucher");
|
||||
// }
|
||||
// loadView("accounts/setup/singleentryvoucher/create", $data);
|
||||
// break;
|
||||
case 'editvouchertype':
|
||||
$data['pageTitle'] = "Voucher Types ";
|
||||
$vouchertype_id = $this->uri->segment(4);
|
||||
$Accountcategories = $this->db->where("status", 1)->where("parent_category_id <>","0")->order_by("accategory_name","asc")->get("tbl_accategories")->result();
|
||||
// pre($Accountcategories);die;
|
||||
$VoucherType = $this->db->where("vouchertype_id", $vouchertype_id)->get("tbl_vouchertypes")->row();
|
||||
if (isset($_POST['submit'])) {
|
||||
// pre($_POST['default_debits']);die;
|
||||
$TableData = array(
|
||||
'voucher_name' => filter_var($_POST['voucher_name']),
|
||||
'voucher_color' => filter_var($_POST['voucher_color']),
|
||||
'default_debits' => isset($_POST['default_debits']) ? implode(",", $_POST['default_debits']) : "",
|
||||
'default_credits' => isset($_POST['default_credits']) ? implode(",", $_POST['default_credits']) : "",
|
||||
'status' => $_POST['status']
|
||||
);
|
||||
// pre($TableData);die;
|
||||
$this->db->where("vouchertype_id", $vouchertype_id)->update('tbl_vouchertypes', $TableData);
|
||||
redirect("accounts/setup/listsingleentryvouchers");
|
||||
}
|
||||
$data['VoucherType'] = $VoucherType;
|
||||
$data['Accountcategories'] = $Accountcategories;
|
||||
loadView("accounts/setup/singleentryvoucher/edit", $data);
|
||||
break;
|
||||
case 'listsingleentryvouchers':
|
||||
$data['pageTitle'] = "Voucher Types";
|
||||
loadView("accounts/setup/singleentryvoucher/list", $data);
|
||||
|
||||
break;
|
||||
// case 'deletevouchertype':
|
||||
// $id = $this->uri->segment(4);
|
||||
// $this->db->where('vouchertype_id', $id);
|
||||
// $this->db->update('tbl_vouchertypes', array("status" => 0));
|
||||
// redirect("accounts/setup/listsingleentryvouchers");
|
||||
// break;
|
||||
// case 'togglevouchertype':
|
||||
// $id = $this->uri->segment(4);
|
||||
// $q="update tbl_vouchertypes set `status`= 1 - `status` where vouchertype_id='$id'";
|
||||
// $this->db->query($q);
|
||||
// redirect("accounts/setup/listsingleentryvouchers");
|
||||
// break;
|
||||
|
||||
default:
|
||||
loadView("accounts/setup/singleentryvoucher/list", $data);
|
||||
}
|
||||
}
|
||||
}
|
597
account/application/controllers/accounts/Vouchers.php
Normal file
597
account/application/controllers/accounts/Vouchers.php
Normal file
@ -0,0 +1,597 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
class Vouchers extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->helper("accounts");
|
||||
$this->load->library("myaccounts");
|
||||
checkLogin();
|
||||
}
|
||||
public function _remap($alias = "", $params = array())
|
||||
{
|
||||
|
||||
$data['dataValue'] = $this->session;
|
||||
$data['pageTitle'] = "Accounting Vouchers";
|
||||
switch ($alias) {
|
||||
case 'print':
|
||||
$voucher_id = $this->uri->segment(4);
|
||||
$VoucherPDF = $this->myaccounts->voucherPDF($voucher_id);
|
||||
$data['PDFFile'] = site_url("pdf/vouchers/" . $VoucherPDF);
|
||||
if (isset($_GET['modal']))
|
||||
$this->load->view("accounts/pdfviewer", $data);
|
||||
else
|
||||
loadView("accounts/pdfviewer", $data);
|
||||
break;
|
||||
case 'listvouchers':
|
||||
$data['pageTitle'] = "Vouchers";
|
||||
$fromDate_bs = isset($_GET['from_date']) ? $_GET['from_date'] : firstDayOfNepaliMonth();
|
||||
$todate_bs = isset($_GET['to_date']) ? $_GET['to_date'] : NepaliDate(Today());
|
||||
$fromDate_ad = NepaliToEnglishDate($fromDate_bs);
|
||||
$toDate_ad = NepaliToEnglishDate($todate_bs);
|
||||
$data['fromDate_bs'] = $fromDate_bs;
|
||||
$data['toDate_bs'] = $todate_bs;
|
||||
$data['fromDate_ad'] = $fromDate_ad;
|
||||
$data['toDate_ad'] = $toDate_ad;
|
||||
$data['VoucherTypes']=$this->myaccounts->getVoucherTypes();
|
||||
loadView("accounts/vouchers/listvouchers", $data);
|
||||
break;
|
||||
case 'addvoucher':
|
||||
$data['pageTitle'] = "Journal Voucher";
|
||||
if (isset($_POST['submit']) && !isVoucherExists($_POST['voucher_no'])) {
|
||||
$TableData = array(
|
||||
'voucher_no' => filter_var($_POST['voucher_no']),
|
||||
'voucher_ref' => "JV" . filter_var($_POST['voucher_no']), // If the voucher is raised against other transactions
|
||||
'voucher_date' => NepaliToEnglishDate(filter_var($_POST['voucher_date'])),
|
||||
'voucher_state' => 'Entered', // Different stages of voucher Entered/Reversed/Cancel/Deleted/Locked/Draft etc.
|
||||
'voucher_type' => 'Journal', //Different types of Vouchers like Cash/Bank/Payment/Receipt/advance etc.
|
||||
'fiscalyear_id' => $this->session->userdata("FiscalYearID"),
|
||||
'branch_id' => $this->session->userdata("BranchID"),
|
||||
'created_by' => $this->session->userdata("loggedUser"),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
'status' => 1
|
||||
);
|
||||
$this->db->insert('tbl_vouchers', $TableData);
|
||||
$voucher_id = $this->db->insert_id();
|
||||
$account_ids = $_POST['account_ids'];
|
||||
$narrations = $_POST['narration'];
|
||||
$debits = $_POST['debit'];
|
||||
$credits = $_POST['credit'];
|
||||
$entry_no = 0;
|
||||
for ($entry_no = 0; $entry_no < sizeof($account_ids); $entry_no++) {
|
||||
$TableData = array();
|
||||
$TableData = array(
|
||||
'voucher_id' => $voucher_id,
|
||||
'entry_no' => $entry_no,
|
||||
'transaction_date' => NepaliToEnglishDate(filter_var($_POST['voucher_date'])),
|
||||
'account_id' => $account_ids[$entry_no],
|
||||
'narration' => $narrations[$entry_no],
|
||||
'dr' => $debits[$entry_no],
|
||||
'cr' => $credits[$entry_no],
|
||||
// 'cheque' => filter_var($_POST['cheque']),
|
||||
// 'cheque_details' => filter_var($_POST['cheque_details']),
|
||||
'currency' => 'NPR',
|
||||
// 'exrate' => filter_var($_POST['exrate']),
|
||||
// 'fcdr' => filter_var($_POST['fcdr']),
|
||||
// 'fccr' => filter_var($_POST['fccr']),
|
||||
'branch_id' => $this->session->userdata("BranchID"),
|
||||
'fiscalyear_id' => $this->session->userdata("FiscalYearID"),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => $this->session->userdata("loggedUser"),
|
||||
// 'remarks' => filter_var($_POST['remarks']),
|
||||
'status' => 1
|
||||
);
|
||||
$this->db->insert('tbl_voucherdetails', $TableData);
|
||||
}
|
||||
redirect("accounts/vouchers/print/" . $voucher_id);
|
||||
break;
|
||||
}
|
||||
|
||||
loadView("accounts/vouchers/addvoucher", $data);
|
||||
break;
|
||||
case 'voucherdetails':
|
||||
$voucher_id = $this->uri->segment(4);
|
||||
$Voucher = $this->db->where("voucher_id", $voucher_id)->get("tbl_vouchers")->row();
|
||||
$Voucher->Details = $this->db->where("voucher_id", $voucher_id)->get("tbl_voucherdetails")->result();
|
||||
$data['Voucher'] = $Voucher;
|
||||
$this->load->view("accounts/vouchers/voucherdetails", $data);
|
||||
break;
|
||||
case 'show_voucher':
|
||||
$data['pageTitle'] = "Voucher Entries";
|
||||
$voucher_id = $this->uri->segment(4);
|
||||
$Voucher = $this->db->where("voucher_id", $voucher_id)->get("tbl_vouchers")->row();
|
||||
if($Voucher) {
|
||||
$Voucher->Details = $this->db->where("voucher_id", $voucher_id)->get("tbl_voucherdetails")->result();
|
||||
$data['Voucher'] = $Voucher;
|
||||
$data['voucher_id'] = $voucher_id;
|
||||
loadview("accounts/vouchers/show_voucher", $data);
|
||||
}
|
||||
break;
|
||||
case 'reversal':
|
||||
$voucher_id = $this->uri->segment(4);
|
||||
if (isVoucherReverseable($voucher_id)) :
|
||||
$VoucherDetails = $this->db->where("voucher_id", $voucher_id)->get("tbl_voucherdetails")->result();
|
||||
$entry_no = 0;
|
||||
foreach ($VoucherDetails as $VoucherDetail) :
|
||||
$TableData = array(
|
||||
'voucher_id' => $voucher_id,
|
||||
'entry_no' => $entry_no,
|
||||
'transaction_date' => $VoucherDetail->transaction_date,
|
||||
'account_id' => $VoucherDetail->account_id,
|
||||
'narration' => "Reversal of Voucher #" . getFieldfromValue("tbl_vouchers", "voucher_no", "voucher_id", $VoucherDetail->voucher_id),
|
||||
'dr' => $VoucherDetail->cr,
|
||||
'cr' => $VoucherDetail->dr,
|
||||
// 'cheque' => filter_var($_POST['cheque']),
|
||||
// 'cheque_details' => filter_var($_POST['cheque_details']),
|
||||
'currency' => 'NPR',
|
||||
// 'exrate' => filter_var($_POST['exrate']),
|
||||
// 'fcdr' => filter_var($_POST['fcdr']),
|
||||
// 'fccr' => filter_var($_POST['fccr']),
|
||||
'branch_id' => $this->session->userdata("BranchID"),
|
||||
'fiscalyear_id' => $this->session->userdata("FiscalYearID"),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => $this->session->userdata("loggedUser"),
|
||||
// 'remarks' => filter_var($_POST['remarks']),
|
||||
'status' => 1
|
||||
);
|
||||
$this->db->insert('tbl_voucherdetails', $TableData);
|
||||
$entry_no++;
|
||||
endforeach;
|
||||
$this->db->where("voucher_id", $voucher_id)->set("voucher_state", 'Reversed')->update("tbl_vouchers");
|
||||
endif;
|
||||
redirect("accounts/vouchers/listvouchers");
|
||||
break;
|
||||
default:
|
||||
if ($VoucherType = $this->myaccounts->getVoucherType($alias)) {
|
||||
$this->processVoucher($VoucherType);
|
||||
break;
|
||||
}
|
||||
loadView("accounts/vouchers/listvouchers", $data);
|
||||
}
|
||||
}
|
||||
private function processVoucher($VoucherType)
|
||||
{
|
||||
$data['pageTitle'] = $VoucherType->voucher_name;
|
||||
$data['VoucherType'] = $VoucherType;
|
||||
$command = $this->uri->segment(4);
|
||||
switch ($command) {
|
||||
case 'create':
|
||||
$voucher_no = generateVoucherNo($VoucherType->vouchertype_id);
|
||||
if (isset($_POST['submit'])) {
|
||||
$TableData = array(
|
||||
'voucher_no' => $voucher_no,
|
||||
'voucher_ref' => $VoucherType->vouchertype_id,
|
||||
'voucher_date' => NepaliToEnglishDate(filter_var($_POST['voucher_date'])),
|
||||
'voucher_state' => 'Entered', // Different stages of voucher Entered/Reversed/Cancel/Deleted/Locked/Draft etc.
|
||||
'voucher_type' => $VoucherType->vouchertype_id, //Different types of Vouchers like Cash/Bank/Payment/Receipt/advance etc.
|
||||
'fiscalyear_id' => $this->session->userdata("FiscalYearID"),
|
||||
'branch_id' => $this->session->userdata("BranchID"),
|
||||
'created_by' => $this->session->userdata("loggedUser"),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
// 'remarks' => filter_var($_POST['remarks']),
|
||||
'status' => 1
|
||||
);
|
||||
$this->db->insert('tbl_vouchers', $TableData);
|
||||
$voucher_id = $this->db->insert_id();
|
||||
$account_ids = $_POST['account_ids'];
|
||||
$narration = $_POST['narration'];
|
||||
$debits = $_POST['debit'];
|
||||
$credits = $_POST['credit'];
|
||||
$entry_no = 0;
|
||||
$entryTotal = 0;
|
||||
for ($entry_no = 0; $entry_no < sizeof($account_ids); $entry_no++) {
|
||||
$TableData = array();
|
||||
$entryTotal += $debits[$entry_no];
|
||||
$TableData = array(
|
||||
'voucher_id' => $voucher_id,
|
||||
'entry_no' => $entry_no,
|
||||
'transaction_date' => NepaliToEnglishDate(filter_var($_POST['voucher_date'])),
|
||||
'account_id' => $account_ids[$entry_no],
|
||||
'narration' => $narration,
|
||||
'dr' => $debits[$entry_no],
|
||||
'cr' => $credits[$entry_no],
|
||||
// 'cheque' => isset($_POST['cheque_number']) ? $_POST['cheque_number'][$entry_no] : "",
|
||||
// 'cheque_details' => isset($_POST['cheque_details']) ? $_POST['cheque_details'][$entry_no] : "",
|
||||
'currency' => 'NPR',
|
||||
// 'exrate' => filter_var($_POST['exrate']),
|
||||
// 'fcdr' => filter_var($_POST['fcdr']),
|
||||
// 'fccr' => filter_var($_POST['fccr']),
|
||||
'branch_id' => $this->session->userdata("BranchID"),
|
||||
'fiscalyear_id' => $this->session->userdata("FiscalYearID"),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => $this->session->userdata("loggedUser"),
|
||||
// 'remarks' => filter_var($_POST['remarks']),
|
||||
'status' => 1
|
||||
);
|
||||
//pre($TableData);die;
|
||||
$this->db->insert('tbl_voucherdetails', $TableData);
|
||||
}
|
||||
$entry_no++;
|
||||
|
||||
|
||||
redirect("accounts/vouchers/" . $VoucherType->voucher_alias . "/list");
|
||||
break;
|
||||
}
|
||||
|
||||
loadview("accounts/vouchers/create", $data);
|
||||
// loadview("accounts/vouchers/$VoucherType->voucher_alias/create", $data);
|
||||
break;
|
||||
default:
|
||||
// $dirname = getcwd() . "/application/views/accounts/vouchers/$VoucherType->voucher_alias";
|
||||
// $filename = $dirname . "/create.php";
|
||||
// //echo getcwd() . "\n";die;
|
||||
// if (!file_exists($filename)) {
|
||||
// mkdir($dirname, 0777);
|
||||
// $this->createView($filename);
|
||||
// $filename = $dirname . "/list.php";
|
||||
// $this->createListView($filename);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
$data['Vouchers'] = $this->db->where("status", 1)->where("voucher_type", $VoucherType->vouchertype_id)->get("tbl_vouchers")->result();
|
||||
|
||||
// echo '<pre>' . $VoucherType->vouchertype_id;
|
||||
// print_r($VoucherType);
|
||||
// die();
|
||||
|
||||
// loadview("accounts/vouchers/$VoucherType->voucher_alias/list", $data);
|
||||
redirect("accounts/vouchers/listvouchers?vouchertypes=".$VoucherType->vouchertype_id);
|
||||
}
|
||||
}
|
||||
private function createView($filename)
|
||||
{
|
||||
$CreateFileContent = "<div class=\"content-wrapper\">\n
|
||||
<div class=\"content-header\">\n
|
||||
<div class=\"container-fluid\">\n
|
||||
<div class=\"row mb-2\">\n
|
||||
<div class=\"col-sm-6\">\n
|
||||
<h1 class=\"m-0\">\n<?php echo \$pageTitle; ?></h1>
|
||||
</div>
|
||||
<div class=\"col-sm-6\">\n
|
||||
<ol class=\"breadcrumb float-sm-right\">\n
|
||||
<li class=\"breadcrumb-item\">\n<a href=\"<?php echo base_url(); ?>\">\nDashboard</a></li>
|
||||
<li class=\"breadcrumb-item active\">\n<?php echo \$pageTitle; ?></li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class=\"content\">\n
|
||||
<div class=\"container-fluid\">\n
|
||||
<div class=\"row\">\n
|
||||
<div class=\"col\">\n
|
||||
<div class=\"card card-primary card-outline\">\n
|
||||
<div class=\"card-header\">\n
|
||||
<h5 class=\"m-0\">\nCreate <?php echo \$pageTitle; ?> </h5>
|
||||
</div>
|
||||
<div class=\"card-body\">\n
|
||||
<?php if(\$VoucherType->voucher_options==\"\"): ?>
|
||||
<form method=POST action=\"\" enctype=\"multipart/form-data\" name=\"tbl_accounts\">\n
|
||||
<div class=\"row\">\n
|
||||
<div class=\"col-3\">\n
|
||||
<fieldset>
|
||||
<legend>Transaction Date</legend><input type=\"text\" class=\"form-control nepaliDatePicker\" id=\"voucher_date\" value=\"<?php echo NepaliDate(); ?>\" name=\"voucher_date\">\n
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class=\"col-3\">\n
|
||||
<fieldset>
|
||||
<?php \$DefaultAccount=\$this->myaccounts->getAccountDetails(\$VoucherType->default_account);?>
|
||||
<legend><?php echo \$DefaultAccount->account_name; ?> Balance</legend><?php echo myCurrency(\$DefaultAccount->Balance); ?>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class=\"col-3 offset-3\">\n
|
||||
<fieldset>
|
||||
<legend>Voucher #</legend><input type=\"text\" readonly class=\"form-control\" id=\"voucher_no\" value=\"<?php echo generateVoucherNo(); ?>\" name=\"voucher_no\">\n
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
<div class=\"row\">\n
|
||||
<div class=\"col\">\n
|
||||
<fieldset>
|
||||
<legend>Enter Transaction</legend>
|
||||
<table id=\"EntryTable\" class=\"table order-list\">\n
|
||||
<thead>
|
||||
<tr>
|
||||
<td>Account</td>
|
||||
<td>Narration</td>
|
||||
<td>Amount</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class=\"col-3\">\n <?php fillComboWithValue(\"account_id\", \"\", \"account_id\", \"tbl_accounts\", \"account_name\", \"account_id\", \"\", \"\", \"\", \"status=1\"); ?> </td>
|
||||
<td class=\"col-4\">\n <input type=\"text\" name=\"narration\" id=\"narration\" class=\"form-control\" /> </td>
|
||||
<td class=\"col-1\">\n <input type=\"text\" name=\"debit\" id=\"debit\" value=\"0\" class=\"form-control\" /> </td>
|
||||
<td class=\"col-1\">\n <input type=\"button\" class=\"btn btn-primary full-width\" id=\"addrow\" value=\"Add\" /> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div id=\"errorBox\" class=\"alert alert-secondary hidden\" role=\"alert\">\n
|
||||
<h5></h5>
|
||||
</div>
|
||||
</fieldset>
|
||||
<div class=\"card card-primary card-outline\">\n
|
||||
<div class=\"card-header\">\nTransaction List </div>
|
||||
<div class=\"card-body\">\n
|
||||
<table id=\"myTable\" class=\" table order-list table-striped table-bordered\">\n
|
||||
<thead>
|
||||
<tr>
|
||||
<td>Account</td>
|
||||
<td>Narration</td>
|
||||
<td>Amount</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody> </tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th colspan=\"2\" class=\"text-right\">\nTotal</th>
|
||||
<td>
|
||||
<div id=\"debitTotal\">\n</div>
|
||||
</td>
|
||||
<td>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class=\"row\">\n
|
||||
<!--COL START-->
|
||||
<div class=\"col\">\n
|
||||
<div class=\"form-group\">\n <label for=\"remarks\">\nRemarks</label> <textarea class=\"form-control\" id=\"remarks\" name=\"remarks\">\n</textarea> </div>
|
||||
</div>
|
||||
<!--COL END-->
|
||||
</div> <button class=\"btn btn-primary\" type=\"submit\" id=\"saveButton\" name=\"submit\">\nSave Voucher</button>
|
||||
</form>
|
||||
<?php else: ?>
|
||||
<?php echo \$VoucherType->voucher_options; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
\$(document).ready(function() {
|
||||
var counter = 0;
|
||||
\$(\"#addrow\").on(\"click\", function() {
|
||||
var msg = \"Transaction Row Added !!\";
|
||||
if (\$(\"#account_id\").val() != \"\") {
|
||||
if (!isAccountAdded(\$(\"#account_id\").val())) {
|
||||
if (\$(\"#narration\").val() != \"\") {
|
||||
var debit = (\$.isNumeric(\$(\"#debit\").val()) ? \$(\"#debit\").val() : 0);
|
||||
if (\$.isNumeric(debit)) {
|
||||
if (debit > 0) {
|
||||
addRow()
|
||||
} else {
|
||||
msg = \"Amount contain some value\";
|
||||
}
|
||||
} else {
|
||||
msg = \"Non numberic value entered in amount. \";
|
||||
}
|
||||
} else {
|
||||
msg = \"Narration can't be empty!\";
|
||||
}
|
||||
} else {
|
||||
msg = \"Account already added in transactions\";
|
||||
}
|
||||
} else {
|
||||
msg = \"Account Head Not Selected!\";
|
||||
}
|
||||
\$(\"#errorBox h5\").html(msg);
|
||||
\$(\"#errorBox\").fadeTo(2000, 500).slideUp(500, function() {
|
||||
\$(\"#errorBox\").slideUp(500);
|
||||
});
|
||||
});
|
||||
\$(\"table.order-list\").on(\"click\", \".ibtnDel\", function(event) {
|
||||
\$(this).closest(\"tr\").remove();
|
||||
calculateTotals();
|
||||
});
|
||||
});
|
||||
|
||||
function isAccountAdded(account_id) {
|
||||
var arr = \$('input[name=\"account_id[]\"]').map(function() {
|
||||
return this.value;
|
||||
}).get();
|
||||
if (\$.inArray(account_id, arr) >= 0) return true;
|
||||
else return false;
|
||||
}
|
||||
|
||||
function addRow() {
|
||||
var newRow = \$(\"<tr>\");
|
||||
var cols = \"\";
|
||||
cols += '<td><input type=\"hidden\" class=\"form-control\" name=\"account_ids[]\" value=\"' + \$(\"#account_id\").val() + '\"/><input type=\"text\" readonly class=\"form-control\" name=\"account_name[]\" value=\"' + \$(\"#account_id option:selected\").text() + '\"/></td>';
|
||||
cols += '<td><input type=\"text\" readonly class=\"form-control\" name=\"narration[]\" value=\"' + \$(\"#narration\").val() + '\"/></td>';
|
||||
cols += '<td><input type=\"text\" readonly class=\"form-control\" name=\"debit[]\" value=\"' + (\$.isNumeric(\$(\"#debit\").val()) ? \$(\"#debit\").val() : 0) + '\"/></td>';
|
||||
cols += '<td><input type=\"button\" class=\"ibtnDel btn btn-md btn-danger \" value=\"Delete\"></td>';
|
||||
newRow.append(cols);
|
||||
\$(\"#myTable.order-list\").append(newRow);
|
||||
calculateTotals();
|
||||
}
|
||||
|
||||
function calculateTotals() {
|
||||
var debitTotal = 0;
|
||||
var creditTotal = 0;
|
||||
var balance = 0;
|
||||
\$(\"table.order-list\").find('input[name^=\"debit[]\"]').each(function() {
|
||||
debitTotal += +\$(this).val();
|
||||
});
|
||||
\$(\"#debit\").val(0);
|
||||
\$(\"#narration\").val(\"\");
|
||||
\$(\"#debitTotal\").text(debitTotal.toFixed(2));
|
||||
\$(\"#balance\").text(balance.toFixed(2));
|
||||
\$(\"#saveButton\").prop(\"disabled\", false);
|
||||
}
|
||||
\$(\"#saveButton\").prop(\"disabled\", true);
|
||||
</script>";
|
||||
file_put_contents($filename, $CreateFileContent);
|
||||
}
|
||||
private function createListView($filename)
|
||||
{
|
||||
$ListFileContent = "<div class=\"content-wrapper\">\n
|
||||
<div class=\"content-header\">\n
|
||||
<div class=\"container-fluid\">\n
|
||||
<div class=\"row mb-2\">\n
|
||||
<div class=\"col-sm-6\">\n
|
||||
|
||||
<h1 class=\"m-0\">\n<?php echo \$pageTitle; ?></h1>
|
||||
</div>
|
||||
<div class=\"col-sm-6\">\n
|
||||
<ol class=\"breadcrumb float-sm-right\">\n
|
||||
|
||||
<li class=\"breadcrumb-item\">\n<a href=\"<?php echo base_url(); ?>\">\nDashboard</a></li>
|
||||
<li class=\"breadcrumb-item active\">\n<?php echo \$pageTitle; ?></li>
|
||||
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class=\"content\">\n
|
||||
<div class=\"container-fluid\">\n
|
||||
<div class=\"row\">\n
|
||||
<div class=\"col\">\n
|
||||
|
||||
<div class=\"card card-primary card-outline\">\n
|
||||
<div class=\"card-header\">\n
|
||||
|
||||
<h5 class=\"m-0\">\n<?php echo \$pageTitle; ?> <a href=\"<?php echo site_url(\"accounts/vouchers/\".\$VoucherType->voucher_alias.\"/create\"); ?>\" class=\"btn btn-sm btn-primary float-right\">\nCreate New <?php echo \$pageTitle; ?></a></h5>
|
||||
|
||||
</div>
|
||||
|
||||
<div class=\"card-body\">\n
|
||||
|
||||
<?php \$TableData = \$Vouchers ?>
|
||||
|
||||
<table class=\"table table-bordered table-striped\" id=\"voucherList\">\n
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID#</th>
|
||||
<th>Voucher No</th>
|
||||
<th>Voucher Date</th>
|
||||
|
||||
<th>Voucher Type</th>
|
||||
<th>Voucher State</th>
|
||||
|
||||
<th class=\"table-col col-2\">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach (\$TableData as \$TableRow) : ?>
|
||||
<?php foreach (\$TableRow as \$cols) : \$id = \$cols;
|
||||
break;
|
||||
endforeach; ?><tr data-id=\"<?php echo \$TableRow->voucher_id; ?>\" class=\"<?php echo(\$TableRow->voucher_state==\"Reversed\")?\"table-danger\":\"\"; ?>\">\n
|
||||
<td><?php echo \$TableRow->voucher_id; ?></td>
|
||||
<td><?php echo \$TableRow->voucher_no; ?></td>
|
||||
|
||||
<td><?php echo \$TableRow->voucher_date; ?></td>
|
||||
|
||||
<td><?php echo \$TableRow->voucher_type; ?></td>
|
||||
<td><?php echo \$TableRow->voucher_state; ?></td>
|
||||
|
||||
<td class=\"col-1\">\n
|
||||
<a onClick=\"javascript:showDetails(<?php echo \$id; ?>);\" class=\"btn btn-success btn-xs\" title=\"View Details\">\n<i class=\"fa fa-eye\">\n</i></a>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php endforeach; ?>
|
||||
<tbody>
|
||||
</table>
|
||||
<div class=\"modal fade\" id=\"voucherdetails_box\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"voucherdetails_box\" aria-hidden=\"true\">\n
|
||||
<div class=\"modal-dialog modal-xl\" role=\"document\">\n
|
||||
<div class=\"modal-content\">\n
|
||||
<div class=\"modal-header\">\n
|
||||
<h5 class=\"modal-title\" id=\"exampleModalLabel\">\nVoucher Details</h5>
|
||||
<button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\">\n
|
||||
<span aria-hidden=\"true\">\n×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class=\"modal-body\" id=\"details_container\">\n
|
||||
Voucher Details Goes Here
|
||||
</div>
|
||||
<div class=\"modal-footer\">\n
|
||||
<button type=\"button\" onClick='reversalEntry()' id=\"reversalBtn\" class=\"btn btn-secondary\" data-dismiss=\"modal\" data-id=\"\">\nRevarsal Entry</button>
|
||||
<button type=\"button\" class=\"btn btn-secondary\" data-dismiss=\"modal\">\nClose</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
function showDetails(id) {
|
||||
\$.ajax({
|
||||
url: \"<?php echo site_url(\"accounts/vouchers/voucherdetails/\"); ?>\" + id,
|
||||
success: function(data) {
|
||||
\$(\"#details_container\").html(data);
|
||||
\$(\"#reversalBtn\").data(\"id\",id);
|
||||
\$(\"#voucherdetails_box\").modal('show');
|
||||
}
|
||||
});
|
||||
}
|
||||
function reversalEntry()
|
||||
{
|
||||
var id=\$(\"#reversalBtn\").data(\"id\");
|
||||
|
||||
if(confirm(\"Are you sure you want to post reversal for this voucher?\"))
|
||||
{
|
||||
window.location=\"<?php echo site_url(\"accounts/vouchers/reversal/\"); ?>\"+id;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
function footerfunctions()
|
||||
{
|
||||
?>
|
||||
<script>
|
||||
\$(document).ready(function() {
|
||||
var table = \$('#voucherList').DataTable();
|
||||
|
||||
var tableRows = \$('table#voucherList tbody').find('tr');
|
||||
tableRows.each(function() {
|
||||
async: false;
|
||||
var jqueryRow = \$(this);
|
||||
var row = table.row(jqueryRow);
|
||||
var id=\$(this).data(\"id\");
|
||||
var Transactions=\"<table class='table table-resonsive'><tr><th>Account<\/th><th>Narration<\/th><th>Dr<\/th><th>Cr<\/th><\/tr><tr><td>Billable Projects<\/td><td>Website Development<\/td><td>50000<\/td><td>0<\/td><\/tr><tr><td>Larke Himal Jadibuti Udhyog<\/td><td>Website Development<\/td><td>0<\/td><td>50000<\/td><\/tr><\/table>\";
|
||||
Transactions=getVoucherDetails(id);
|
||||
row.child(Transactions).show();
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
function getVoucherDetails(id) {
|
||||
\$.data;
|
||||
\$.ajax({
|
||||
url: \"<?php echo site_url(\"ajax/getVoucherDetailsTable/\"); ?>\" + id,
|
||||
async: false,
|
||||
success: function(data) {
|
||||
\$.data=data;
|
||||
}
|
||||
});
|
||||
return (\$.data);
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
?>";
|
||||
file_put_contents($filename, $ListFileContent);
|
||||
}
|
||||
}
|
11
account/application/controllers/index.html
Normal file
11
account/application/controllers/index.html
Normal file
@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
73
account/application/controllers/inventory/Itemcategories.php
Normal file
73
account/application/controllers/inventory/Itemcategories.php
Normal file
@ -0,0 +1,73 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
class Itemcategories extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
checkLogin();
|
||||
}
|
||||
public function _remap($alias = "", $params = array())
|
||||
{
|
||||
|
||||
$data['dataValue'] = $this->session;
|
||||
|
||||
$data['pageTitle'] = "Item Categories";
|
||||
|
||||
switch ($alias) {
|
||||
case 'add':
|
||||
if (isset($_POST['submit'])) {
|
||||
$TableData = array(
|
||||
'units_id' => filter_var($_POST['units_id']),
|
||||
'title' => filter_var($_POST['title']),
|
||||
'description' => filter_var($_POST['description']),
|
||||
'display_order' => filter_var($_POST['display_order']),
|
||||
'status' => 1,
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
);
|
||||
$this->db->insert('tbl_itemcategories', $TableData);
|
||||
redirect("inventory/itemcategories/list");
|
||||
}
|
||||
loadView("inventory/itemcategories/add", $data);
|
||||
break;
|
||||
case 'edit':
|
||||
if (isset($_POST['submit'])) {
|
||||
$id = $this->uri->segment(4);
|
||||
$TableData = array(
|
||||
'units_id' => filter_var($_POST['units_id']),
|
||||
'title' => filter_var($_POST['title']),
|
||||
'description' => filter_var($_POST['description']),
|
||||
'display_order' => filter_var($_POST['display_order']),
|
||||
'status' => 1,
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
);
|
||||
$this->db->where('itemcategory_id', $id);
|
||||
$this->db->update('tbl_itemcategories', $TableData);
|
||||
redirect("inventory/itemcategories/list");
|
||||
}
|
||||
$id = $this->uri->segment(4);
|
||||
$this->db->where('itemcategory_id', $id);
|
||||
$data['itemcategory']=$this->db->get("tbl_itemcategories")->row();
|
||||
loadView("inventory/itemcategories/add", $data);
|
||||
break;
|
||||
case 'delete':
|
||||
$id = $this->uri->segment(4);
|
||||
if (!$this->myaccounts->hasTransaction("itemcategory", $id)) {
|
||||
$this->db->where('itemcategory_id', $id);
|
||||
$this->db->delete('tbl_itemcategories');
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "Transaction Exists!!! Can't Delete";die;
|
||||
}
|
||||
redirect("inventory/itemcategories/list");
|
||||
break;
|
||||
default:
|
||||
loadView("inventory/itemcategories/list", $data);
|
||||
}
|
||||
}
|
||||
}
|
99
account/application/controllers/inventory/Items.php
Normal file
99
account/application/controllers/inventory/Items.php
Normal file
@ -0,0 +1,99 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
class Items extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model("MStocks");
|
||||
checkLogin();
|
||||
}
|
||||
public function _remap($alias = "", $params = array())
|
||||
{
|
||||
|
||||
$data['dataValue'] = $this->session;
|
||||
|
||||
$data['pageTitle'] = "Inventory Items";
|
||||
$TableData = $this->db->where('status', 1);
|
||||
$TableData = $this->db->get('tbl_items')->result();
|
||||
foreach ($TableData as $TableRow) {
|
||||
$TableRow->Stock = $this->MStocks->getOpeningStock($TableRow->item_id);
|
||||
}
|
||||
$data['TableData'] = $TableData;
|
||||
switch ($alias) {
|
||||
case 'add':
|
||||
if (isset($_POST['submit'])) {
|
||||
$TableData = array(
|
||||
'itemcategories_id' => filter_var($_POST['itemcategories_id']),
|
||||
'item_code' => filter_var($_POST['item_code']),
|
||||
'title' => filter_var($_POST['title']),
|
||||
'description' => filter_var($_POST['description']),
|
||||
'units_id' => filter_var($_POST['units_id']),
|
||||
'status' => 1,
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
);
|
||||
$this->db->insert('tbl_items', $TableData);
|
||||
$item_id = $this->db->insert_id();
|
||||
$id = $item_id;
|
||||
$qty = $_POST['opening_stock'];
|
||||
$rate = $_POST['opening_stock_rate'];
|
||||
$this->MStocks->addOpeningStock($id, $qty, $rate);
|
||||
redirect("inventory/items/list");
|
||||
}
|
||||
loadView("inventory/items/add", $data);
|
||||
break;
|
||||
case 'edit':
|
||||
if (isset($_POST['submit'])) {
|
||||
$id = $this->uri->segment(4);
|
||||
$TableData = array(
|
||||
'itemcategories_id' => filter_var($_POST['itemcategories_id']),
|
||||
'item_code' => filter_var($_POST['item_code']),
|
||||
'title' => filter_var($_POST['title']),
|
||||
'description' => filter_var($_POST['description']),
|
||||
'units_id' => filter_var($_POST['units_id']),
|
||||
'status' => 1,
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
);
|
||||
$this->db->where('item_id', $id);
|
||||
$this->db->update('tbl_items', $TableData);
|
||||
$qty = $_POST['opening_stock'];
|
||||
$rate = $_POST['opening_stock_rate'];
|
||||
$this->MStocks->updateOpeningStock($id, $qty, $rate);
|
||||
redirect("inventory/items/list");
|
||||
}
|
||||
$id = $this->uri->segment(4);
|
||||
$this->db->where('item_id', $id);
|
||||
$item = $this->db->get("tbl_items")->row();
|
||||
$Stock = new stdClass;
|
||||
$stockVal = $this->MStocks->getOpeningStock($id);
|
||||
$Stock->opening_stock = $stockVal->qty;
|
||||
$Stock->opening_stock_rate = $stockVal->rate;
|
||||
$Stock->opening_stock_amount = $stockVal->amount;
|
||||
|
||||
$item->Stock = $Stock;
|
||||
$data['item'] = $item;
|
||||
loadView("inventory/items/list", $data);
|
||||
break;
|
||||
case 'delete':
|
||||
$id = $this->uri->segment(4);
|
||||
if (!$this->myaccounts->hasTransaction("items", $id)) {
|
||||
if ($this->MStocks->isDeleteable($id)) {
|
||||
$this->db->where('item_id', $id);
|
||||
$this->db->delete('tbl_items');
|
||||
$this->MStocks->deleteOpeningStock($id);
|
||||
}
|
||||
} else {
|
||||
echo "Transaction Exists!!! Can't Delete";
|
||||
die;
|
||||
}
|
||||
|
||||
redirect("inventory/items/list");
|
||||
break;
|
||||
default:
|
||||
|
||||
loadView("inventory/items/list", $data);
|
||||
}
|
||||
}
|
||||
}
|
65
account/application/controllers/inventory/Paymentmodes.php
Normal file
65
account/application/controllers/inventory/Paymentmodes.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
class Paymentmodes extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
checkLogin();
|
||||
}
|
||||
public function _remap($alias = "", $params = array())
|
||||
{
|
||||
|
||||
$data['dataValue'] = $this->session;
|
||||
|
||||
$data['pageTitle'] = "Payment Modes";
|
||||
|
||||
switch ($alias) {
|
||||
case 'add':
|
||||
if (isset($_POST['submit'])) {
|
||||
$TableData = array(
|
||||
'title' => filter_var($_POST['title']),
|
||||
'description' => filter_var($_POST['description']),
|
||||
'display_order' => filter_var($_POST['display_order']),
|
||||
'status' => 1,
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
);
|
||||
$this->db->insert('tbl_paymentmodes', $TableData);
|
||||
redirect("inventory/paymentmodes");
|
||||
}
|
||||
loadView("inventory/paymentmodes/add", $data);
|
||||
break;
|
||||
case 'edit':
|
||||
if (isset($_POST['submit'])) {
|
||||
$id = $this->uri->segment(4);
|
||||
$TableData = array(
|
||||
'title' => filter_var($_POST['title']),
|
||||
'description' => filter_var($_POST['description']),
|
||||
'display_order' => filter_var($_POST['display_order']),
|
||||
'status' => 1,
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
);
|
||||
$this->db->where('paymentmode_id', $id);
|
||||
$this->db->update('tbl_paymentmodes', $TableData);
|
||||
redirect("inventory/paymentmodes");
|
||||
}
|
||||
$id = $this->uri->segment(4);
|
||||
$this->db->where('paymentmode_id', $id);
|
||||
$data['paymentmode'] = $this->db->get("tbl_paymentmodes")->row();
|
||||
loadView("inventory/paymentmodes/add", $data);
|
||||
break;
|
||||
case 'delete':
|
||||
$id = $this->uri->segment(4);
|
||||
$this->db->where('paymentmode_id', $id);
|
||||
$this->db->delete('tbl_paymentmodes');
|
||||
redirect("inventory/paymentmodes");
|
||||
break;
|
||||
default:
|
||||
loadView("inventory/paymentmodes/list", $data);
|
||||
}
|
||||
}
|
||||
}
|
98
account/application/controllers/inventory/Purchases.php
Normal file
98
account/application/controllers/inventory/Purchases.php
Normal file
@ -0,0 +1,98 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
class Purchases extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('MStocks');
|
||||
$this->load->model('MPurchases');
|
||||
checkLogin();
|
||||
}
|
||||
public function _remap($alias = "", $params = array())
|
||||
{
|
||||
|
||||
$data['dataValue'] = $this->session;
|
||||
|
||||
$data['pageTitle'] = "Purchase";
|
||||
|
||||
switch ($alias) {
|
||||
case 'details':
|
||||
$id = $this->uri->segment(4);
|
||||
$this->db->where('purchase_id', $id);
|
||||
$data['Purchase'] = $this->db->get("tbl_purchases")->row();
|
||||
$this->db->where('purchases_id', $id);
|
||||
$data['PurchaseDetails'] = $this->db->get("tbl_purchasedetails")->result();
|
||||
$data['pageTitle'] = "View Purchase";
|
||||
loadView("inventory/purchases/view", $data);
|
||||
break;
|
||||
case 'create':
|
||||
// print_r($_POST);die;
|
||||
if (isset($_POST['accounts_id'])) {
|
||||
$TableData = array(
|
||||
'transaction_type' => "Purchase Entry",
|
||||
'accounts_id' => filter_var($_POST['accounts_id']),
|
||||
'purchase_date' => filter_var($_POST['purchase_date']),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
'remarks' => '',
|
||||
'status' => 1,
|
||||
);
|
||||
$this->db->insert('tbl_purchases', $TableData);
|
||||
$purchase_id = $this->db->insert_id();
|
||||
$a = 0;
|
||||
foreach ($_POST['item_id'] as $item) {
|
||||
$TableData = array(
|
||||
'purchases_id' => $purchase_id,
|
||||
'items_id' => $item,
|
||||
'qty' => $_POST['quantity'][$a],
|
||||
'rate' => $_POST['rate'][$a],
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
'remarks' => '',
|
||||
'status' => 1,
|
||||
);
|
||||
$this->db->insert('tbl_purchasedetails', $TableData);
|
||||
$a += 1;
|
||||
}
|
||||
$this->MStocks->addPurchaseToStock($this->db->where("purchases_id", $purchase_id)->get("tbl_purchasedetails")->result());
|
||||
redirect("inventory/purchases/list");
|
||||
}
|
||||
break;
|
||||
case 'add':
|
||||
//
|
||||
if (isset($_POST['submit'])) {
|
||||
$TableData = array(
|
||||
'transaction_type' => filter_var($_POST['transaction_type']),
|
||||
'accounts_id' => filter_var($_POST['accounts_id']),
|
||||
'purchase_date' => filter_var($_POST['purchase_date']),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
'status' => 1,
|
||||
);
|
||||
pre($_POST);
|
||||
die;
|
||||
//$this->db->insert('tbl_purchases', $TableData);
|
||||
redirect("inventory/purchases/list");
|
||||
}
|
||||
loadView("inventory/purchases/create", $data);
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
$id = $this->uri->segment(4);
|
||||
$this->db->where('purchase_id', $id);
|
||||
$this->db->delete('tbl_purchases');
|
||||
$this->db->where('purchases_id', $id);
|
||||
$this->db->delete('tbl_purchasedetails');
|
||||
redirect("inventory/purchases/list");
|
||||
break;
|
||||
case 'purchase_register':
|
||||
$data['PurchaseRecords'] = $this->MPurchases->getPurchaseRecords();
|
||||
loadView("inventory/purchases/register", $data);
|
||||
default:
|
||||
$data['PurchaseRecords'] = $this->MPurchases->getPurchaseRecords();
|
||||
loadView("inventory/purchases/list", $data);
|
||||
}
|
||||
}
|
||||
}
|
27
account/application/controllers/inventory/Reports.php
Normal file
27
account/application/controllers/inventory/Reports.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
class Reports extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('MStocks');
|
||||
$this->load->model('MSales');
|
||||
$this->load->model('MPurchases');
|
||||
checkLogin();
|
||||
}
|
||||
public function _remap($alias = "", $params = array())
|
||||
{
|
||||
$data['dataValue'] = $this->session;
|
||||
$data['pageTitle'] = "Sales";
|
||||
switch ($alias) {
|
||||
case 'purchase_vs_sales':
|
||||
$data['StockRecords']=$this->MStocks->getStockRecords();
|
||||
$data['PurchaseDetails'] = $this->MPurchases->getItemPurchases();
|
||||
$data['SalesDetails'] = $this->MSales->getItemSales();
|
||||
loadview("inventory/reports/purchase_vs_sales", $data);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
}
|
103
account/application/controllers/inventory/Sales.php
Normal file
103
account/application/controllers/inventory/Sales.php
Normal file
@ -0,0 +1,103 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
class Sales extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('MStocks');
|
||||
$this->load->model('MSales');
|
||||
checkLogin();
|
||||
}
|
||||
public function _remap($alias = "", $params = array())
|
||||
{
|
||||
$data['dataValue'] = $this->session;
|
||||
$data['pageTitle'] = "Sales";
|
||||
switch ($alias) {
|
||||
case 'create':
|
||||
$data['items'] = $this->MStocks->getSellableItems();
|
||||
loadView("inventory/sales/create", $data);
|
||||
break;
|
||||
case 'store':
|
||||
|
||||
// print_r(filter_var($_POST['salesDate']));die;
|
||||
if (isset($_POST['accounts_id'])) {
|
||||
$TableData = array(
|
||||
'transaction_type' => "Sales Entry",
|
||||
'accounts_id' => filter_var($_POST['accounts_id']),
|
||||
'sales_date' => filter_var($_POST['salesDate']),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
'remarks' => '',
|
||||
'status' => 1,
|
||||
);
|
||||
$this->db->insert('tbl_sales', $TableData);
|
||||
$sales_id = $this->db->insert_id();
|
||||
$i = 0;
|
||||
// print_r($_POST);die;
|
||||
|
||||
foreach ($_POST['item_id'] as $item) {
|
||||
if ($item != 0 || $_POST['qty'][$i] != 0 || $_POST['rate'][$i] != 0) :
|
||||
$TableData = array(
|
||||
'sales_id' => $sales_id,
|
||||
'items_id' => $item,
|
||||
'qty' => $_POST['qty'][$i],
|
||||
'rate' => $_POST['rate'][$i],
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
'status' => 1,
|
||||
);
|
||||
$i += 1;
|
||||
$this->db->insert('tbl_salesdetails', $TableData);
|
||||
endif;
|
||||
}
|
||||
}
|
||||
// print_r($TableData);
|
||||
// die;
|
||||
|
||||
// $this->db->where('sales_id', $sales_id);
|
||||
$this->MStocks->addSalesToStock($this->db->where('sales_id', $sales_id)->get('tbl_salesdetails')->result());
|
||||
redirect("inventory/sales/list");
|
||||
break;
|
||||
case 'sales_register':
|
||||
$data['SalesRecords'] = $this->MSales->getSalesRecords();
|
||||
loadView("inventory/sales/register", $data);
|
||||
break;
|
||||
case 'details':
|
||||
$id = $this->uri->segment(4);
|
||||
$data['Sales'] = $this->db->where('sales_id', $id)->get("tbl_sales")->row();
|
||||
$data['SalesDetails'] = $this->db->where('sales_id', $id)->get('tbl_salesdetails')->result();
|
||||
loadView("inventory/sales/view", $data);
|
||||
break;
|
||||
case 'edit':
|
||||
if (isset($_POST['submit'])) {
|
||||
$id = $this->uri->segment(4);
|
||||
$TableData = array(
|
||||
'transaction_type' => filter_var($_POST['transaction_type']),
|
||||
'accounts_id' => filter_var($_POST['accounts_id']),
|
||||
'sales_date' => filter_var($_POST['sales_date']),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
'status' => 1,
|
||||
);
|
||||
$this->db->where('sales_id', $id);
|
||||
$this->db->update('tbl_sales', $TableData);
|
||||
redirect("inventory/sales/list");
|
||||
}
|
||||
loadView("inventory/sales/edit", $data);
|
||||
break;
|
||||
case 'delete':
|
||||
$id = $this->uri->segment(4);
|
||||
$this->db->where('sales_id', $id);
|
||||
$this->db->delete('tbl_sales');
|
||||
$this->db->where('sales_id', $id);
|
||||
$this->db->delete('tbl_salesdetails');
|
||||
redirect("inventory/sales/list");
|
||||
break;
|
||||
default:
|
||||
$data['SalesRecords'] = $this->MSales->getSalesRecords();
|
||||
loadView("inventory/sales/list", $data);
|
||||
}
|
||||
}
|
||||
}
|
68
account/application/controllers/inventory/Stocklocations.php
Normal file
68
account/application/controllers/inventory/Stocklocations.php
Normal file
@ -0,0 +1,68 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
class Stocklocations extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
checkLogin();
|
||||
}
|
||||
public function _remap($alias = "", $params = array())
|
||||
{
|
||||
|
||||
$data['dataValue'] = $this->session;
|
||||
|
||||
$data['pageTitle'] = "Stock Location";
|
||||
|
||||
switch ($alias) {
|
||||
case 'add':
|
||||
if (isset($_POST['submit'])) {
|
||||
$TableData = array(
|
||||
'title' => filter_var($_POST['title']),
|
||||
'alias' => filter_var($_POST['alias']),
|
||||
'description' => filter_var($_POST['description']),
|
||||
'display_order' => filter_var($_POST['display_order']),
|
||||
'status' => 1,
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
);
|
||||
$this->db->insert('tbl_stocklocations', $TableData);
|
||||
redirect("inventory/stocklocations/list");
|
||||
}
|
||||
loadView("inventory/stocklocations/add", $data);
|
||||
break;
|
||||
case 'edit':
|
||||
if (isset($_POST['submit'])) {
|
||||
$id = $this->uri->segment(4);
|
||||
$TableData = array(
|
||||
'title' => filter_var($_POST['title']),
|
||||
'alias' => filter_var($_POST['alias']),
|
||||
'description' => filter_var($_POST['description']),
|
||||
'display_order' => filter_var($_POST['display_order']),
|
||||
'status' => 1,
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
);
|
||||
$this->db->where('stocklocation_id', $id);
|
||||
$this->db->update('tbl_stocklocations', $TableData);
|
||||
redirect("inventory/stocklocations/list");
|
||||
}
|
||||
$id = $this->uri->segment(4);
|
||||
$this->db->where('stocklocation_id', $id);
|
||||
$data['stockLocation'] = $this->db->get("tbl_stocklocations")->row();
|
||||
loadView("inventory/stocklocations/add", $data);
|
||||
break;
|
||||
case 'delete':
|
||||
$id = $this->uri->segment(4);
|
||||
$this->db->where('stocklocation_id', $id);
|
||||
$this->db->delete('tbl_stocklocations');
|
||||
redirect("inventory/stocklocations/list");
|
||||
break;
|
||||
default:
|
||||
|
||||
loadView("inventory/stocklocations/list", $data);
|
||||
}
|
||||
}
|
||||
}
|
75
account/application/controllers/inventory/Stocks.php
Normal file
75
account/application/controllers/inventory/Stocks.php
Normal file
@ -0,0 +1,75 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
class Stocks extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('MStocks');
|
||||
checkLogin();
|
||||
}
|
||||
public function _remap($alias = "", $params = array())
|
||||
{
|
||||
$data['dataValue'] = $this->session;
|
||||
$data['pageTitle'] = "Inventory Stock";
|
||||
switch ($alias) {
|
||||
case 'add':
|
||||
if (isset($_POST['submit'])) {
|
||||
$TableData = array(
|
||||
'stocklocations_id' => filter_var($_POST['stocklocations_id']),
|
||||
'title' => filter_var($_POST['title']),
|
||||
'items_id' => filter_var($_POST['items_id']),
|
||||
'qty' => filter_var($_POST['qty']),
|
||||
'price' => filter_var($_POST['price']),
|
||||
'display_order' => filter_var($_POST['display_order']),
|
||||
'status' => 1,
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
);
|
||||
$this->db->insert('tbl_stocks', $TableData);
|
||||
redirect("inventory/stocks/list");
|
||||
}
|
||||
loadView("inventory/stocks/add", $data);
|
||||
break;
|
||||
case 'edit':
|
||||
if (isset($_POST['submit'])) {
|
||||
$id = $this->uri->segment(4);
|
||||
$TableData = array(
|
||||
'stocklocations_id' => filter_var($_POST['stocklocations_id']),
|
||||
'title' => filter_var($_POST['title']),
|
||||
'items_id' => filter_var($_POST['items_id']),
|
||||
'qty' => filter_var($_POST['qty']),
|
||||
'price' => filter_var($_POST['price']),
|
||||
'display_order' => filter_var($_POST['display_order']),
|
||||
'status' => 1,
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
);
|
||||
$this->db->where('stock_id', $id);
|
||||
$this->db->update('tbl_stocks', $TableData);
|
||||
redirect("inventory/stocks/list");
|
||||
}
|
||||
$id = $this->uri->segment(4);
|
||||
$this->db->where('stock_id', $id);
|
||||
$data['stock'] = $this->db->get("tbl_stocks")->row();
|
||||
loadView("inventory/stocks/add", $data);
|
||||
break;
|
||||
case 'summary':
|
||||
$data['StockRecords'] = $this->MStocks->getStockSummary();
|
||||
// pre($data['StockRecords']);
|
||||
loadView("inventory/stocks/summary", $data);
|
||||
break;
|
||||
case 'delete':
|
||||
$id = $this->uri->segment(4);
|
||||
$this->db->where('stock_id', $id);
|
||||
$this->db->delete('tbl_stocks');
|
||||
redirect("inventory/stocks/list");
|
||||
break;
|
||||
default:
|
||||
$data['StockRecords'] = $this->MStocks->getStockRecords();
|
||||
loadView("inventory/stocks/list", $data);
|
||||
}
|
||||
}
|
||||
}
|
73
account/application/controllers/inventory/Units.php
Normal file
73
account/application/controllers/inventory/Units.php
Normal file
@ -0,0 +1,73 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
class Units extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
checkLogin();
|
||||
}
|
||||
public function _remap($alias = "", $params = array())
|
||||
{
|
||||
|
||||
$data['dataValue'] = $this->session;
|
||||
|
||||
$data['pageTitle'] = "Master - Units";
|
||||
|
||||
switch ($alias) {
|
||||
case 'add':
|
||||
if (isset($_POST['submit'])) {
|
||||
$TableData = array(
|
||||
'title' => filter_var($_POST['title']),
|
||||
'alias' => filter_var($_POST['alias']),
|
||||
'description' => filter_var($_POST['description']),
|
||||
'display_order' => filter_var($_POST['display_order']),
|
||||
'status' => 1,
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
);
|
||||
$this->db->insert('tbl_units', $TableData);
|
||||
redirect("inventory/units/list");
|
||||
}
|
||||
loadView("inventory/units/add", $data);
|
||||
break;
|
||||
case 'edit':
|
||||
if (isset($_POST['submit'])) {
|
||||
$id = $this->uri->segment(4);
|
||||
$TableData = array(
|
||||
'title' => filter_var($_POST['title']),
|
||||
'alias' => filter_var($_POST['alias']),
|
||||
'description' => filter_var($_POST['description']),
|
||||
'display_order' => filter_var($_POST['display_order']),
|
||||
'status' => 1,
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
);
|
||||
$this->db->where('unit_id', $id);
|
||||
$this->db->update('tbl_units', $TableData);
|
||||
redirect("inventory/units/list");
|
||||
}
|
||||
$id = $this->uri->segment(4);
|
||||
$this->db->where('unit_id', $id);
|
||||
$data['unit'] = $this->db->get("tbl_units")->row();
|
||||
loadView("inventory/units/add", $data);
|
||||
break;
|
||||
case 'delete':
|
||||
$id = $this->uri->segment(4);
|
||||
if (!$this->myaccounts->hasTransaction("units", $id)) {
|
||||
$this->db->where('unit_id', $id);
|
||||
$this->db->delete('tbl_units');
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "Transaction Exists!!! Can't Delete";die;
|
||||
}
|
||||
redirect("inventory/units/list");
|
||||
break;
|
||||
default:
|
||||
loadView("inventory/units/list", $data);
|
||||
}
|
||||
}
|
||||
}
|
177
account/application/controllers/master/Accategories.php
Normal file
177
account/application/controllers/master/Accategories.php
Normal file
@ -0,0 +1,177 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
class Accategories extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->helper("accounts");
|
||||
checkLogin();
|
||||
}
|
||||
public function _remap($alias = "", $params = array())
|
||||
{
|
||||
$data['dataValue'] = $this->session;
|
||||
$q = "SELECT COUNT(*) as num FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'tbl_accategories' AND COLUMN_NAME = 'parent_category_id'";
|
||||
$n = $this->db->query($q)->row()->num;
|
||||
if ($n == 0) {
|
||||
$q = "ALTER TABLE tbl_accategories ADD COLUMN parent_category_id INT(1) NOT NULL DEFAULT 0";
|
||||
$this->db->query($q);
|
||||
}
|
||||
//echo $n;die;
|
||||
|
||||
$data['pageTitle'] = "Account Categories";
|
||||
|
||||
switch ($alias) {
|
||||
case 'add':
|
||||
if (isset($_POST['submit'])) {
|
||||
$TableData = array(
|
||||
'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']),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
'status' => 1,
|
||||
);
|
||||
$this->db->insert('tbl_accategories', $TableData);
|
||||
redirect("master/accategories/list");
|
||||
}
|
||||
loadView("accounts/accategories/add", $data);
|
||||
break;
|
||||
case 'add_parent':
|
||||
if (isset($_POST['submit'])) {
|
||||
if (!$this->checkifCategoryExists(trim($_POST['accategory_name']))) {
|
||||
$TableData = array(
|
||||
'acgroup_id' => filter_var($_POST['acgroup_id']),
|
||||
'accategory_code' => generateACCategoryCode($_POST['acgroup_id']),
|
||||
'parent_category_id' => 0,
|
||||
'accategory_name' => filter_var($_POST['accategory_name']),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
'status' => 1,
|
||||
);
|
||||
$this->db->insert('tbl_accategories', $TableData);
|
||||
redirect("master/accategories/parent");
|
||||
} else {
|
||||
echo "CATEGORY ALREADY EXISTS";
|
||||
die;
|
||||
}
|
||||
}
|
||||
loadView("accounts/accategories/add-parent", $data);
|
||||
break;
|
||||
case 'add_child':
|
||||
if (isset($_POST['submit'])) {
|
||||
// print_r($_POST);
|
||||
// die();
|
||||
if (!$this->checkifCategoryExists(trim($_POST['accategory_name']))) {
|
||||
$TableData = array(
|
||||
'parent_category_id' => filter_var($_POST['parent_category_id']),
|
||||
'acgroup_id' => filter_var(getFieldfromValue("tbl_accategories", "acgroup_id", "accategory_id", $_POST['parent_category_id'])),
|
||||
'accategory_code' => generateACCategoryCode($_POST['acgroup_id']),
|
||||
'accategory_name' => filter_var($_POST['accategory_name']),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
'status' => 1,
|
||||
);
|
||||
$this->db->insert('tbl_accategories', $TableData);
|
||||
redirect("master/accategories/childs");
|
||||
} else {
|
||||
echo "CATEGORY ALREADY EXISTS";
|
||||
die;
|
||||
}
|
||||
}
|
||||
loadView("accounts/accategories/add-child", $data);
|
||||
break;
|
||||
case 'edit':
|
||||
$id = $this->uri->segment(4);
|
||||
|
||||
if (isset($_POST['submit'])) {
|
||||
|
||||
$TableData = array(
|
||||
'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']),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
'status' => 1,
|
||||
);
|
||||
$this->db->where('accategory_id', $id);
|
||||
$this->db->update('tbl_accategories', $TableData);
|
||||
redirect("master/accategories");
|
||||
}
|
||||
$data['AccountCategory'] = $this->db->query("select * from tbl_accategories where accategory_id =\"$id\" ")->row();
|
||||
loadView("accounts/accategories/edit", $data);
|
||||
break;
|
||||
case 'edit_parents':
|
||||
$id = $this->uri->segment(4);
|
||||
$data['pageTitle'] = "Edit Category";
|
||||
|
||||
if (isset($_POST['submit'])) {
|
||||
|
||||
$TableData = array(
|
||||
'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']),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
'status' => 1,
|
||||
);
|
||||
$this->db->where('accategory_id', $id);
|
||||
$this->db->update('tbl_accategories', $TableData);
|
||||
redirect("master/accategories/parent");
|
||||
}
|
||||
$data['AccountCategory'] = $this->db->query("select * from tbl_accategories where accategory_id =\"$id\" ")->row();
|
||||
loadView("accounts/accategories/edit-parents", $data);
|
||||
break;
|
||||
case 'delete':
|
||||
$id = $this->uri->segment(4);
|
||||
if (!$this->myaccounts->hasTransaction("accategory", $id)) {
|
||||
$this->db->set('status', "-1");
|
||||
$this->db->set('remarks', "Deleted on" . date("Y-m-d H:i:s") . " by " . $this->session->userdata("loggedUser"));
|
||||
$this->db->where('accategory_id', $id);
|
||||
$this->db->update('tbl_accategories');
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "Transaction Exists!!! Can't Delete";die;
|
||||
}
|
||||
redirect("master/accategories/childs");
|
||||
break;
|
||||
case 'delete_parent':
|
||||
$id = $this->uri->segment(4);
|
||||
$this->db->set('status', "-1");
|
||||
$this->db->set('remarks', "Deleted on" . date("Y-m-d H:i:s") . " by " . $this->session->userdata("loggedUser"));
|
||||
$this->db->where('accategory_id', $id);
|
||||
$this->db->update('tbl_accategories');
|
||||
redirect("master/accategories/parent");
|
||||
break;
|
||||
case 'parent':
|
||||
$data['pageTitle'] = "Account Categories";
|
||||
$data['ACCategories'] = $this->myaccounts->getAccountCategories();
|
||||
loadView("accounts/accategories/list-parents-only", $data);
|
||||
break;
|
||||
case 'childs':
|
||||
$data['pageTitle'] = "Account Groups";
|
||||
|
||||
// $data['ACCategories'] = $this->db->query("select *, (select accategory_name from tbl_accategories as a where a.parent_category_id=b.accategory_id) as parent_category, (select acgroup_name from tbl_acgroups where tbl_acgroups.acgroup_id=b.acgroup_id) as acgroup_name from tbl_accategories as b where status=1")->result();
|
||||
$data['ACCategories'] = $this->myaccounts->getAccountCategories();
|
||||
loadView("accounts/accategories/list-childs-only", $data);
|
||||
break;
|
||||
default:
|
||||
$data['pageTitle'] = "Account Categories";
|
||||
$data['ACCategories'] = $this->myaccounts->getAccountCategories();
|
||||
loadView("accounts/accategories/list-parents-only", $data);
|
||||
}
|
||||
}
|
||||
function checkifCategoryExists($accategory_name)
|
||||
{
|
||||
return ($this->db->query("select * from tbl_accategories where UPPER(accategory_name)='" . strtoupper($accategory_name) . "'")->num_rows() > 0) ? true : false;
|
||||
}
|
||||
}
|
63
account/application/controllers/master/Acgroups.php
Normal file
63
account/application/controllers/master/Acgroups.php
Normal file
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
class Acgroups extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
checkLogin();
|
||||
}
|
||||
public function _remap($alias = "", $params = array())
|
||||
{
|
||||
|
||||
$data['dataValue'] = $this->session;
|
||||
|
||||
$data['pageTitle'] = "Account Types";
|
||||
|
||||
switch ($alias) {
|
||||
case 'add':
|
||||
if (isset($_POST['submit'])) {
|
||||
$TableData = array(
|
||||
'acgroup_code' => filter_var($_POST['acgroup_code']),
|
||||
'acgroup_name' => filter_var($_POST['acgroup_name']),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
'status' => 1,
|
||||
'display_order' => filter_var($_POST['display_order']),
|
||||
);
|
||||
$this->db->insert('tbl_acgroups', $TableData);
|
||||
redirect("master/acgroups");
|
||||
}
|
||||
loadView("acgroups/add", $data);
|
||||
break;
|
||||
case 'edit':
|
||||
if (isset($_POST['submit'])) {
|
||||
$id = $this->uri->segment(4);
|
||||
$TableData = array(
|
||||
'acgroup_code' => filter_var($_POST['acgroup_code']),
|
||||
'acgroup_name' => filter_var($_POST['acgroup_name']),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
'status' => 1,
|
||||
'display_order' => filter_var($_POST['display_order']),
|
||||
);
|
||||
$this->db->where('acgroup_id', $id);
|
||||
$this->db->update('tbl_acgroups', $TableData);
|
||||
redirect("master/acgroups");
|
||||
}
|
||||
loadView("acgroups/edit", $data);
|
||||
break;
|
||||
case 'delete':
|
||||
$id = $this->uri->segment(4);
|
||||
$this->db->where('acgroup_id', $id);
|
||||
$this->db->where('acgroup_id not in (select acgroup_id from tbl_accategories)');
|
||||
$this->db->delete('tbl_acgroups');
|
||||
redirect("master/acgroups");
|
||||
break;
|
||||
default:
|
||||
loadView("acgroups/list", $data);
|
||||
}
|
||||
}
|
||||
}
|
96
account/application/controllers/master/Branches.php
Normal file
96
account/application/controllers/master/Branches.php
Normal file
@ -0,0 +1,96 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class Branches extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
checkLogin();
|
||||
}
|
||||
public function _remap($alias)
|
||||
{
|
||||
$data['dataValue'] = $this->session;
|
||||
|
||||
$data['pageTitle'] = "Company";
|
||||
|
||||
switch ($alias) {
|
||||
case 'add':
|
||||
if (isset($_POST['submit'])) {
|
||||
$TableData = array(
|
||||
'branch_name' => filter_var($_POST['branch_name'], FILTER_SANITIZE_STRING),
|
||||
'branch_alias' => getalias($_POST['branch_name'], 'branch_alias', 'tbl_branches'),
|
||||
'branch_address' => filter_var($_POST['branch_address'], FILTER_SANITIZE_STRING),
|
||||
'vat' => $_POST['vat'],
|
||||
'pan' => $_POST['pan'],
|
||||
'created_by' => 'admin',
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'remarks' => filter_var($_POST['remarks'], FILTER_SANITIZE_STRING),
|
||||
'status' => 1,
|
||||
);
|
||||
$this->db->insert('tbl_branches', $TableData);
|
||||
redirect("master/branches");
|
||||
}
|
||||
$data['editable'] = 0;
|
||||
loadView("setup/addbranches", $data);
|
||||
break;
|
||||
case 'edit':
|
||||
$id = $this->uri->segment(4);
|
||||
if (isset($_POST['submit'])) {
|
||||
$TableData = array(
|
||||
'branch_name' => filter_var($_POST['branch_name'], FILTER_SANITIZE_STRING),
|
||||
'branch_alias' => getalias($_POST['branch_name'], 'branch_alias', 'tbl_branches'),
|
||||
'branch_address' => filter_var($_POST['branch_address'], FILTER_SANITIZE_STRING),
|
||||
'vat' => $_POST['vat'],
|
||||
'pan' => $_POST['pan'],
|
||||
'created_by' => 'admin',
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'remarks' => filter_var($_POST['remarks'], FILTER_SANITIZE_STRING),
|
||||
'status' => 1,
|
||||
);
|
||||
$this->db->where('branch_id', $id);
|
||||
$this->db->update('tbl_branches', $TableData);
|
||||
redirect("master/branches");
|
||||
}
|
||||
|
||||
$data['editable'] = 1;
|
||||
$data['branchData'] = $this->db->where("branch_id", $id)->get("tbl_branches")->row();
|
||||
loadView("setup/addbranches", $data);
|
||||
break;
|
||||
case 'select':
|
||||
$id = $this->uri->segment(4);
|
||||
$this->db->where('branch_id<>', $id);
|
||||
$this->db->update('tbl_branches', ['status' => 0]);
|
||||
|
||||
$this->db->where('branch_id', $id);
|
||||
$this->db->update('tbl_branches', ['status' => 1]);
|
||||
redirect("master/branches");
|
||||
break;
|
||||
case 'delete':
|
||||
$id = $this->uri->segment(4);
|
||||
if (!$this->myaccounts->hasTransaction('branch', $id)) {
|
||||
$this->db->where('branch_id', $id);
|
||||
$this->db->delete('tbl_branches');
|
||||
redirect("master/branches");
|
||||
} else {
|
||||
echo "Can't Delete!! Transaction Exitis";
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case 'list':
|
||||
if (isset($_POST['branch'])) {
|
||||
$this->db->where('branch_id!=', $_POST['branch']);
|
||||
$this->db->update('tbl_branches', ["status" => 0]);
|
||||
$this->db->where('branch_id', $_POST['branch']);
|
||||
$this->db->update('tbl_branches', ["status" => 1]);
|
||||
redirect("logout");
|
||||
}
|
||||
// loadView("setup/selectbranch", $data);
|
||||
loadView("setup/listbranches", $data);
|
||||
break;
|
||||
default:
|
||||
loadView("setup/listbranches", $data);
|
||||
}
|
||||
}
|
||||
}
|
95
account/application/controllers/master/Fiscalyear.php
Normal file
95
account/application/controllers/master/Fiscalyear.php
Normal file
@ -0,0 +1,95 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
class Fiscalyear extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
checkLogin();
|
||||
}
|
||||
public function _remap($alias = "", $params = array())
|
||||
{
|
||||
$data['dataValue'] = $this->session;
|
||||
$data['pageTitle'] = "Fiscal Year";
|
||||
switch ($alias) {
|
||||
case 'add':
|
||||
if (isset($_POST['submit'])) {
|
||||
$TableData = array(
|
||||
'fiscalyear_code' => filter_var($_POST['fiscalyear_code']),
|
||||
'fiscalyear_year' => filter_var($_POST['fiscalyear_year']),
|
||||
'fiscalyear_from' => NepaliToEnglishDate(filter_var($_POST['fiscalyear_from'])),
|
||||
'fiscalyear_to' => NepaliToEnglishDate(filter_var($_POST['fiscalyear_to'])),
|
||||
'created_by' => 'admin',
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
'status' => 0,
|
||||
);
|
||||
$this->db->insert('tbl_fiscalyear', $TableData);
|
||||
redirect("master/fiscalyear");
|
||||
}
|
||||
loadView("fiscalyear/add", $data);
|
||||
break;
|
||||
case 'edit':
|
||||
if (isset($_POST['submit'])) {
|
||||
$id = $this->uri->segment(4);
|
||||
$TableData = array(
|
||||
'fiscalyear_code' => filter_var($_POST['fiscalyear_code']),
|
||||
'fiscalyear_year' => filter_var($_POST['fiscalyear_year']),
|
||||
'fiscalyear_from' => NepaliToEnglishDate(filter_var($_POST['fiscalyear_from'])),
|
||||
'fiscalyear_to' => NepaliToEnglishDate(filter_var($_POST['fiscalyear_to'])),
|
||||
'created_by' => 'admin',
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
'status' => isset($_POST['status']) ? $_POST['status'] : 1,
|
||||
);
|
||||
$this->db->where('fiscalyear_id', $id);
|
||||
$this->db->update('tbl_fiscalyear', $TableData);
|
||||
redirect("master/fiscalyear");
|
||||
}
|
||||
if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
|
||||
$id = $this->uri->segment(4);
|
||||
// pre($id);
|
||||
$this->db->where('fiscalyear_id', $id);
|
||||
$data['Fiscalyear'] = $this->db->get('tbl_fiscalyear')->row();
|
||||
// pre($data['Fiscalyear']);die;
|
||||
$this->load->view("fiscalyear/ajaxedit", $data);
|
||||
} else {
|
||||
loadView("fiscalyear/edit", $data);
|
||||
}
|
||||
break;
|
||||
case 'delete':
|
||||
$id = $this->uri->segment(4);
|
||||
if (!$this->myaccounts->hasTransaction('fiscalyear', $id)) {
|
||||
$this->db->set('status', -1);
|
||||
$this->db->set('remarks', "Deleted on " . date("Y-m-d H:i:s") . " by " . $this->session->userdata("loggedUser"));
|
||||
$this->db->where('fiscalyear_id', $id);
|
||||
$this->db->update('tbl_fiscalyear');
|
||||
redirect("master/fiscalyear");
|
||||
} else {
|
||||
$response = array(
|
||||
'status' => 'failed',
|
||||
'message' => 'Cannot delete fiscal year with associated transactions.'
|
||||
);
|
||||
$title="List of Fiscalyear";
|
||||
$data['pageTitle']=$title;
|
||||
$data['response']= json_encode($response);
|
||||
loadView("fiscalyear/list",$data);
|
||||
// return json_encode($response);
|
||||
}
|
||||
|
||||
break;
|
||||
case 'select':
|
||||
$id = $this->uri->segment(4);
|
||||
$this->db->where('status<>-1');
|
||||
$this->db->set('status', 0);
|
||||
$this->db->update('tbl_fiscalyear');
|
||||
$this->db->set('status', 1);
|
||||
$this->db->where('fiscalyear_id', $id);
|
||||
$this->db->update('tbl_fiscalyear');
|
||||
redirect("logout");
|
||||
break;
|
||||
default:
|
||||
loadView("fiscalyear/list", $data);
|
||||
}
|
||||
}
|
||||
}
|
47
account/application/controllers/master/Importvouchers.php
Normal file
47
account/application/controllers/master/Importvouchers.php
Normal file
@ -0,0 +1,47 @@
|
||||
<?php defined('BASEPATH') or exit('No direct script access allowed');
|
||||
class Importvouchers extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
checkLogin();
|
||||
}
|
||||
function index()
|
||||
{
|
||||
$data['pageTitle'] = "Import Vouchers";
|
||||
$importedData = array();
|
||||
if (isset($_FILES['voucher_list'])) {
|
||||
$filename = $_FILES["voucher_list"]["tmp_name"];
|
||||
if ($_FILES["voucher_list"]["size"] > 0) {
|
||||
$file = fopen($filename, "r");
|
||||
while (($getData = fgetcsv($file, 100000, ",")) !== FALSE) {
|
||||
$importedData[] = $getData;
|
||||
}
|
||||
fclose($file);
|
||||
}
|
||||
$data['importedData'] = $importedData;
|
||||
switch ($_POST['import_type']) {
|
||||
case 'Groups':
|
||||
loadView("accounts/importgroups", $data);
|
||||
break;
|
||||
case 'Categories':
|
||||
loadView("accounts/importcategories", $data);
|
||||
break;
|
||||
case 'Accounts':
|
||||
loadView("accounts/importaccounts", $data);
|
||||
break;
|
||||
case 'Vouchers':
|
||||
loadView("accounts/importvouchers", $data);
|
||||
break;
|
||||
case 'VoucherDetails':
|
||||
loadView("accounts/importvoucherdetails", $data);
|
||||
break;
|
||||
default:
|
||||
//loadView("accounts/importvouchers", $data);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
loadView("accounts/importvouchers", $data);
|
||||
}
|
||||
}
|
||||
}
|
60
account/application/controllers/master/Translations.php
Normal file
60
account/application/controllers/master/Translations.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
class Translations extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
checkLogin();
|
||||
}
|
||||
public function _remap($alias = "", $params = array())
|
||||
{
|
||||
|
||||
$data['dataValue'] = $this->session;
|
||||
|
||||
$data['pageTitle'] = "English to Nepali Translations";
|
||||
|
||||
switch ($alias) {
|
||||
case 'add':
|
||||
if (isset($_POST['submit'])) {
|
||||
$TableData = array(
|
||||
'english' => filter_var($_POST['english']),
|
||||
'nepali' => filter_var($_POST['nepali']),
|
||||
'created_by' => 'admin',
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
'status' => 1,
|
||||
);
|
||||
$this->db->insert('tbl_translations', $TableData);
|
||||
redirect("master/translations");
|
||||
}
|
||||
loadView("translations/add", $data);
|
||||
break;
|
||||
case 'edit':
|
||||
if (isset($_POST['submit'])) {
|
||||
$id = $this->uri->segment(4);
|
||||
$TableData = array(
|
||||
'english' => filter_var($_POST['english']),
|
||||
'nepali' => filter_var($_POST['nepali']),
|
||||
'created_by' => 'admin',
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
'status' => 1,
|
||||
);
|
||||
$this->db->where('translation_id', $id);
|
||||
$this->db->update('tbl_translations', $TableData);
|
||||
redirect("master/translations");
|
||||
}
|
||||
loadView("translations/edit", $data);
|
||||
break;
|
||||
case 'delete':
|
||||
$id = $this->uri->segment(4);
|
||||
$this->db->where('translation_id', $id);
|
||||
$this->db->delete('tbl_translations');
|
||||
redirect("master/translations");
|
||||
break;
|
||||
default:
|
||||
loadView("translations/list", $data);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user