cashbook screen merged to resico

This commit is contained in:
venbatechnologies@gmail.com 2017-11-27 16:39:32 +05:30
parent c5324817a2
commit b1667e481d
9 changed files with 1529 additions and 5 deletions

View File

@ -81,7 +81,6 @@ $route['loanreports'] = 'payslip/loadLoanReport';
//<-----------Application Add Routes------------>
$route['addNew'] = "user/addNew";
$route['addNewUser'] = "user/addNewUser";
@ -205,6 +204,10 @@ $route['Stock'] = "storestatus/storeavailability";
$route['UpdatePOStatus'] = "servicepurchaseorder/UpdateServicePOStatus";
$route['ServicePOBilling'] = "servicepurchaseorder/viewServicePOReportForBilling";
//<------------Cash book Routes-------------------->
$route['ViewIncomeExpense'] = "cashbook/incomeExpenseList";
$route['addNewIncomeExpense'] = "cashbook/addNewIncomeExpenseLoad";
$route['addIncomeExpense'] = "cashbook/addIncomeExpense";
//<-------------Reports page----------------->
$route['reportpending'] = "report/pending_report";
@ -215,7 +218,9 @@ $route['Report_costcenter'] = "report/ccr";
$route['Report_Material_Supplier'] = "report/MM_Supplier";
$route['Report_Material_Item'] = "report/MM_Item";
$route['Report_Material_ReceiptValue'] = "report/MM_ReceiptValue";
$route['Report_purchase'] = "report/purchase";
$route['Report_year_wise'] = "report/year_wise";
$route['Report_supplier'] = "report/purchase_supplier";
// Company Information
$route['companyview'] = 'companycontroller/companyview';
@ -243,4 +248,4 @@ $route['editOlddepartment'] = "department/viewdepartment";
$route['editOlddepartment/(:num)'] = "department/viewdepartment/$1";
$route['editdepartment'] = "department/editdepartment";
/* End of file routes.php */
/* Location: ./application/config/routes.php */
/* Location: ./application/config/routes.php */

View File

