diff --git a/application/config/database.php b/application/config/database.php index 5d115e55..eb0df8a9 100644 --- a/application/config/database.php +++ b/application/config/database.php @@ -48,15 +48,15 @@ $active_group = 'default'; $active_record = TRUE; -$db['default']['hostname'] = 'localhost'; -$db['default']['username'] = 'root'; -$db['default']['password'] = ''; -$db['default']['database'] = 'kasiram9_SiddharthIndustries'; +// $db['default']['hostname'] = 'localhost'; +// $db['default']['username'] = 'root'; +// $db['default']['password'] = ''; +// $db['default']['database'] = 'kasiram9_SiddharthIndustries'; -// $db['default']['hostname'] = '35.213.153.5'; -// $db['default']['username'] = 'kasiram9_prod'; -// $db['default']['password'] = 'sia!1234'; -// $db['default']['database'] = 'kasiram9_SIAPROD'; +$db['default']['hostname'] = 'sidharthindustries.com'; +$db['default']['username'] = 'kasiram9_prod'; +$db['default']['password'] = 'sia!1234'; +$db['default']['database'] = 'kasiram9_SIAPROD'; // $db['default']['username'] = 'kasiram9_Siddh'; // $db['default']['password'] = 'sidh@1234'; // $db['default']['database'] = 'kasiram9_SIADEV'; diff --git a/application/controllers/cashbook.php b/application/controllers/cashbook.php index 3df295b3..170e2c14 100755 --- a/application/controllers/cashbook.php +++ b/application/controllers/cashbook.php @@ -246,7 +246,6 @@ class cashbook extends BaseController $fs = $this->uploadFile1(); // $this->function_alert($fs); - // echo "uploadFile1()".$fs;die(); $document = $path.$fs; $created_by = $this->session->userdata('userId'); @@ -272,12 +271,14 @@ class cashbook extends BaseController if($x == 21){ - $openingbalance=$sheet->getCell('H'.$x)->getValue(); + // $openingbalance=$sheet->getCell('H'.$x)->getValue(); + $openingbalance=preg_replace('/\D/', '', $sheet->getCell('H'.$highestRow4)->getValue()); } if($x == $highestRow4){ - $closingbalance=$sheet->getCell('H'.$highestRow4)->getValue(); + // $closingbalance=$sheet->getCell('H'.$highestRow4)->getValue(); + $closingbalance=preg_replace('/\D/', '', $sheet->getCell('H'.$highestRow4)->getValue()); } @@ -315,12 +316,12 @@ class cashbook extends BaseController } - $chqno = $sheet->getCell('C'.$x)->getValue(); + $chqno = (($sheet->getCell('C'.$x)->getValue() == '') || ($sheet->getCell('C'.$x)->getValue() == null)) ? $sheet->getCell('C'.$x)->getValue() : "-" ; $narration = $sheet->getCell('D'.$x)->getValue(); - $cod =$sheet->getCell('E'.$x)->getValue(); - $debit =$sheet->getCell('F'.$x)->getValue(); - $credit=$sheet->getCell('G'.$x)->getValue(); - $balance=$sheet->getCell('H'.$x)->getValue(); + $cod =(($sheet->getCell('E'.$x)->getValue() == '') || ($sheet->getCell('E'.$x)->getValue() == null)) ? $sheet->getCell('E'.$x)->getValue() : 0 ; + $debit = (($sheet->getCell('F'.$x)->getValue() == '') || ($sheet->getCell('F'.$x)->getValue() == null)) ? $sheet->getCell('F'.$x)->getValue() : 0 ; + $credit=(($sheet->getCell('G'.$x)->getValue() == '') || ($sheet->getCell('G'.$x)->getValue() == null)) ? $sheet->getCell('G'.$x)->getValue() : 0 ; + $balance=(($sheet->getCell('H'.$x)->getValue() == '') || ($sheet->getCell('H'.$x)->getValue() == null)) ? $sheet->getCell('H'.$x)->getValue() : 0 ; if($debit==0) { $Status=''; @@ -357,7 +358,7 @@ class cashbook extends BaseController { echo ""; } - } + } } function addIncomeExpense() @@ -602,17 +603,15 @@ class cashbook extends BaseController function uploadFile1() { - // echo "I am Here INSIDE UPLOAD"; - // die(); //$this->load->library('upload') $pathinfo = pathinfo($_FILES['userfile']['name']); $config['upload_path'] = 'uploads/banking/'; // $config['allowed_types'] = 'png|jpg|jpeg|xlsx'; - $config['allowed_types'] = 'xlsx|csv|xls'; + // $config['allowed_types'] = 'xlsx|csv|xls'; + $config['allowed_types'] = '*'; $config['file_name'] = $_FILES['userfile']['name']; $config['overwrite'] = true; - //Load upload library and initialize configuration $this->load->library('upload',$config); $this->upload->initialize($config); diff --git a/application/controllers/purchaseorder.php b/application/controllers/purchaseorder.php index 2affb607..5f035929 100755 --- a/application/controllers/purchaseorder.php +++ b/application/controllers/purchaseorder.php @@ -224,6 +224,8 @@ function edited(){ function CreatePurchaseOrder() { + // echo "@227 CreatePurchaseOrder"."
"; + // echo '
'.print_r($this->input->post(),true).'
'."
"; // if( $DEPCode == PURCHASE) // { @@ -237,21 +239,17 @@ function edited(){ } else { - + // echo "@242 else proceed"."
"; $this->global['pageTitle'] = 'Siddharth : Purchase order' ; $data['TaxType'] = $this->purchaseorder_model->getConfigValue('C006'); $data['FreightType'] = $this->purchaseorder_model->getConfigValue('C018'); $data['Suplist'] = $this->purchaseorder_model->getSupplierName(); $data['Payment']=$this->purchaseorder_model->getPaymentTermsDetails(); - // print_r($data['Payment']); - - $data['WorkStatus']=$this->purchaseorder_model->getStatus(7); - - - - - + $data['WorkStatus']=$this->purchaseorder_model->getStatus(7); $SelectedReq = json_decode($this->input->post('txtReqNo')); + // echo '
'.print_r($SelectedReq,true).'
'."
"; + // echo "@250 SelectedReq = ".$SelectedReq."
"; + // die; $Req = $SelectedReq->Req; $data['ReqList'] = $Req ; @@ -271,7 +269,7 @@ function edited(){ $data['MaterialList'] = $result; - //print_r($data['MaterialList']); + // echo '
'.print_r($data['MaterialList'],true).'
'."
";die; /* Cost code from Requisition - Client Review Fix Start here */ $ReqDetails = $this->purchaseorder_model->getRequistDetails($ReqArray); @@ -301,7 +299,7 @@ function edited(){ foreach ($ReqDetails as $Rs): $CostCode = $Rs->CostCenterCode; endforeach; - + $AvlBudget = $this->purchaseorder_model->GetAvailableBudgetAmount($CostCode,$FYdt,$ReqType); @@ -375,6 +373,8 @@ function edited(){ } $ViewName = 'capitalpurchaseorder'; } + // echo '@376 final step '.$ViewName; + // echo '
'.print_r($data,true).'
'."
";die(); $this->loadViews($ViewName, $this->global,$data, NULL); } // } @@ -1042,9 +1042,8 @@ function edited(){ function addNewPurchaseOrder() { - - - + // print_r($this->input->post()); + // echo "@1100 i have pomaster = ".'
'.print_r($this->input->post(),true).'
'."
"; $POdt =$this->input->post('PODate'); $PODate = $this->getDateformat($POdt); $SupplierID = $this->input->post('drpSupplier'); @@ -1052,22 +1051,16 @@ function edited(){ $dt = $this->input->post('Deliverydt'); $POType = $this->input->post('POType'); $DeliveryOption = $this->input->post('DateRange'); - if($DeliveryOption==1){ - $Deliverydt = ''; - $DeliverySchedule = $this->input->post('Scheduleby'); - } - else{ - $Deliverydt = $this->getDateformat($dt); - $DeliverySchedule = ''; - } - - + if($DeliveryOption==1){ + $Deliverydt = ''; + $DeliverySchedule = $this->input->post('Scheduleby'); + }else{ + $Deliverydt = $this->getDateformat($dt); + $DeliverySchedule = ''; + } $POType = $this->input->post('POType'); $BudgetType = $this->input->post('Budget'); - - //$PoRange = $this->input->post('txtPoRange'); - $Modeofshipment=$this->input->post('addmodeofshipment'); $supplierreference=$this->input->post('addsupplierreference'); $supplieroffno=$this->input->post('addsupplierofferno'); @@ -1082,38 +1075,32 @@ function edited(){ } $SpcialInstruction = $this->input->post('SpcialInstruction'); $TotalOrderValueSummary = $this->input->post('txtTotalOrderValueSummary'); - $POStatus = $this->input->post('txtStatus'); - - $CreateBy = $this->session->userdata ( 'userId' ); + $POStatus = $this->input->post('txtStatus'); + $CreateBy = $this->session->userdata ( 'userId' ); $RowCount = $this->input->post('txtRowCount'); $DeletedRow = $this->input->post('txtDeletedRow'); - + // echo "DeletedRow = ".$DeletedRow; $comma_separated = explode(':', $DeletedRow); $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $createddt = $dt->format('Y-m-d H:i:s'); $PaymentTerms=$this->input->post('PaymentTerms'); - $OtherPayment=$this->input->post('Otherpayment'); + $OtherPayment=$this->input->post('Otherpayment'); $Local_Interstate=$this->input->post('Range'); $Qualitycheck=1; // PO Master - $POList = array('SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrderValueSummary,'PODate'=>$PODate,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'Status'=>$POStatus,'PORange'=>$Local_Interstate,'ServiceDescription'=>$SpcialInstruction,'CreatedBy'=>$CreateBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'CreatedDate'=>$createddt,'PaymentTerms'=>$PaymentTerms,'POType'=>$POType,'CapitalRange'=>$Local_Interstate,'PaymentOtherDescription'=>$OtherPayment,'Supplier_Reference'=>$supplierreference,'Mode_Of_Shipment'=>$Modeofshipment,'Supplier_Offer_No'=>$supplieroffno,'Other_Reference'=>$otherreference,'Fincap'=>$fincap,'InsuranceStatus'=>$insurancestatus,'POSubType'=>$revenuetype,'InsuranceNumber'=>$insuranceno,'IsQualityChkReqired'=>$Qualitycheck,'BudgetType'=>$BudgetType); - - // print_r($POList); - // die(); - - - $POMaster = $this->purchaseorder_model->addPOMaster($POList,$POType,$revenuetype); - + $POList = array('SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrderValueSummary,'PODate'=>$PODate,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'Status'=>$POStatus,'PORange'=>$Local_Interstate,'ServiceDescription'=>$SpcialInstruction,'CreatedBy'=>$CreateBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'CreatedDate'=>$createddt,'PaymentTerms'=>$PaymentTerms,'POType'=>$POType,'CapitalRange'=>$Local_Interstate,'PaymentOtherDescription'=>$OtherPayment,'Supplier_Reference'=>$supplierreference,'Mode_Of_Shipment'=>$Modeofshipment,'Supplier_Offer_No'=>$supplieroffno,'Other_Reference'=>$otherreference,'Fincap'=>$fincap,'InsuranceStatus'=>$insurancestatus,'POSubType'=>$revenuetype,'InsuranceNumber'=>$insuranceno,'IsQualityChkReqired'=>$Qualitycheck,'BudgetType'=>$BudgetType); + $POMaster = $this->purchaseorder_model->addPOMaster($POList,$POType,$revenuetype); + // echo "@1100 i have pomaster = ".'
'.print_r($POMaster,true).'
'."
";die(); $PONO = ''; if(count($POMaster)>0) { $PONO = $POMaster[0]['PONO']; } - + // $PONO = "SIA/2021-2022/10044"; // PO Line Items $LineItemStatus = REQITEM_NEW; @@ -1144,10 +1131,11 @@ function edited(){ $CostCenter = $this->input->post('costCode'.$i); $Cgst = $this->input->post('RevenueCgst'.$i); $Sgst = $this->input->post('RevenueSgst'.$i); - $Igst = $this->input->post('RevenueIgst'.$i); - $AfterCgst = $this->input->post('RevenueAfterCgst'.$i); - $AfterSgst = $this->input->post('RevenueAfterSgst'.$i); - $AfterIgst = $this->input->post('RevenueAfterIgst'.$i); + $Igst = $this->input->post('RevenueIgst'.$i); + $AfterCgst = $this->input->post('RevenueAfterCgst'.$i); + $AfterSgst = $this->input->post('RevenueAfterSgst'.$i); + $AfterIgst = $this->input->post('RevenueAfterIgst'.$i); + $SkipInsert = "False"; if( count($comma_separated) > 0) { @@ -1166,15 +1154,19 @@ function edited(){ if($SkipInsert == "False") { $POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Per'=>$per,'ServiceMaterialDescription'=>$revenuedescription,'Status'=>$LineItemStatus,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'CostCenterCode'=>$CostCenter); - //print_r($POLineItemList); $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList); - + // echo "@1162 i have polineitem arr ".'
'.print_r($POLineItem,true).'
'."
"; + // [PONO] => SIA/2021-2022/10044 + // [ReqNo] => REQ7704 + // [LineItemNo] => POItem9999 + // $LineItemNo = "POItem10360"; $LineItemNo = ''; if(count($POLineItem)>0) { $LineItemNo = $POLineItem[0]['LineItemNo']; } - //echo $LineItemNo; + // echo $LineItemNo; die; + // echo "POType ".$POType."
"; /*---------*/ // $logpo =array('PONO'=>$PONO,'Date'=>$PODate,'POType'=>$POType,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'SupplierID'=>$SupplierID,'LineItemNos'=>$LineItemNo); @@ -1184,8 +1176,9 @@ function edited(){ { // echo 'Success'; $RevenueTaxList = array('LineItemNo'=>$LineItemNo, 'DiscountType'=>$DiscountType,'DiscountValue'=>$DiscountValue,'AfterDiscount'=>$AfterDiscount,'PackagingType'=>$PackagingType,'PackagingValue'=>$PackagingValue,'PackagingCalulatedOn'=>$PackagingOption,'AfterPackagingValue'=>$AfterPackagingValue,'FreightType'=>$FreightType, 'FreightValue'=>$FreightValue,'AfterFreightValue'=>$AfterFreightValue,'Insurance'=>$InsuranceValue,'TotalValue'=>$TotalOrderValue, 'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'CGST'=>$Cgst,'AfterCGST'=>$AfterCgst,'SGST'=>$Sgst,'AfterSGST'=>$AfterSgst,'IGST'=>$Igst,'AfterIGST'=>$AfterIgst,'NoOfTrip'=>$NOOfTrip); - //print_r($RevenueTaxList); + // echo "@1176 i have arr for tax ".'
'.print_r($RevenueTaxList,true).'
'."
"; $RevenueList = $this->purchaseorder_model->addRevenueTax($RevenueTaxList); + // echo "@1183 i have after insertion ".'
'.print_r($RevenueList,true).'
'."
"; //echo 'Revenue tax Success'; } } diff --git a/application/models/purchaseorder_model.php b/application/models/purchaseorder_model.php index 4e676dd9..ebf30268 100755 --- a/application/models/purchaseorder_model.php +++ b/application/models/purchaseorder_model.php @@ -1,4 +1,4 @@ - db->last_query()); if($insert_id>0) { - $subQuery = 'select max(LineItemNo) as LineItemNo from T_PurchaseOrder_LineItem'; - + // $subQuery = 'select max(LineItemNo) as LineItemNo from T_PurchaseOrder_LineItem'; + $subQuery = 'SELECT * FROM T_PurchaseOrder_LineItem where PONO = "'.$POLineItem['PONO'].'" ORDER BY LineItemNo DESC'; + $query = $this->db->query($subQuery); return $query->result_array(); @@ -909,9 +910,12 @@ function GetPOType($ReqNo) { $this->db->trans_start(); $this->db->insert('T_Revenue_Tax', $RevenueTaxList); - $insert_id = $this->db->affected_rows(); $this->db->trans_complete(); - return $insert_id; + $insert_id = $this->db->insert_id(); + $aff_row = $this->db->affected_rows(); + // print_r( $this->db->last_query()); die(); + // echo "aff_row".$aff_row." $insert_id".$insert_id; + return $aff_row > 0 ? $this->db->insert_id() : 0; } /** * This function is used to add Service Tax to the system @@ -920,9 +924,9 @@ function GetPOType($ReqNo) { $this->db->trans_start(); $this->db->insert('T_Service_Tax', $ServiceTaxList); - $insert_id = $this->db->affected_rows(); $this->db->trans_complete(); - return $insert_id; + $insert_id = $this->db->affected_rows(); + return $insert_id>0 ? $this->db->insert_id() : 0; } @@ -933,9 +937,9 @@ function GetPOType($ReqNo) { $this->db->trans_start(); $this->db->insert('T_Import_Tax', $ImportTaxList); - $insert_id = $this->db->affected_rows(); $this->db->trans_complete(); - return $insert_id; + $insert_id = $this->db->affected_rows(); + return $insert_id>0 ? $this->db->insert_id() : 0; } @@ -1073,7 +1077,7 @@ function GetPOType($ReqNo) AfterIGST )) as Taxamount ,TotalValue,Tax.*,Req.CostCenterCode,Dept.DepartmentName FROM T_PurchaseOrder_LineItem LineItem join T_MaterialMaster Mat on Mat.MaterialCode = LineItem.MaterialCode - join T_Revenue_Tax Tax on Tax.LineItemNo = LineItem.LineItemNo + left join T_Revenue_Tax Tax on Tax.LineItemNo = LineItem.LineItemNo join T_Requestion_Master Req on Req.ReqNo = LineItem.ReqNo left join T_Employee_Details emp on Req.Requestedby = emp.EmpID join T_DepartmentDetails Dept on Req.RequestedDept = Dept.DEPCode @@ -1096,11 +1100,11 @@ function GetPOType($ReqNo) AfterIGST)) ,2)as Taxamount,AdvanceAmount, TotalValue,Tax.*,LineItem.CostCenterCode ,POMaster.*,sup.SupplierName,sup.Address,sup.SupplierID,sup.ContactNumber,sup.EmailAddress,sup.PAN,sup.GSTNO,LineItem.AmendedDetails as LineAmend,Payment.PaymentTerms FROM T_PurchaseOrder_LineItem LineItem - join T_MaterialMaster Mat on Mat.MaterialCode = LineItem.MaterialCode - join T_Revenue_Tax Tax on Tax.LineItemNo = LineItem.LineItemNo + left join T_MaterialMaster Mat on Mat.MaterialCode = LineItem.MaterialCode + left join T_Revenue_Tax Tax on Tax.LineItemNo = LineItem.LineItemNo join T_PurchaseOrder_Master POMaster on POMaster.PONO = LineItem.PONO join T_SupplierDetailsN sup on sup.SupplierID = POMaster.SupplierID - join T_PaymentTerms Payment on Payment.PaymentID = POMaster.PaymentTerms + left join T_PaymentTerms Payment on Payment.PaymentID = POMaster.PaymentTerms left join T_PurchaseOrder_AdvanceRequest PurAdv on POMaster.PONO=PurAdv.PONO where LineItem.PONO =?'; @@ -2538,4 +2542,4 @@ function getigrno($bill){ return $query->result_array(); } /*** ----------------------------- */ -} +} \ No newline at end of file diff --git a/index.php b/index.php index 2b208808..1f5f6117 100755 --- a/index.php +++ b/index.php @@ -33,7 +33,7 @@ if (defined('ENVIRONMENT')) switch (ENVIRONMENT) { case 'development': - error_reporting(E_ALL); + error_reporting(0); break; case 'testing': diff --git a/uploads/banking/May-21-IB.xlsx b/uploads/banking/May-21-IB.xlsx new file mode 100644 index 00000000..730a7136 Binary files /dev/null and b/uploads/banking/May-21-IB.xlsx differ diff --git a/uploads/banking/Nov - 21.xlsx b/uploads/banking/Nov - 21.xlsx new file mode 100644 index 00000000..88f98147 Binary files /dev/null and b/uploads/banking/Nov - 21.xlsx differ