From bd936e04daeff0c8b9d12ebff8667e9eaea6fffb Mon Sep 17 00:00:00 2001 From: "venbatechnologies@gmail.com" Date: Mon, 21 May 2018 14:33:48 +0530 Subject: [PATCH] maintenances batchcard issues fixes and cashbook report --- application/controllers/batchcard.php | 3 +- application/controllers/report.php | 122 +++++- application/models/dahsboard_model.php | 8 +- application/views/cashbookmonthlyexpenses.php | 399 ++++++++++-------- application/views/cashbooktoday.php | 107 +++-- application/views/cashbookyearlyexpenses.php | 327 +++++++------- application/views/cashbookyearmonthwise.php | 6 +- application/views/reportcashbook.php | 125 +++--- 8 files changed, 631 insertions(+), 466 deletions(-) diff --git a/application/controllers/batchcard.php b/application/controllers/batchcard.php index 815b4197..48cc4abd 100755 --- a/application/controllers/batchcard.php +++ b/application/controllers/batchcard.php @@ -718,6 +718,7 @@ class batchcard extends BaseController function addMaint(){ $data['emplist'] = $this->batchcard_model->getEmplistforReport(); + $data['supplist'] = $this->batchcard_model->getSupplierlist(); $data['MachineList'] = $this->batchcard_model->getmachine_codename(); $this->global['pageTitle'] = 'Siddharth : Add Maintenance/Breakdown'; $this->loadViews("BatchcardMaintAdd", $this->global,$data,NULL); @@ -863,7 +864,7 @@ class batchcard extends BaseController // $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); // $updatedon = $date->format('d-m-Y H:i:s'); - $editmntbr = array('Type'=>$type,'Machine_Code'=>$machinecode,'Maint_Subtype'=>$maintenance_subtype, 'Maint_Subtype'=>$maintenance_subtype,'Maint_Location'=>$location, 'Maint_Description'=>$maintenance_description, 'Maint_Reason'=>$maintenance_reason, 'Maint_Time_from'=>$maintenance_time_from, 'Maint_Time_to'=>$maintenance_time_to, 'Maint_Total_hrs'=>$maintenance_total_hrs, 'Cost_Material'=>$cost_material, 'Cost_Labour'=>$cost_labour,'WorkDone_By'=>$workdoneby,'Approved_By'=>$approvedby,'UpdatedBy'=>$updatedby); + $editmntbr = array('Type'=>$type,'Machine_Code'=>$machinecode,'Maint_Subtype'=>$maintenance_subtype, 'Maint_Supplier'=>$supplier,'Maint_Location'=>$location, 'Maint_Description'=>$maintenance_description, 'Maint_Reason'=>$maintenance_reason, 'Maint_Time_from'=>$maintenance_time_from, 'Maint_Time_to'=>$maintenance_time_to, 'Maint_Total_hrs'=>$maintenance_total_hrs, 'Cost_Material'=>$cost_material, 'Cost_Labour'=>$cost_labour,'WorkDone_By'=>$workdoneby,'Approved_By'=>$approvedby,'UpdatedBy'=>$updatedby); //'Maint_Date'=>$maintenance_date,'Maint_Time'=>$maintenance_time, //print_r($editmntbr); //die(); diff --git a/application/controllers/report.php b/application/controllers/report.php index f305990b..d4d68894 100755 --- a/application/controllers/report.php +++ b/application/controllers/report.php @@ -1062,44 +1062,118 @@ class report extends BaseController } - public function monthexpenses() - { + // public function monthexpensess() + // { - $this->global['pageTitle'] = 'Cashbook - monthly expenses Reports - '; + // $this->global['pageTitle'] = 'Cashbook - monthly expenses Reports - '; - $data['monthlyreport']=$this->dahsboard_Model->monthexpensereport(); - // $data['monthlyincreport']=$this->dahsboard_Model->monthincomereport(); - $data['Indiancurrency']=$this->dahsboard_Model->INRSymbol(); + // $data['monthlyreport']=$this->dahsboard_Model->monthexpensereport(); + // // $data['monthlyincreport']=$this->dahsboard_Model->monthincomereport(); + // $data['Indiancurrency']=$this->dahsboard_Model->INRSymbol(); - $this->loadviews("cashbookmonthlyexpenses",$this->global,$data, NULL); + // $this->loadviews("cashbookmonthlyexpenses",$this->global,$data, NULL); + // } + // public function yearexpensess() + // { + + // $this->global['pageTitle'] = 'Cashbook - yearly expenses Reports - '; + + // $fyear = $this->input->post('financialyear'); + + // $fa=substr( $fyear,0,-5); + // $aa=substr( $fyear,5,5); + // //echo $fyear; + // //$data['yearlyincreport']=$this->dahsboard_Model->yearincomereport(); + // $data['yearlyreport']=$this->dahsboard_Model->yearexpensereport($fa,$aa); + // $data['financialyear']=$this->dahsboard_Model->cashbookfinyear(); + // //print_r($data['finyear']); + // $data['Indiancurrency']=$this->dahsboard_Model->INRSymbol(); + + + // $this->loadviews("cashbookyearlyexpenses",$this->global,$data, NULL); + + + // } + public function monthexpenses() + { + // $this->global['pageTitle'] = 'Cashbook - Cashbook Monthly Reports '; + // $data['monthlyreport']=$this->dahsboard_Model->monthexpensereport(); + // // $data['monthlyincreport']=$this->dahsboard_Model->monthincomereport(); + // $data['Indiancurrency']=$this->dahsboard_Model->INRSymbol(); + $monthyearvalue = $this->input->post('monthyear'); + $this->global['pageTitle'] = ' Cashbook - Cashbook Monthly Reports'; + + if($monthyearvalue == ''){ + + $data['monthyearvalue'] = ''; + + } + else{ + + $data['monthyearvalue'] = $monthyearvalue; + $monthyear = explode("-",$monthyearvalue); + + $month = $monthyear[0]; + $year = $monthyear[1]; + + + $premonth = $monthyear[0]-1; + $premonth = $premonth < 10 ? '0'.$premonth : ''.$premonth; + $premonth = $premonth == '00' ? '12' : $premonth; + + $yearvalue = $premonth == '12' ? $year-1 : $year; + + $data['prevmonthtotal']=$this->dahsboard_Model->monthbeforetotal($premonth,$yearvalue); + + //$data['monthlyreport']=$this->dahsboard_Model->month_incexp_report($month,$year); + $data['monthlyreport']=$this->dahsboard_Model->monthexpensereport($month,$year); + + } + + $this->loadviews("cashbookmonthlyexpenses",$this->global,$data, NULL); + } public function yearexpenses() { - - $this->global['pageTitle'] = 'Cashbook - yearly expenses Reports - '; + // public function yearly_incexp() + // { + $this->global['pageTitle'] = 'Cashbook - Cashbook Yearly Reports'; + + $data['financialyear']=$this->dahsboard_Model->cashbookfinyear(); - $fyear = $this->input->post('financialyear'); + $fyear = $this->input->post('financialyear'); + if($fyear ==''){ + + $data['fyears'] = ''; + + }else{ + + $data['fyears'] = $fyear; + //echo $data['fyears']; $fa=substr( $fyear,0,-5); $aa=substr( $fyear,5,5); - //echo $fyear; - //$data['yearlyincreport']=$this->dahsboard_Model->yearincomereport(); - $data['yearlyreport']=$this->dahsboard_Model->yearexpensereport($fa,$aa); - $data['financialyear']=$this->dahsboard_Model->cashbookfinyear(); - //print_r($data['finyear']); - $data['Indiancurrency']=$this->dahsboard_Model->INRSymbol(); + $finyear = explode("-",$fyear); + + $b4oneyear = $finyear[0] -1; + $b4twoyear = $finyear[1] -1; - - $this->loadviews("cashbookyearlyexpenses",$this->global,$data, NULL); - - - } + $data['yearlyreport']=$this->dahsboard_Model->yearexpensereport($fa,$aa); + + $data['b4finyeartotal']=$this->dahsboard_Model->yearbeforetotal($b4oneyear,$b4twoyear); + + + //$this->loadviews("cashbookyearlyreport",$this->global,$data, NULL); + + } + $this->loadviews("cashbookyearlyexpenses",$this->global,$data, NULL); + } public function cashbookdepartment() { $this->global['pageTitle'] = 'Cashbook - department - '; @@ -1157,7 +1231,11 @@ class report extends BaseController { $this->global['pageTitle'] = 'Cashbook - viewtoday '; $data['tdy']=$this->dahsboard_Model->today(); - //print_r($data['tdy']); + $now = new DateTime(); + $currentdate = $now->format('Y-m-d'); // MySQL datetime format + $yesterday = date('Y-m-d', strtotime("-1 day")); + + $data['yesterdaytotal'] = $this->dahsboard_Model->daybeforetotal($yesterday); $data['Indiancurrency']=$this->dahsboard_Model->INRSymbol(); $this->loadviews("cashbooktoday",$this->global,$data, NULL); } diff --git a/application/models/dahsboard_model.php b/application/models/dahsboard_model.php index f01d9e7f..824a364d 100755 --- a/application/models/dahsboard_model.php +++ b/application/models/dahsboard_model.php @@ -2221,7 +2221,7 @@ if ($cname!= ''){ return $query->result(); } //home --this month// - function monthexpensereport() + function monthexpensereport($month,$year) { $sql="SELECT date_format(tinc.date,'%d-%m-%Y')as date, ifnull(case @@ -2240,7 +2240,8 @@ if ($cname!= ''){ when tinc.type = 'RECEIPT' then tinc.towhom end, '-') as receiptname, - tinc.total,tinc.towhom,tinc.description,monthname(tinc.date)as month,tinc.type,tinc.account_code,ac.name FROM t_income_expense tinc join t_accountcode ac on ac.code=tinc.account_code where month(tinc.date)= month(current_date())group by tinc.account_code"; + tinc.total,tinc.towhom,tinc.description,monthname(tinc.date)as month,tinc.type,tinc.account_code,ac.name FROM t_income_expense tinc join t_accountcode ac on ac.code=tinc.account_code where month(tinc.date)= ".$month." and year(tinc.date)=".$year." group by tinc.account_code"; + //tinc.total,tinc.towhom,tinc.description,monthname(tinc.date)as month,tinc.type,tinc.account_code,ac.name FROM t_income_expense tinc join t_accountcode ac on ac.code=tinc.account_code where month(tinc.date)= month(current_date())group by tinc.account_code"; $query = $this->db->query($sql); return $query->result(); @@ -2254,7 +2255,8 @@ if ($cname!= ''){ sum(total) as total from t_income_expense where date >= '".$fa."-04-01' and date <= '".$aa."-03-31' - group by month "; + group by month + ORDER BY FIELD(month,'April','May','June','July','August','September','October','November','December','January', 'February', 'March') "; $query = $this->db->query($sql); return $query->result(); diff --git a/application/views/cashbookmonthlyexpenses.php b/application/views/cashbookmonthlyexpenses.php index c939c769..9832eb94 100755 --- a/application/views/cashbookmonthlyexpenses.php +++ b/application/views/cashbookmonthlyexpenses.php @@ -1,167 +1,202 @@ FontCode2000; - }} - - -if(!empty($monthlyreport)) -{ - -} -if(!empty($monthlyincreport)) -{ +if(!empty($prevmonthtotal)) +{ + foreach ($prevmonthtotal as $prevttl){ + // $payamt = $prevmonthtotal[0]->payment_amt; + $payamt = $prevttl->payment_amt; + // $recamt = $prevmonthtotal[0]->receipt_amt; + $recamt = $prevttl->receipt_amt; +}} +if(!empty($monthyearvalue)) +{ +$monthyr = explode("-",$monthyearvalue); +$monthNum = $monthyr[0]; +$yearNum = $monthyr[1]; +$dateObj = DateTime::createFromFormat('!m', $monthNum); +$monthName = $dateObj->format('F'); } +// $inrsymbol=''; +// if(!empty($Indiancurrency)) +// { +// foreach ($Indiancurrency as $inr) +// { +// $inrsymbol = $inr->FontCode2000; +// }} + ?> - + .ui-datepicker-calendar { + display: none; + } + + +
+
+
+
+
+

Month Report

+ +
+
+
+ + +
+
+ + + + + + +
+
+ +
+
+ +
+
+
+
+
+ + + + + + + + + + - - -
-
-
-
-
-

Month Report()

-
-
- -
-
Account NameType Receipt () Payment () Current Balances()
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - -
Account NameType Receipt Payment
name?>type?>income,2,'.',''); - echo number_format($mr->income,2,'.','');?>expense,2,'.',''); - echo number_format($mr->expense,2,'.','');?>
Total  - - - - - -
Previous Month Balance(Opening Balances)  
name?>type?>income,2,'.',''); + echo number_format($mr->income,2,'.','');?>expense,2,'.',''); + echo number_format($mr->expense,2,'.','');?>
-
-
-
-
-
-
+ } + ?> + + Total +   + + + + + + + + Current Month Closing Balances +   + + +   + + + + + + + + + + - - - - - - @@ -170,34 +205,42 @@ if(!empty($monthlyincreport)) - \ No newline at end of file + +$('#monthly').click(function() { + + if($("#monthyear").val().length < 1) + { + alert('Please Select/Choose Month Year'); + $("#monthyear").focus(); + return false; + } + //alert('finished'); +}); + \ No newline at end of file diff --git a/application/views/cashbooktoday.php b/application/views/cashbooktoday.php index 4011d0f1..c86f026e 100755 --- a/application/views/cashbooktoday.php +++ b/application/views/cashbooktoday.php @@ -1,12 +1,22 @@ FontCode2000; - }} +$strdayttl = ''; +$in=0.00; +$payamt=0.00; +$recamt = 0.00; +$zero=0.00; +$curr_balances=0.00; +$ti=0.00; +$tvt=0.00; +// [date] => 2018-02-21 [payment_amt] => 0 [receipt_amt] => 13 ) ) + if(!empty($yesterdaytotal)) + { + foreach ($yesterdaytotal as $ttl) + { + $strdayttl = $ttl->date; + $payamt = $ttl->payment_amt; + $recamt = $ttl->receipt_amt; + }} ?> @@ -47,17 +57,30 @@ if(!empty($Indiancurrency)) Date Account Name - Type + Type Received From Paid To - - Receipt - Payment + Receipt () + Payment () Description Action + Current Balances (₹) + + Yesterday Balances (opening balances) +   +   +   +   + + + +   +   +   + - - + + + Total +   +   +   +   + + +   +   + + - - Total -   -   -   -   - - - - - - - - - -   -   - - - - - - + + Today Closing Balances +   +   +   +   + + +   +   +   + + @@ -164,6 +178,7 @@ if(!empty($Indiancurrency)) "dom": "<'row'<'col-md-3'l><'col-md-9'Bf>>" + "<'row'<'col-md-6'><'col-md-6'>>" + "<'row'<'col-md-12't>><'row'<'col-md-4'i><'col-md-8'p>>", +"bSort": false, buttons: [ { diff --git a/application/views/cashbookyearlyexpenses.php b/application/views/cashbookyearlyexpenses.php index 81eef182..c3889c58 100755 --- a/application/views/cashbookyearlyexpenses.php +++ b/application/views/cashbookyearlyexpenses.php @@ -1,24 +1,38 @@ FontCode2000; - }} + }} + + + if(!empty($b4finyeartotal)){ + foreach ($b4finyeartotal as $prevttl) + { + //$payamt = $b4finyeartotal[0]->payment_amt; + //$recamt = $b4finyeartotal[0]->receipt_amt; + $payamt = $prevttl->payment_amt; + $recamt = $prevttl->receipt_amt; + }} + + +?> - -foreach($financialyear as $item) - - { - $finyear = $item->financial_year; - - } ?> - - - - - -
-
-
-
-
-
-

YEAR REPORTS()

-
-
- -
-
-
-
- + + - + - + - -
-
- -
+ +
+
+ +
-
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + +
+
+
+
Month Receipt Payment
month?>inc,2,'.',''); - echo number_format($yr->inc,2,'.','');?>exp,2,'.',''); - echo number_format($yr->exp,2,'.','');?>
+ + + + + + + + + + - - - + + + + + + + + + + + + + + + - - - - - - - - - - - - -
Month Receipt () Payment ()Current Balances ()
Total - Previous Year Balance(opening balances)
month?>inc,2,'.',''); + echo number_format($yr->inc,2,'.','');?>exp,2,'.',''); + echo number_format($yr->exp,2,'.','');?>
- - -
- -
-
-
-
- - - - - + } + ?> + + Total + + + + + + + + Current Year Closing Balances + + +   + + + + + + + + + + - - - - - - - + + + + + + + \ No newline at end of file diff --git a/application/views/cashbookyearmonthwise.php b/application/views/cashbookyearmonthwise.php index 7e9f9573..19ff26c2 100755 --- a/application/views/cashbookyearmonthwise.php +++ b/application/views/cashbookyearmonthwise.php @@ -53,8 +53,8 @@ if(!empty($Indiancurrency)) Paid Type - Receipt - Payment + Receipt () + Payment () @@ -168,7 +168,5 @@ $(document).ready(function() { } ); } ); - - \ No newline at end of file diff --git a/application/views/reportcashbook.php b/application/views/reportcashbook.php index 40304f0e..3a50f9ea 100755 --- a/application/views/reportcashbook.php +++ b/application/views/reportcashbook.php @@ -10,7 +10,12 @@ $month_in=''; $month_ex=''; $year_in=''; $year_ex=''; - +$in=0.00; +$payamt=0.00; +$recamt = 0.00; +$zero=0.00; +$curr_balances=0.00; + if(!empty($todayincome)) { foreach ($todayincome as $ti) @@ -58,6 +63,8 @@ if(!empty($yesterdaytotal)) { $strdaydate = $ttl->date; $strday_balances = ($ttl->payment_amt)-($ttl->receipt_amt); + $payamt = $ttl->payment_amt; + $recamt = $ttl->receipt_amt; } } if(!empty($prevmonthtotal)) @@ -72,7 +79,6 @@ if(!empty($b4finyeartotal)){ $preyear_balances = ($preyearttl->payment_amt) - ($preyearttl->receipt_amt); } } - ?> @@ -111,8 +117,8 @@ if(!empty($b4finyeartotal)){
-
-
+
+
@@ -120,7 +126,7 @@ if(!empty($b4finyeartotal)){
- + Opening Balances : Receipt : Payment : @@ -135,7 +141,7 @@ if(!empty($b4finyeartotal)){
- + Opening Balances : Receipt : Payment : @@ -150,7 +156,7 @@ if(!empty($b4finyeartotal)){
- + Opening Balances : Receipt : Payment : @@ -203,10 +209,24 @@ if(!empty($b4finyeartotal)){ Payment () Description File + Current Balances () + + Yesterday Balances (opening balances) +   +   +   +   + + + +   +   +   + + + + Total +   +   +   +   + + +   +   + + - - Total -   -   -   -   - - - - - - - - - -   -   - + + Today Closing Balances +   +   +   +   + + +   +   +   + @@ -293,6 +310,9 @@ if(!empty($b4finyeartotal)){
+
+ + @@ -310,24 +330,25 @@ if(!empty($b4finyeartotal)){