@ -0,0 +1,364 @@
<?php if(!defined('BASEPATH')) exit('No direct script access allowed');
require APPPATH . '/libraries/BaseController.php';
require APPPATH . '/third_party/mpdf/mpdf.php';
/**
* Class : cash Book Controller (cash Book)
* User Class to control all user related operations.
* @author : Gandhimathi
* @version : 1.1
* @since : 27 Nov 2017
*/
class cashbook extends BaseController
{
/**
* This is default constructor of the class
*/
public function __construct()
{
parent::__construct();
$this->load->model('cashbook_model');
$this->isLoggedIn();
$this->load->helper(array('form','url'));
$this->load->library('upload');
}
function incomeExpenseList()
{
$aid = $this->uri->segment(3);
$str = $this->uri->segment(4);
if(!empty($aid)){
if(!empty($str))
{
//echo "PDF";
$data['company'] = $this->cashbook_model->getCompany();
$data['data'] = $this->cashbook_model->getIncomeExpenseList($aid);
//$pic1 = $data['company'][0]->ProfilePic;
//echo $pic1;
//$pic = base_url().'uploads/images'.$pic1;
//echo $pic;
//die();
$totalamt = $data['data'][0]->total;
$data['amtinwords'] = $this->convertNumber($totalamt);
$mpdf=new mPDF('utf-8','A4-P',7, 10,10, 10, 3, 0, 0, 0);
$mpdf->SetHTMLHeader($HtmlHeading);
$html = $this->load->view('cashbookpdf',$data,true);
$mpdf->SetDisplayMode('fullpage');
$mpdf->setFooter($HTMLFooter . "Page {PAGENO} of {nb}");
$mpdf->list_indent_first_level = 1;
$mpdf->setAutoTopMargin = 'stretch';
$mpdf->setAutoBottomMargin = 'stretch';
$mpdf->WriteHTML($html);
$filename = "cashbook.pdf";
$mpdf->Output($filename,I);
}
else
{
$data['data'] = $this->cashbook_model->getIncomeExpenseList($aid);
//print_r($data['dropdownvalues']);die();
$this->global['pageTitle'] = 'Resico : Cash Book: View Income Expense ';
$this->loadViews("viewIndIncomeExpense", $this->global, $data , NULL);
}
}else{
$data['list'] = $this->cashbook_model->getIncomeExpenseList();
$this->global['pageTitle'] = 'Resico : Cash Book: Listing';
$this->loadViews("income_expense_list", $this->global, $data , NULL);
}
}
function addNewIncomeExpenseLoad()
{
$data['dropdownvalues'] = $this->cashbook_model->getAccounTypes();
//print_r($data['dropdownvalues']);die();
$this->global['pageTitle'] = 'Resico : Cash Book: Add New Income Expense ';
$this->loadViews("addnewIncomeExpense", $this->global, $data , NULL);
}
function addIncomeExpense()
{
//echo "welcome";
//die();
$accounttype = $this->input->post('myradio');
if($accounttype == 1)
{
$accounttype = 'INCOME';
}
else
{
$accounttype = 'EXPENSE';
}
$accountcode = $this->input->post('accode');
$date = $this->input->post('Date');
$date = date_create($date);//,'Y-m-d');
$date = date_format($date,'Y-m-d');
$towhome = $this->input->post('towhome');
$gsttoggle = $this->input->post('gsttoggle');
$invoiceno = null;
$merchantname = null;
$mergstno = null;
$hsn = null;
$beforegst = null;
$sgst = null;
$cgst = null;
$igst = null;
if(!empty($gsttoggle))
{
$invoiceno = $this->input->post('Invoiceno');
$merchantname = $this->input->post('merchant');
$mergstno = $this->input->post('Merchantgst');
$hsn = $this->input->post('hsn');
$beforegst = $this->input->post('valuebeforegST');
$sgst = $this->input->post('SGST');
$cgst = $this->input->post('CGST');
$igst = $this->input->post('IGST');
}
$totalamount = $this->input->post('totalamount');
$description = $this->input->post('description');
if(empty($description)){$description = 'NA';}
$document = null;
$fs = 0;
if(!empty($_FILES['myfile']['name']))
{
//echo "FILE AVAILABLE";
$config['file_name'] = $_FILES['myfile']['name'];
$config['upload_path'] = 'uploads/cashbook/';
$path = $config['upload_path'];
//$filename = $config['file_name'];
$document = $path.$filename;
//echo $document;
$fs = $this->uploadFile();
$document = $path.$fs;
}
$created_by = $this->session->userdata('userId');
$addincomexpense = array('type'=>$accounttype,'account_code'=>$accountcode,'date'=>$date,'towhom'=>$towhome,'invoice_no'=>$invoiceno,'merchant'=>$merchantname,'merchant_gst'=>$mergstno,'HSN'=>$hsn ,'value_before_gst'=>$beforegst,'sgst'=>$sgst,'cgst'=>$cgst,'igst'=>$igst,'total'=>$totalamount,'description'=>$description,'document'=>$document,'Created_By'=>$created_by);
$res = $this->cashbook_model->saveIncomeExpense($addincomexpense);
if( $res == 1 ){
echo "<script>alert('Saved Successfully!');window.location.href='ViewIncomeExpense';</script>";
}
}
function uploadFile()
{
//echo "INSIDE UPLOAFD";
//$this->load->library('upload')
$pathinfo = pathinfo($_FILES['myfile']['name']);
$config['upload_path'] = 'uploads/cashbook/';
$config['allowed_types'] = 'png|jpg|jpeg';
$config['file_name'] = $_FILES['myfile']['name'];
// $config['overwrite'] = true;
//Load upload library and initialize configuration
$this->load->library('upload',$config);
$this->upload->initialize($config);
if($this->upload->do_upload('myfile'))
{
$uploadData = $this->upload->data();
$uploadfilename = $uploadData['file_name'];
return $uploadfilename;
}
else
{
$error = array('error' => $this->upload->display_errors());
$uploadfilename = '';
print_r($error);
return 0;
}
}
function viewIE()
{
$aid = $this->uri->segment(3);
$data['data'] = $this->cashbook_model->getAccounutInfo();
//print_r($data['dropdownvalues']);die();
$this->global['pageTitle'] = 'Resico : Cash Book: View Income Expense ';
$this->loadViews("viewIndIncomeExpense", $this->global, $data , NULL);
}
public function index()
{
$this->global['pageTitle'] = 'Resico : Cashbook Details';
$this->loadViews("cashbooklisting", $this->global, NULL , NULL);
}
public function cashbookList()
{
$this->load->model('cashbook_model');
$data['cashbook'] = $this->cashbook_model->Selectcash();
$this->global['pageTitle'] = 'Resico : Cashbook Listing';
$this->loadViews("cashbooklisting", $this->global, $data, NULL);
}
public function cashbookdtl()
{
$id = $this->input->post('id');
$tablevalue = json_decode($id,true);
//print_r($tablevalue);
foreach($tablevalue as $tv)
{
if(!empty($tv['AccountCodeType'])){
$acc_type = $tv['AccountCodeType'];
$acc_code = $tv['AccountCode'];
$acc_name = $tv['AccountName'];
$acc_desc = $tv['Description'];
$acc_state = $tv['Status'];
if(strtoupper($acc_state) == 'YES')
{
$acc_status = 1;
}
else{
$acc_status = 0;
}
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
$acc_createddt = $dt->format('Y-m-d H:i:s');
$cashbookdatas = array('type'=>$acc_type,'code'=>$acc_code,'name'=>$acc_name,'description'=>$acc_desc,'status'=>$acc_status,'created_on'=>$acc_createddt);
//print_r($cashbookdatas);
$result = $this->cashbook_model->Cashbook($cashbookdatas);
}
}
//redirect('cashbook/cashbookList','refresh');
echo "Successfully Saved!";
}
public function convertNumber($amt){
//echo $amt;die();
$ShowPaise='0';
$totalAmt=explode(".",$amt);
$number = $totalAmt[0];
$no = $number;
if(!empty($totalAmt[1]) && $totalAmt[1]!=0){
$point = $totalAmt[1];
$ShowPaise='1';
}
else{
$point=0;
$ShowPaise='0';
}
$hundred = null;
$digits_1 = strlen($no);
$i = 0;
$str = array();
$words = array('0' => '', '1' => 'One', '2' => 'Two',
'3' => 'three', '4' => 'Four', '5' => 'Five', '6' => 'Six',
'7' => 'seven', '8' => 'eight', '9' => 'nine',
'10' => 'ten', '11' => 'eleven', '12' => 'twelve',
'13' => 'thirteen', '14' => 'fourteen',
'15' => 'fifteen', '16' => 'sixteen', '17' => 'seventeen',
'18' => 'eighteen', '19' =>'nineteen', '20' => 'twenty',
'30' => 'thirty', '40' => 'forty', '50' => 'fifty',
'60' => 'sixty', '70' => 'seventy',
'80' => 'eighty', '90' => 'ninety','06'=>'Zero Six','01'=>'Zero One','02'=>'Zero Two'
,'03'=>'Zero Three','04'=>'Zero Four','05'=>'Zero Five','07'=>'Zero Seven','08'=>'Zero Eight','09'=>'Zero Nine');
$words1 = array('2' => 'twenty',
'3' => 'thirty', '4' => 'fourty',
'5' => 'fifty', '6' => 'sixty', '7' => 'seventy',
'8' => 'eighty', '9' =>'ninty');
$words12 = array('11' => 'eleven',
'12' => 'twelve', '13' => 'thirteen', '14' => 'fourteen',
'15' => 'fifteen', '16' => 'sixteen', '17' => 'seventeen',
'18' => 'eighteen', '19' =>'nineteen', '20' => 'twenty',);
$digits = array('', 'hundred', 'thousand', 'lakh', 'crore');
while ($i < $digits_1) {
$divider = ($i == 2) ? 10 : 100;
$number = floor($no % $divider);
$no = floor($no / $divider);
$i += ($divider == 10) ? 1 : 2;
if ($number) {
$plural = (($counter = count($str)) && $number > 1) ? 's' : null;
//print_r($plural);
$hundred = ($counter == 1 && $str[0]) ? ' and ' : null;
//print_r($hundred);
$str [] = ($number < 21) ? $words[$number] .
" " . $digits[$counter] . $plural . " " . $hundred
:
$words[floor($number / 10) * 10]
. " " . $words[$number % 10] . " "
. $digits[$counter] . $plural . " " . $hundred;
} else $str[] = null;
}
$str = array_reverse($str);
$result = implode('', $str);
if($point>=1 && $point<=10)
{
$points = ($point) ?
" " . $words[$point] : " ";
}
else if($point>=11 && $point<=20)
{
$points = ($point) ?
" " . $words12[$point] : " ";
}
else
{
$points = ($point) ?
" " . $words1[$point / 10] . " " .
$words[$point = $point % 10] : '';
}
if($ShowPaise=='0'){
$amountInWords = "Rupees " . $result." Only";
}
else{
$amountInWords = "Rupees " . $result ." Paise ". $points." Only";
}
return $amountInWords;
}
}
?>

View File

@ -0,0 +1,104 @@
<?php if(!defined('BASEPATH')) exit('No direct script access allowed');
class cashbook_model extends CI_Model
{
function getAccounTypes()
{
$this->db->where('status',1);
$r = $this->db->get('t_accountcode');
return $r->result();
}
function saveIncomeExpense($data)
{
$this->db->insert('t_income_expense',$data);
$r = $this->db->affected_rows();
return $r;
}
function getIncomeExpenseList($i="")
{
$this->db->select('t_accountcode.name,T_Employee_Details.FirstName,T_Employee_Details.LastName,t_income_expense.*');
$this->db->from('t_income_expense');
$this->db->join('t_accountcode','t_income_expense.account_code=t_accountcode.code');
$this->db->join('tbl_users','t_income_expense.Created_By=tbl_users.userId');
$this->db->join('T_Employee_Details','tbl_users.EmpID=T_Employee_Details.EmpID');
if(!empty($i))
{
$this->db->where('t_income_expense.id',$i);
}
$r = $this->db->get();
return $r->result();
}
function getCompany()
{
$r = $this->db->get('T_Company_Details');
return $r->result();
}
function getAccounutInfo($i)
{
$this->db->select('t_accountcode.name,t_income_expense.*');
$this->db->from('t_income_expense');
$this->db->join('t_accountcode','t_income_expense.account_code=t_accountcode.code');
//$this->db->where('t_income_expense.id')
$r = $this->db->get();
return $r->result();
}
function Selectcash()
{
$this->db->select('*');
$this->db->from('t_accountcode');
$query = $this->db->get();
$result = $query->result();
return $result;
}
function Cashbook($cashbookdatas)
{
$code=$cashbookdatas['code'];
$type=$cashbookdatas['type'];
$count=0;
$this->db->select('count(*) as count');
$this->db->from('t_accountcode');
$this->db->where('type',$type);
$this->db->where('code',$code);
$isExits = $this->db->get();
$res = $isExits->result_array();
if(!empty($res))
{
$count = $res[0]['count'];
}
if($count == 0 )//for cashbook_insert
{
$cbi = $this->db->insert('t_accountcode', $cashbookdatas);
return $cbi;
}
elseif($count == 1)//for cashbook_update
{
$this->db->where('code',$code);
$cbu = $this->db->update('t_accountcode',$cashbookdatas);
return $cbu;
}
}
}
?>

View File

@ -0,0 +1,468 @@
<?php //print_r($dropdownvalues);?>
<script>
$(function() {
var t = [];
var ex = [];
var inc = [];
t= <?php echo json_encode($dropdownvalues)?>;
$.each(t,function(i,item){
if(item.type == 'INCOME')
{
$("#accode").append( $('<option></option>').val(item.code).html(item.name));
}
});
$('#gst').click(function(){
$('#gstarea').toggle();
});
$('#towhom').text('Received From:');
$("#Date").datepicker({
//minDate : new Date(year-SIAStartYear,1,1),
maxDate :'now',
dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,
});
});
function readURL(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('#slip')
.attr('src', e.target.result)
.width(100)
.height(100);
//alert(e.target.result);
};
reader.readAsDataURL(input.files[0]);
$('#slip').val(input.files[0]['name']);
}
}
function isNumberKey(evt)
{
var charCode = (evt.which) ? evt.which : evt.keyCode;
if (charCode != 46 && charCode > 31
&& (charCode < 48 || charCode > 57))
return false;
return true;
}
function loadAccountType(id)
{
//alert('called'+id);
var id=id;
var t = [];
var ex = [];
var inc = [];
t= <?php echo json_encode($dropdownvalues)?>;
if(id == 'myradio1')
{
// alert('INCOME clicked');
$('#accode').find('option').remove().end().append('<option value="-1">Select Account Name</option>').val('Select Account Code');
$.each(t,function(i,item){
if(item.type == 'INCOME')
{
$("#accode").append( $('<option></option>').val(item.code).html(item.name));
}
});
}
if(id == 'myradio2')
{
//alert('expense clicked');
$('#accode').find('option').remove().end().append('<option value="-1">Select Account Name</option>').val('Select Account Code');
$.each(t,function(i,item){
if(item.type == 'EXPENSE')
{
$("#accode").append( $('<option></option>').val(item.code).html(item.name));
}
});
}
//alert('final alert');
}
</script>
<div class="content-wrapper" style="min-height: 537px;">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<center>Resico Industries - Add New Income and Expense</center>
</h1>
</section>
<section class="content">
<div style="text-align:right;">
<a href="<?php base_url() ?>ViewIncomeExpense" class="btn btn-primary" value="Back"/>Back</a>
</div>
<br>
<div class="row">
<!-- left column -->
<div class="col-md-12">
<!-- general form elements -->
<div class="box box-primary">
<!-- form start -->
<form role="form" id="addIncomeExpense" action="<?php echo base_url() ?>addIncomeExpense" enctype="multipart/form-data" method="post">
<div class="box-body">
<div class="row">
<div class="col-md-12">
<div class="col-md-3">
<div class="form-group">
<b><span for="Accountcode">Select Accounut type:</span> </b> </br></br>
<input type="radio" onclick = loadAccountType(this.id); id="myradio1" name="myradio" value="1" checked>Income &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" onclick = loadAccountType(this.id); id="myradio2" name="myradio" value="2" >Expense
</div>
</div>
<div class="col-md-3">
<div class="form-group"><b>
<span for="PONO">Accounut Name Select:</span> </b><span style="color:red">*</span> </br></br>
<select class="form-control required " required id="accode" required name="accode">
<option value="-1">Account Name Select</option>
</select>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<b>
<span for="PODescription">Date:</span></b><span style="color:red">*</span></br></br>
<input type="text" class="form-control required" id="Date" name="Date">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<b>
<span for="towhome" id="towhom">AAA</span></b><span style="color:red">*</span></br></br>
<input type="text" class="form-control required" id="towhome" name="towhome">
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="col-md-3">
<input type="checkbox" id="gst" name="gsttoggle"> GST
</div>
</div>
</div>
<div class="row" id="gstarea" style="border:1px dashed; margin-left:0px;margin-right:0px;display:none;">
<div class="col-md-12">
<div class="col-md-3">
<div class="form-group">
<b><span for="Invoiceno">Invoice No:</span></b>
<input type="text" class="form-control required" id="Invoiceno" name="Invoiceno">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<b><span for="Merchant">Merchant Name:</span></b>
<input type="text" class="form-control required" id="merchant" name="merchant">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<b>
<span for="Merchantgst">Merchant GST No:</span></b>
<input id="merchantgst" name="Merchantgst" class="form-control">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<b>
<span for="HSN/SAC Code">HSN/SAC Code:</span></b>
<input id="hsn" name="hsn" class="form-control" >
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-3">
<div class="form-group">
<b>
<span for="ValuebeforeGST">Value before GST:</span></b>
<input id="valuebeforegST" name="valuebeforegST" style="text-align:right;" class="form-control" onkeypress="return isNumberKey(event)">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<b>
<span for="SGST">SGST:</span>
</b>
<input type="text" class="form-control" style="text-align:right;" onchange="GSTvalue(this.id)" id="SGST" name="SGST" onkeypress="return isNumberKey(event)">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<b>
<span for="CGST">CGST:</span>
</b>
<input type="text" class="form-control" id="CGST" style="text-align:right;" name="CGST" onkeypress="return isNumberKey(event)">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<b>
<span for="IGST">IGST:</span></b>
<input type="text" class="form-control required" style="text-align:right;" onkeypress="return isNumberKey(event)" onchange = GSTvalue(this.id) id="IGST" name="IGST">
</div>
</div>
</div>
</div> <!-- /End of GST Area -->
<div class="row">
<div class="col-md-12">
<div class="col-md-4">
<b><span for="Total">Total Amount:</span></b><span style="color:red">*</span>
<input type="text" class="form-control" id="totalamount" name="totalamount" onkeypress="return isNumberKey(event)" style="text-align:right;" >
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="col-md-4">
<b><span for="Description">Description:</span></b>
<textarea class="form-control" id="description" name="description" >
</textarea>
</div>
<div class="col-md-4">
<b><span for="Description">File Upload:</span></b>
<img id="slip" alt="your image" style="width: 139px;"/><br/>
<input type='file' input accept=".JPG,.PNG" onchange="readURL(this);" id="file" name="myfile" accept="image/*"/>
</div>
</div>
</div>
<!-- /.box-body -->
<div class="box-footer" style="text-align:right">
<input type="button" onclick="validate();"class="btn btn-primary" value="Submit" />
<input type="reset" class="btn btn-primary" value="Reset" />
</div>
</div>
</form>
</div>
<div class="col-md-4">
<?php
$this->load->helper('form');
$error = $this->session->flashdata('error');
if($error)
{
?>
<div class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo $this->session->flashdata('error'); ?>
</div>
<?php } ?>
<?php
$success = $this->session->flashdata('success');
if($success)
{
?>
<div class="alert alert-success alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo $this->session->flashdata('success'); ?>
</div>
<?php } ?>
<div class="row">
<div class="col-md-12">
<?php echo validation_errors('<div class="alert alert-danger alert-dismissable">', ' <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button></div>'); ?>
</div>
</div>
</div>
</div>
</div>
</section>
</div>
<script>
function validate()
{
var accode = $('#accode').val();
var date = $('#Date').val();
var towhome = $('#towhome').val();
var gstcheck = document.getElementById("gst").checked;
var Invoiceno = $('#Invoiceno').val();
var merchant = $('#merchant').val();
var mergst = $('#merchantgst').val();
var beforegst = $('#valuebeforegST').val();
var sgst = $('#SGST').val();
var cgst = $('#CGST').val();
var igst = $('#IGST').val();
var total = $('#totalamount').val();
var errorflag = 0;
if(accode < 0)
{
errorflag++;
}
if(date == '')
{
errorflag++;
}
if(total == '')
{
errorflag++;
}
if(towhome == '')
{
errorflag++;
}
if(gstcheck == true)
{
if((merchant == '') || (mergst == '') || (Invoiceno == '') || (beforegst == '') || (sgst == '') || (cgst == '') || (igst == ''))
{
errorflag++;
}
else
{
// calculation part
}
}
// alert(errorflag);
if(errorflag != 0)
{
alert("Please Provide All Details..!");
return false;
}
$('#addIncomeExpense').submit();
}
function GSTvalue(id)
{
var sgst = $('#SGST').val();
var cgst = $('#CGST').val();
var igst = $('#IGST').val();
var beforegst = $('#valuebeforegST').val();
$('#valuebeforegST').val((parseFloat(beforegst).toFixed(2)));
if(id == 'SGST')
{
$('#CGST').val(parseFloat(sgst).toFixed(2));
$('#SGST').val(parseFloat(sgst).toFixed(2));
$('#IGST').val('0.00');
calculateTotal();
}
if(id == 'IGST')
{
$('#CGST').val('0.00');
$('#SGST').val('0.00');
$('#IGST').val(parseFloat(igst).toFixed(2));
calculateTotal();
}
}
function calculateTotal()
{
var sgst = $('#SGST').val();
var cgst = $('#CGST').val();
var igst = $('#IGST').val();
var beforegst = $('#valuebeforegST').val();
var total = parseFloat(sgst)+parseFloat(cgst)+parseFloat(igst)+parseFloat(beforegst);
$('#totalamount').val((total.toFixed(2)));
}
$('#myradio1').click(function(){
$('#towhom').text('Received From:');
});
$('#myradio2').click(function(){
$('#towhom').text('Paid To:');
});
</script>

View File

@ -0,0 +1,279 @@
<script src="<?php echo base_url()?>assets/lightswitch/lightswitch/lib/jquery.tabletojson.js"></script>
<script src="<?php echo base_url()?>assets/lightswitch/lightswitch/lib/jquery.tabletojson.min.js"></script>
<div class="content-wrapper">
<section class="content" id="loadingcontent">
<div>
<CENTER><h3>Resico Industries - Cashbook Listing</h3></CENTER>
</div>
<div class="box">
<div class="box-header">
<!-- <CENTER><h1 class="box-title">Resico Industries Cashbook Listing</h1></CENTER> -->
</div>
<form role="form" id="cashbookform" action="<?php echo base_url()?>" method="post" enctype="multipart/form-data">
<div class="container-fluid">
<div class="row">
<div class="col-xs-12 col-md-12">
<legend>Cash book / Account details</legend>
<div class="col-md-12">
<div class="col-md-3"><span>Account Type :</span>&nbsp;&nbsp;<span style="color:#ff6347;">*</span><br>
<input type="radio" name="accounttype" id="accounttype" value="INCOME" checked> Income<br>
<input type="radio" name="accounttype" id="accounttype" value="EXPENSE"> Expense<br>
</div><p style="color:red"></p>
<div class="col-md-3 pad"><span>Account Code :</span>&nbsp;&nbsp;<span style="color:#ff6347;">*</span>
<input type="text" name="accountcode" id="accountcode" onchange="validateACCODE();" class="form-control" requried placeholder="Account Code" title="Account Code is requried">
</div><p style="color:red"></p>
<div class="col-md-3 pad"><span>Account Name :</span>&nbsp;&nbsp;<sapn style="color:#ff6347;">*</span>
<input type="text" name="accountname" id="accountname" class="form-control" placeholder="Account Name" title="Account Name is requried" class="tooltip" onfocus="theFocus(this);" onblur="theBlur(this);">
</div><p style="color:red"></p>
<div class="col-md-3 pad"><span>Description :</span>
<input type="email" name="description" id="description" class="form-control" placeholder="Account Description">
</div>
<input type="hidden" id="accountstate" name="accountstate" class="form-control" value="Yes" >
</div><br>
<div class="row" style="align:right;">
<div class="col-md-offset-10 col-md-1 ">
<input type="button" value="Add" id="Add" class="btn btn-primary"> </div>
<div class=" col-md-1">
<input type="button" value="Save" onclick="saveAll();" class="btn btn-primary"> </div>
</div>
</div>
</div>
<legend>Cash book / Account Tables</legend>
<div class="row">
<div class="col-xs-12">
<table id="cashbooktable" class="table table-hover table-bordered" style="background-color:#fff;font-size:12px;" >
<thead style="background-color:#ddf">
<tr>
<th>AccountCodeType</th>
<th>AccountCode</th>
<th>AccountName</th>
<th>Description</th>
<th>Status</th>
</tr>
</thead>
<tbody id="databaseAppend">
<?php
if(!empty($cashbook))
{
foreach($cashbook as $cb){
?>
<tr>
<td><?php echo $cb->type ?></td>
<td><?php echo $cb->code ?></td>
<td contenteditable='true'><?php echo $cb->name ?></a></td>
<td contenteditable='true'><?php echo $cb->description?></a>
<td contenteditable='true'><?php if($cb->status == 1 )
{
echo 'Yes';
//echo strtoupper('Yes');
}
else
{
echo 'No';
//echo strtoupper('No');
}
?></td></tr>
<?php
}
}
?> </tbody>
</table>
</div>
</div>
</div>
</div>
</form>
</div>
</section>
</div>
<script type="text/html" id="addList">
<tr id="<%=index%>">
<td align="left"><%=AccountCodeType%></td>
<td align="left"><%=AccountCode%></td>
<td align="left" contenteditable="true"><%=AccountName%></td>
<td align="left" contenteditable="true"><%=Description%></td>
<td align="left" contenteditable="true"><%=Status%></td>
</tr>
</script>
<script>
var index = '1';
var localcodes =[];
$('#Add').click(function(){
var res = validateACCODE();
// alert('res'+res);
if(res != 1)
{
//alert('inside if');
var temp = index;
var Acctype = $("#accounttype:checked").val() ;
var Acccode = $('#accountcode').val();
var Accname = $('#accountname').val();
var Accdesc = $('#description').val();
var Status = $('#accountstate').val();
var localflag = 0;
//if(Acctype != '' || Accname != '' || Acccode != '' )https://www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0ahUKEwjnwuzq4MXXAhVIQI8KHcWmBUoQFggqMAA&url=https%3A%2F%2Fstackoverflow.com%2Fquestions%2F9127847%2Fdocument-getelementbyid-focus-returning-undefined&usg=AOvVaw20BMY_C7k6ShhmOz0Vmzs8
if(Accname != '' || Acccode != '')
{
//var radioValue = $("input[name='accounttype']:checked").val();
if (Acccode == ''){
$('#accountcode').focus();
alert('Account code is requried');
//$("#accountcode").attr('title', 'account code is requried');
return false;
}
else if (Accname == ''){
$('#accountname').focus();
alert('Account Name is requried');
return false;
}//valid if closed
else{
$.each(localcodes,function(i,j){
if(j == Acccode)
{
alert('Account Code Already Taken');
document.getElementById("accountcode").focus();
localflag = 1;
return false;
}
});
if( localflag == 0){
var template = jQuery("#addList").html();
index = parseInt(index)+1;
//$('table tr.odd').remove();//class="dataTables_empty"
//$('.odd').remove();//
localcodes.push(Acccode);
$('#databaseAppend').append(_.template(template,{index:temp,AccountCodeType:Acctype,AccountCode:Acccode,AccountName:Accname,Description:Accdesc,Status:Status}));
clear();
}
}//nearest else closed
}// nearest if closed
//$('input[name="accounttype"]').attr('checked', false);
}
});//add click function closed
</script>
<script type="text/javascript">
$(function () {
$('#cashbooktable').DataTable({
"paging": true,
"lengthChange": true,
"searching": true,
"ordering": true,
"info": true,
"autoWidth": true
});
});
function saveAll()
{
$('#loadingcontent').loader('show');
var tablevalue = $('#cashbooktable').tableToJSON(); // Convert the table into a javascript object
var value = JSON.stringify(tablevalue);
$.ajax({
data:{id:value},
type:"POST",
url:"<?php echo base_url() ?>cashbook/cashbookdtl",
success:function(data){
$('#loadingcontent').loader('hide');
alert(data);
window.location.href="addNewIncomeExpenseLoad";
}//success function closed
});//ajax function closed
}
</script>
<script>
function validateACCODE()
{
var accode = [];
var flag=0;
accode = <?php echo json_encode($cashbook);?>;
var current = $('#accountcode').val();
$.each(accode,function(i,j){
//alert(i+'-'+j.code);
if(j.code == current)
{
alert('Account Code already Taken!');
document.getElementById("accountcode").focus();
// $("#Add").attr("disabled", "disabled");
flag++;
//return false;
}
else
{
//$("#Add").removeAttr("disabled");
}
});
//alert(flag);
return flag;
}
function clear()
{
$('#accountcode').val('');
$('#accountname').val('');
$('#description').val('');
}
</script>

View File

@ -0,0 +1,91 @@
<?php
$label ='Received From ';
if(($data[0]->type) == 'EXPENSE')
{
$label ='Paid To ';
}
$pic = base_url().'uploads/images/'.$company[0]->ProfilePic;
?>
<br><br><br><br>
<table width="100%" style="font-size:13px;">
<tbody>
<tr style="height: 57px;">
<td style="width: 89px; height: 57px;"><img src='<?php echo $pic;?>' ></td>
<td style="width: 89px; height: 57px;" colspan="5">
<h1><?php echo $company[0]->CompanyName;?></h1><br /><?php echo $company[0]->Address;?><br />Mobile <?php echo $company[0]->AlternateContactNumber;?> <br> E-mail <?php echo $company[0]->EmailAddress;?></a><br>GSTIN : <?php echo $company[0]->GSTNO;?>
</td>
</tr>
<hr>
<tr style="height: 25px;">
<td style="width: 89px; height: 25px; text-align: center;" colspan="6"><h3>CASH VOUCHER</h3></td>
</tr>
<tr style="height: 26px;">
<td style="width: 100px; height: 26px;">&nbsp;Voucher Number </td>
<td style="width: 89px; height: 26px;" colspan="3"><?php echo $data[0]->id;?></td>
<hr>
<td style="width: 90px; height: 197px;text-align: center;" colspan="2" rowspan="5"><p> <h1>Rs <?php echo $data[0]->total;?></h1></p>Amount &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
</tr>
<tr style="height: 26px;">
<td style="width: 100px; height: 26px;">&nbsp;Date </td>
<td style="width: 89px; height: 26px;" colspan="3"><?php echo date_format(date_create($data[0]->date),'d-m-Y');?></td>
<hr>
</tr>
<tr style="height: 26px;">
<td style="width: 100px; height: 26px;">&nbsp;<?php echo $label;?></td>
<td style="width: 89px; height: 26px;" colspan="3"><?php echo $data[0]->towhom;?></td>
<hr>
</tr>
<tr style="height: 46px;">
<td style="width: 100px; height: 46px;">&nbsp;Amount (In Words)</td>
<td style="width: 89px; height: 46px;" colspan="3"><b><?php echo $amtinwords;?></b></td>
</tr>
<tr style="height: 73px;">
<td style="width: 89px; height: 73px;">
<p>&nbsp;Remarks </p>
</td>
<td style="width: 89px; height: 73px;" colspan="3"><?php echo $data[0]->description;?></td>
</tr>
<tr style="height: 26px;">
<td style="width: 89px; height: 26px;">&nbsp;</td>
<td style="width: 89px; height: 26px;">&nbsp;</td>
<td style="width: 89px; height: 26px;">&nbsp;</td>
<td style="width: 90px; height: 26px;">&nbsp;</td>
<td style="width: 90px; height: 26px;">Prepared By &nbsp;</td>
<td style="width: 90px; height: 26px;"><?php echo $data[0]->FirstName.'&nbsp;'.$data[0]->LastName;?></td>
<hr>
</tr>
<tr style="height: 26px;">
<td style="width: 89px; height: 26px;">Checked By </td>
<td style="width: 89px; height: 26px;">&nbsp;</td>
<hr>
</tr>
<tr style="height: 26px;">
<td style="width: 89px; height: 26px;">Verified By</td>
<td style="width: 89px; height: 26px;">&nbsp;</td>
<hr>
</tr>
<tr style="height: 90px;">
<td style="width: 89px; height: 90px;" colspan="3">
<p>&nbsp;</p>
<p>&nbsp;</p>
<p style="text-align: center;">&nbsp;Authorized Signature</p>
</td>
<td style="width: 90px; height: 90px;" colspan="3">
<p>&nbsp; &nbsp;</p>
<p>&nbsp;</p>
<p style="text-align: center;">Receiver's Signature</p>
</td>
</tr>
<tr style="height: 26px;">
<td style="width: 89px; height: 26px; text-align: center;" colspan="6">Note : Above Rs.750/- With Revenue Stamp &amp; Signature &nbsp; &nbsp; &nbsp;</td>
</tr>
</tbody>
</table>

View File

@ -594,8 +594,29 @@ $(function() {
</ul>
</li>
<?php } ?>
<?php } ?>
<?php
if($DEPCode == FINANCE || $DEPCode == HR )
{ ?>
<li class="treeview">
<span id="menu" data-toggle="dropdown" ><i class="fa fa-money"></i> Cash Book <span class="caret"></span></span>
<ul class="dropdown-menu" role="menu" aria-labelledby="menu3">
<li class="treeview">
<a href="<?php echo base_url(); ?>cashbook/CashbookList">
<i class="fa fa-vcard"></i> <span>Account Master</span>
</a>
</li>
<li class="treeview">
<a href="<?php echo base_url(); ?>ViewIncomeExpense">
<i class="fa fa-credit-card"></i>
<span>Income and Expense</span>
</a>
</li>
</ul>
</li>
<?php } ?>
<?php
if($DEPCode == PURCHASE)
{ ?>

View File

@ -0,0 +1,84 @@
<CENTER><strong><h3 class="box-title">Resico Industries - Income & Expense List</h3></strong></CENTER>
<div class="content-wrapper">
<section class="content">
<div class="box">
<div class="box-header">
<div align="right" style="padding-right:10px">
<a href="addNewIncomeExpense" class="btn btn-primary" align="right"style="padding-right:10px" >Add New</a>
</div>
</div>
<table id="inexlist" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;">
<div align="right" style="padding-right:10px">
<div id="content" > </div>
<div class="modal fade" role="dialog">
<thead style="background-color:#ddf">
<tr>
<th>Account Type</th>
<th>DATE</th>
<th>Account Name</th>
<th>Amount</th>
<th>Details</th>
</tr>
</thead>
<tbody id="inexlistbody">
<?php if(!empty($list))
{
$base = base_url();
foreach($list as $l)
{
?>
<tr> <td><?php echo '<a href="'.$base.'cashbook/incomeExpenseList/'.$l->id.'">'.$l->type.'</a>';?></td> <td style="text-align:right;"><?php echo date_format(date_create($l->date),'d-m-Y');?></td> <td><?php echo $l->name;?></td> <td style="text-align:right;"><?php echo $l->total;?></td> <td><?php echo $l->description;?></td></tr>
<?php
}
}
?>
</tbody>
</table>
<br>
</div>
</div>
</div>
</div> </section>
</div>
<script>
$(function () {
$('#inexlist').DataTable({
"paging": true,
"lengthChange": true,
"searching": true,
"aaSorting": [[ 0, "desc" ]],
"ordering": true,
"info": true,
"autoWidth": true
});
});
</script>

View File

@ -0,0 +1,108 @@
<?php //print_r($data);
$extype= '';
$exname = '';
$flag = 0;
$invoiceno = '';
$document = '';
$label = '';
if(!empty($data))
{
$extype = $data[0]->type;//['type'];
$exname = $data[0]->name;//['name'];
$invoiceno = $data[0]->invoice_no;
$document =$data[0]->document;
if(!empty($invoiceno))
{
$flag = 1;
}
if($document == null)
{
$document = 'uploads/cashbook/noimage.png';
}
if($extype == 'INCOME')
{
$label = 'Received From :';
}
else
{
$label = 'Paid To :';
}
$final = base_url().$document;
//echo $final;
}
?>
<div class="content-wrapper">
<section class="content">
<div class="box">
<div class="box-header">
<div align="right" style="padding-right:10px">
<a href="<?php echo base_url()?>cashbook/incomeExpenseList/<?php echo $data[0]->id.'/pdf'?>" target="_blank" class="btn btn-primary" align="right"style="padding-right:10px" >Print</a>
</div>
</div>
<div class="box-body">
<div style="left-margin:10px;">
<legend><b><?php echo $extype."&nbsp;&nbsp;-&nbsp;&nbsp;".$exname;?><b><legend>
</div>
<div class="col-md-12">
<div class="col-md-7">
<table id="viewIS">
<thead></thead>
<tbody>
<tr> <td style="text-align:right;"><h4>Date :</h4></td> <td>&nbsp;&nbsp;&nbsp;&nbsp;</td><td style="text-align:right;"><?php if(!empty($data[0]->date)){echo date_format(date_create($data[0]->date),'d-m-Y');}?></td></tr>
<tr> <td style="text-align:right;"><h4><?php echo $label;?></h4></td> <td>&nbsp;&nbsp;&nbsp;&nbsp;</td><td style="text-align:right;"><?php if(!empty($data[0]->towhom)){echo $data[0]->towhom;}?></td></tr>
<?php if($flag == 1){?>
<tr> <td style="text-align:right;"><h4>Invoice No :</h4></td><td>&nbsp;&nbsp;&nbsp;&nbsp;</td> <td style="text-align:right;"><?php if(!empty($data[0]->invoice_no)){echo $data[0]->invoice_no;}?></td></tr>
<tr> <td style="text-align:right;"><h4>Merchant Name :</h4></td><td>&nbsp;&nbsp;&nbsp;&nbsp;</td> <td style="text-align:right;"><?php if(!empty($data[0]->merchant)){echo $data[0]->merchant;}?></td></tr>
<tr> <td style="text-align:right;"><h4>Merchant GST No :</h4></td> <td>&nbsp;&nbsp;&nbsp;&nbsp;</td><td style="text-align:right;"><?php if(!empty($data[0]->merchant_gst)){echo $data[0]->merchant_gst;}?></td></tr>
<tr> <td style="text-align:right;"><h4>HSN/SAC No :</h4></td><td>&nbsp;&nbsp;&nbsp;&nbsp;</td> <td style="text-align:right;"><?php if(!empty($data[0]->HSN)){echo $data[0]->HSN;}?></td></tr>
<tr> <td style="text-align:right;"><h4>Value Before GST :</h4></td> <td>&nbsp;&nbsp;&nbsp;&nbsp;</td><td style="text-align:right;"><?php if(!empty($data[0]->value_before_gst)){echo $data[0]->value_before_gst;}?></td></tr>
<tr> <td style="text-align:right;"><h4>SGST :</h4></td> <td>&nbsp;&nbsp;&nbsp;&nbsp;</td><td style="text-align:right;"><?php if(!empty($data[0]->sgst)){echo $data[0]->sgst;}?></td></tr>
<tr> <td style="text-align:right;"><h4>CGST :</h4></td><td>&nbsp;&nbsp;&nbsp;&nbsp;</td> <td style="text-align:right;"><?php if(!empty($data[0]->cgst)){echo $data[0]->cgst;}?></td></tr>
<tr> <td style="text-align:right;"><h4>IGST :</h4></td><td>&nbsp;&nbsp;&nbsp;&nbsp;</td> <td style="text-align:right;"><?php if(!empty($data[0]->igst)){echo $data[0]->igst;}?></td></tr>
<?php }?>
<tr> <td style="text-align:right;"><h4>Total Amount :</h4></td><td>&nbsp;&nbsp;&nbsp;&nbsp;</td> <td style="text-align:right;"><?php if(!empty($data[0]->total)){echo $data[0]->total;}?></td></tr>
<tr> <td style="text-align:right;"><h4>Description :</h4></td> <td>&nbsp;&nbsp;&nbsp;&nbsp;</td><td style="text-align:right;"><?php if(!empty($data[0]->description)){echo $data[0]->description;}?></td></tr>
</tbody>
</table>
</div>
<div class="col-md-5" style="border:0px solid;">
<img id="receipt" src="<?php echo $final ?>" alt="No Receipt Available" style="width: 400px;height:400px;"/><br/>
</div>
</div>
</div>
</div>
</div> </section>
</div>
<script>
$(function () {
$('#inexlist').DataTable({
"paging": true,
"lengthChange": true,
"searching": true,
"aaSorting": [[ 0, "desc" ]],
"ordering": true,
"info": true,
"autoWidth": true
});
});
</script>