view,model,controller,helper server code : ps
This commit is contained in:
parent
6074d6496c
commit
48eb7b0ef7
@ -47,18 +47,22 @@
|
|||||||
|
|
||||||
$active_group = 'default';
|
$active_group = 'default';
|
||||||
$active_record = TRUE;
|
$active_record = TRUE;
|
||||||
// old DB
|
|
||||||
// $db['default']['hostname'] = '52.172.253.20';
|
// $db['default']['hostname'] = 'localhost';
|
||||||
// $db['default']['username'] = 'kasiram9_prod';
|
// $db['default']['username'] = 'kasiram9_prod';
|
||||||
// $db['default']['password'] = 'sia!1234';
|
// $db['default']['password'] = 'sia!1234';
|
||||||
// $db['default']['database'] = 'kasiram9_SIAPROD';
|
// $db['default']['database'] = 'kasiram9_SIAPROD';
|
||||||
|
|
||||||
// new DB
|
|
||||||
$db['default']['hostname'] = '119.18.54.85';
|
$db['default']['hostname'] = '119.18.54.85';
|
||||||
$db['default']['username'] = 'venbaehn_sia';
|
$db['default']['username'] = 'venbaehn_sia';
|
||||||
$db['default']['password'] = 'gmjGKp8DyyxqnSc';
|
$db['default']['password'] = 'gmjGKp8DyyxqnSc';
|
||||||
$db['default']['database'] = 'venbaehn_sia';
|
$db['default']['database'] = 'venbaehn_sia';
|
||||||
|
|
||||||
|
// $db['default']['hostname'] = 'vprodb1.mysql.database.azure.com';
|
||||||
|
// $db['default']['username'] = 'dbroot';
|
||||||
|
// $db['default']['password'] = 'root@DB23';
|
||||||
|
// $db['default']['database'] = 'sia_prod';
|
||||||
|
|
||||||
$db['default']['dbdriver'] = 'mysqli';
|
$db['default']['dbdriver'] = 'mysqli';
|
||||||
$db['default']['dbprefix'] = '';
|
$db['default']['dbprefix'] = '';
|
||||||
$db['default']['pconnect'] = TRUE;
|
$db['default']['pconnect'] = TRUE;
|
||||||
|
|||||||
@ -271,7 +271,7 @@ function add($pathname)
|
|||||||
{
|
{
|
||||||
|
|
||||||
//echo "t54";
|
//echo "t54";
|
||||||
log_message('error'," Service Emr-po FNS.");
|
|
||||||
|
|
||||||
//die();
|
//die();
|
||||||
|
|
||||||
@ -379,7 +379,6 @@ function add($pathname)
|
|||||||
if(count($Req)>0)
|
if(count($Req)>0)
|
||||||
{
|
{
|
||||||
$RegNo = $Req[0]['ReqNo'];
|
$RegNo = $Req[0]['ReqNo'];
|
||||||
log_message('error'," Service Emr-po Requistion Number. ".$RegNo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -391,7 +390,6 @@ function add($pathname)
|
|||||||
if(count($POMaster)>0)
|
if(count($POMaster)>0)
|
||||||
{
|
{
|
||||||
$PONO = $POMaster[0]['PONO'];
|
$PONO = $POMaster[0]['PONO'];
|
||||||
log_message('error'," Service Emr-po Number. ".$PONO);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$RegDetailsStatus=REQITEM_POCREATED;
|
$RegDetailsStatus=REQITEM_POCREATED;
|
||||||
@ -447,7 +445,6 @@ function add($pathname)
|
|||||||
if(count($ReqDetQuery)>0)
|
if(count($ReqDetQuery)>0)
|
||||||
{
|
{
|
||||||
$ItemNo = $ReqDetQuery[0]['ItemNo'];
|
$ItemNo = $ReqDetQuery[0]['ItemNo'];
|
||||||
log_message('error'," Service Emr-po Requistion Lineitem . ".$ItemNo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$RegNo,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'CostCenterCode'=>$CostCenter,'ServiceMaterialDescription'=>$ServiceMaterialDescription,'ServiceFrequency'=>$ServiceFrequency,'Per'=>$Per,'ItemNo'=>$ItemNo);
|
$POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$RegNo,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'CostCenterCode'=>$CostCenter,'ServiceMaterialDescription'=>$ServiceMaterialDescription,'ServiceFrequency'=>$ServiceFrequency,'Per'=>$Per,'ItemNo'=>$ItemNo);
|
||||||
@ -458,7 +455,6 @@ function add($pathname)
|
|||||||
if(count($POLineItem)>0)
|
if(count($POLineItem)>0)
|
||||||
{
|
{
|
||||||
$LineItemNo = $POLineItem[0]['LineItemNo'];
|
$LineItemNo = $POLineItem[0]['LineItemNo'];
|
||||||
log_message('error'," Service Emr-po Lineitem . ".$LineItemNo);
|
|
||||||
}
|
}
|
||||||
if(trim($POType) == SERVICE )
|
if(trim($POType) == SERVICE )
|
||||||
{
|
{
|
||||||
@ -466,7 +462,6 @@ function add($pathname)
|
|||||||
$ServiceTaxList = array('LineItemNo'=>$LineItemNo, 'CGST'=>$Cgst,'After_CGST'=>$AfterCgst,'SGST'=>$Sgst,'After_SGST'=>$AfterSgst,'IGST'=>$Igst,'After_IGST'=>$AfterIgst,'otherallowance'=>$OtherAmt,'TotalValue'=>$TotalOrderValue, 'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt);
|
$ServiceTaxList = array('LineItemNo'=>$LineItemNo, 'CGST'=>$Cgst,'After_CGST'=>$AfterCgst,'SGST'=>$Sgst,'After_SGST'=>$AfterSgst,'IGST'=>$Igst,'After_IGST'=>$AfterIgst,'otherallowance'=>$OtherAmt,'TotalValue'=>$TotalOrderValue, 'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt);
|
||||||
|
|
||||||
$ServiceTax = $this->purchaseorder_model->addServiceTax($ServiceTaxList);
|
$ServiceTax = $this->purchaseorder_model->addServiceTax($ServiceTaxList);
|
||||||
log_message('error'," Service Emr-po Tax ID . ".$ServiceTax);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -499,12 +494,11 @@ $prefile =array();
|
|||||||
|
|
||||||
|
|
||||||
$pathname = 'browseFiles'.$i;
|
$pathname = 'browseFiles'.$i;
|
||||||
log_message('error'," Service Emr-po Browse File Path Name ".$pathname);
|
|
||||||
if(!empty($_FILES[$pathname]['name']))
|
if(!empty($_FILES[$pathname]['name']))
|
||||||
{
|
{
|
||||||
|
|
||||||
$files = str_replace(" ","",$_FILES[$pathname]['name']);
|
$files = str_replace(" ","",$_FILES[$pathname]['name']);
|
||||||
log_message('error'," Service Emr-po File Name ".$files);
|
|
||||||
|
|
||||||
$fcount = 0;
|
$fcount = 0;
|
||||||
|
|
||||||
@ -528,7 +522,6 @@ $prefile =array();
|
|||||||
{
|
{
|
||||||
$Picture = $this->add($pathname);
|
$Picture = $this->add($pathname);
|
||||||
//echo $Picture;
|
//echo $Picture;
|
||||||
log_message('error'," Revenue Emr-po File status ".$Picture);
|
|
||||||
$arr[] = array($Picture);
|
$arr[] = array($Picture);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -555,8 +548,7 @@ $prefile =array();
|
|||||||
{
|
{
|
||||||
|
|
||||||
$myfile = array('FilePath'=>$filename,'PONO'=>$PONO);
|
$myfile = array('FilePath'=>$filename,'PONO'=>$PONO);
|
||||||
$fileno = $this->purchaseorder_model->fileupload($myfile);
|
$this->purchaseorder_model->fileupload($myfile);
|
||||||
log_message('error'," Revenue Emr-po File Number.".$fileno);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -572,7 +564,6 @@ $prefile =array();
|
|||||||
|
|
||||||
|
|
||||||
echo "<script>alert('You Have Successfully Saved the Purchase order! $PONO');</script>";
|
echo "<script>alert('You Have Successfully Saved the Purchase order! $PONO');</script>";
|
||||||
log_message('error'," Service Emr-po successfully created. ".$PONO."-".$POStatus);
|
|
||||||
redirect('purchaseorder/PurchaseOrderList','refresh');
|
redirect('purchaseorder/PurchaseOrderList','refresh');
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -581,7 +572,6 @@ $prefile =array();
|
|||||||
// echo 'Emergency Service Purchase Order Created Successfully!The PO NO Is: '.$PONO;
|
// echo 'Emergency Service Purchase Order Created Successfully!The PO NO Is: '.$PONO;
|
||||||
|
|
||||||
echo "<script>alert('You Have Successfully created the Purchase order! $PONO');</script>";
|
echo "<script>alert('You Have Successfully created the Purchase order! $PONO');</script>";
|
||||||
log_message('error'," Service Emr-po successfully created. ".$PONO."-".$POStatus);
|
|
||||||
redirect('purchaseorder/PurchaseOrderList','refresh');
|
redirect('purchaseorder/PurchaseOrderList','refresh');
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -594,17 +584,17 @@ $prefile =array();
|
|||||||
//This used to Create Revenue Emergency Purchase Order
|
//This used to Create Revenue Emergency Purchase Order
|
||||||
function addNewRevenuePurchaseOrder()
|
function addNewRevenuePurchaseOrder()
|
||||||
{
|
{
|
||||||
log_message('error'," Revenue Emr-po FNS.");
|
|
||||||
|
|
||||||
$txtspl=$this->input->post('txtSpecial');
|
$txtspl=$this->input->post('txtSpecial');
|
||||||
// echo "\n *** txtspl".$txtspl;
|
|
||||||
|
|
||||||
$POdt =$this->input->post('PODate');
|
$POdt =$this->input->post('PODate');
|
||||||
$PODate = $this->getDateformat($POdt);
|
$PODate = $this->getDateformat($POdt);
|
||||||
$SupplierID = $this->input->post('drpSupplier');
|
$SupplierID = $this->input->post('drpSupplier');
|
||||||
$DeliveryAddr = $this->input->post('DeliveryAddr');
|
$DeliveryAddr = $this->input->post('DeliveryAddr');
|
||||||
$dt = $this->input->post('Deliverydt');
|
$dt = $this->input->post('Deliverydt');
|
||||||
$DeliveryOption = $this->input->post('DateRange');
|
$DeliveryOption = $this->input->post('DateRange');
|
||||||
// echo "\n DeliveryOption ".$DeliveryOption;
|
|
||||||
if($DeliveryOption==1){
|
if($DeliveryOption==1){
|
||||||
$Deliverydt = '';
|
$Deliverydt = '';
|
||||||
$DeliverySchedule = $this->input->post('Scheduleby');
|
$DeliverySchedule = $this->input->post('Scheduleby');
|
||||||
@ -621,9 +611,11 @@ $prefile =array();
|
|||||||
$fincap=$this->input->post('emergfincap');
|
$fincap=$this->input->post('emergfincap');
|
||||||
$revenuetype=$this->input->post('PoTypeOptions');
|
$revenuetype=$this->input->post('PoTypeOptions');
|
||||||
$insurancestatus=$this->input->post('insuranceStatus');
|
$insurancestatus=$this->input->post('insuranceStatus');
|
||||||
if($insurancestatus == 1) $insuranceno=$this->input->post('insuranceNo');
|
if($insurancestatus == 1){
|
||||||
else $insuranceno="";
|
$insuranceno=$this->input->post('insuranceNo');
|
||||||
|
}else{
|
||||||
|
$insuranceno="";
|
||||||
|
}
|
||||||
$CostCenterName = $this->input->post('CostCenterName');
|
$CostCenterName = $this->input->post('CostCenterName');
|
||||||
$POType = $this->input->post('POType');
|
$POType = $this->input->post('POType');
|
||||||
$PoRange = $this->input->post('txtPoRange');
|
$PoRange = $this->input->post('txtPoRange');
|
||||||
@ -632,12 +624,17 @@ $prefile =array();
|
|||||||
$RequistionComments = "Created Emergency Revenue PO";
|
$RequistionComments = "Created Emergency Revenue PO";
|
||||||
$TotalOrderValueSummary = $this->input->post('txtTotalOrderValueSummary');
|
$TotalOrderValueSummary = $this->input->post('txtTotalOrderValueSummary');
|
||||||
|
|
||||||
if($txtspl==0) $POStatus=REQITEM_Emergency_PO_CREATED;
|
if($txtspl==0)
|
||||||
else $POStatus=SPECIAL_PO;
|
{
|
||||||
|
$POStatus=REQITEM_Emergency_PO_CREATED;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$POStatus=SPECIAL_PO;
|
||||||
|
}
|
||||||
|
|
||||||
// echo "\n *** POStatus ".$POStatus;
|
|
||||||
//$POStatus = $this->input->post('TextStatus');
|
//$POStatus = $this->input->post('TextStatus');
|
||||||
$RequestedBy = $this->input->post('drpDepartment');
|
$RequestedBy = $this->input->post('drpDepartment');
|
||||||
$CreateBy = $this->session->userdata ( 'userId' );
|
$CreateBy = $this->session->userdata ( 'userId' );
|
||||||
// $RowCount = $this->input->post('TextRowCount');
|
// $RowCount = $this->input->post('TextRowCount');
|
||||||
|
|
||||||
@ -649,7 +646,11 @@ $prefile =array();
|
|||||||
// $DeletedRow = $this->input->post('TextDeletedRowCount');
|
// $DeletedRow = $this->input->post('TextDeletedRowCount');
|
||||||
|
|
||||||
$DeletedRow = $this->input->post('txtDeletedRow1');
|
$DeletedRow = $this->input->post('txtDeletedRow1');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$splRow = $this->input->post('splrow');
|
$splRow = $this->input->post('splrow');
|
||||||
|
|
||||||
// echo $DeletedRow;
|
// echo $DeletedRow;
|
||||||
|
|
||||||
$ReqStatus = REQITEM_Emergency_PO_CREATED;
|
$ReqStatus = REQITEM_Emergency_PO_CREATED;
|
||||||
@ -662,36 +663,38 @@ $prefile =array();
|
|||||||
$PaymentTerms=$this->input->post('PaymentMethod');
|
$PaymentTerms=$this->input->post('PaymentMethod');
|
||||||
$OtherPayment=$this->input->post('Otherpayment');
|
$OtherPayment=$this->input->post('Otherpayment');
|
||||||
|
|
||||||
if($POStatus==SPECIAL_PO) $Qualitycheck=$this->input->post('txtQuality');
|
if($POStatus==SPECIAL_PO)
|
||||||
else $Qualitycheck=1;
|
{
|
||||||
|
$Qualitycheck=$this->input->post('txtQuality');
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$Qualitycheck=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//add requistion
|
//add requistion
|
||||||
$Request = array('ReqType'=>$POType, 'RequestedDept'=>$RequestedBy,'CostCenterCode'=>$CostCenterName,'Status'=>$ReqStatus,'Comments'=>$RequistionComments,'ReqDate'=>$createddt,'CreatedDate'=>$createddt,'CreatedBy'=>$CreateBy);
|
$Request = array('ReqType'=>$POType, 'RequestedDept'=>$RequestedBy,'CostCenterCode'=>$CostCenterName,'Status'=>$ReqStatus,'Comments'=>$RequistionComments,'ReqDate'=>$createddt,'CreatedDate'=>$createddt,'CreatedBy'=>$CreateBy);
|
||||||
// print_r($Request);
|
|
||||||
// echo "\n *** ";
|
|
||||||
|
|
||||||
$Req = $this->requistion_model->addRequistion($Request);
|
$Req = $this->requistion_model->addRequistion($Request);
|
||||||
//$RegNo='01';
|
|
||||||
$RegNo='';
|
$RegNo='';
|
||||||
if(count($Req)>0)
|
if(count($Req)>0)
|
||||||
{
|
{
|
||||||
$RegNo = $Req[0]['ReqNo'];
|
$RegNo = $Req[0]['ReqNo'];
|
||||||
log_message('error'," Revenue Emr-po Req Raised Number".$RegNo);
|
|
||||||
}
|
}
|
||||||
// echo "i HAVE".$RegNo;
|
|
||||||
// die();
|
|
||||||
// PO Master
|
// PO Master
|
||||||
|
|
||||||
$POList = array('SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrderValueSummary,'PODate'=>$PODate,'Status'=>$POStatus,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'PORange'=>$Local_Interstate,'ServiceDescription'=>$SpcialInstruction,'CreatedBy'=>$CreateBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'CreatedDate'=>$createddt,'PaymentTerms'=>$PaymentTerms,'POType'=>$POType,'CapitalRange'=>$Local_Interstate,'PaymentOtherDescription'=>$OtherPayment,'Mode_Of_Shipment'=>$Modeofshipment,'Supplier_Offer_No'=>$supplieroffno,'Supplier_Reference'=>$supplierreference,'Other_Reference'=>$otherreference,'InsuranceNumber'=>$insuranceno,'InsuranceStatus'=>$insurancestatus,'Fincap'=>$fincap,'POSubType'=>$revenuetype,'IsQualityChkReqired'=>$Qualitycheck,'BudgetType'=>$BudgetType);
|
$POList = array('SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrderValueSummary,'PODate'=>$PODate,'Status'=>$POStatus,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'PORange'=>$Local_Interstate,'ServiceDescription'=>$SpcialInstruction,'CreatedBy'=>$CreateBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'CreatedDate'=>$createddt,'PaymentTerms'=>$PaymentTerms,'POType'=>$POType,'CapitalRange'=>$Local_Interstate,'PaymentOtherDescription'=>$OtherPayment,'Mode_Of_Shipment'=>$Modeofshipment,'Supplier_Offer_No'=>$supplieroffno,'Supplier_Reference'=>$supplierreference,'Other_Reference'=>$otherreference,'InsuranceNumber'=>$insuranceno,'InsuranceStatus'=>$insurancestatus,'Fincap'=>$fincap,'POSubType'=>$revenuetype,'IsQualityChkReqired'=>$Qualitycheck,'BudgetType'=>$BudgetType);
|
||||||
//print_r($POList);
|
//print_r($POList);
|
||||||
//echo "\n *** ";
|
|
||||||
$POMaster = $this->purchaseorder_model->addPOMaster($POList,$POType,$revenuetype);
|
$POMaster = $this->purchaseorder_model->addPOMaster($POList,$POType,$revenuetype);
|
||||||
|
|
||||||
$PONO = '';
|
$PONO = '';
|
||||||
if(count($POMaster)>0)
|
if(count($POMaster)>0)
|
||||||
{
|
{
|
||||||
$PONO = $POMaster[0]['PONO'];
|
$PONO = $POMaster[0]['PONO'];
|
||||||
log_message('error'," Revenue Emr-po Number .".$PONO);
|
|
||||||
}
|
}
|
||||||
//echo $PONO;
|
//echo $PONO;
|
||||||
// PO Line Items
|
// PO Line Items
|
||||||
@ -748,21 +751,18 @@ $prefile =array();
|
|||||||
{
|
{
|
||||||
//add requistion details
|
//add requistion details
|
||||||
$ReqDetails = array('ReqNo'=>$RegNo, 'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Status'=>$RegDetailsStatus,'UpdatedBy'=>$CreateBy,'UpdatedOn'=>$createddt);
|
$ReqDetails = array('ReqNo'=>$RegNo, 'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Status'=>$RegDetailsStatus,'UpdatedBy'=>$CreateBy,'UpdatedOn'=>$createddt);
|
||||||
// print_r($ReqDetails);
|
|
||||||
|
|
||||||
$ReqDetQuery = $this->requistion_model->addRequistionDetails($ReqDetails);
|
$ReqDetQuery = $this->requistion_model->addRequistionDetails($ReqDetails);
|
||||||
log_message('error'," Revenue Emr-po RequistionDetails count . ".count($ReqDetQuery)." ReqNo".isset($ReqDetQuery[0]['ItemNo'])?$ReqDetQuery[0]['ItemNo']:" -- ");
|
|
||||||
|
|
||||||
$POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$RegNo,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'CostCenterCode'=>$CostCenter,'Per'=>$per,'ServiceMaterialDescription'=>$revenuedescription);
|
$POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$RegNo,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'CostCenterCode'=>$CostCenter,'Per'=>$per,'ServiceMaterialDescription'=>$revenuedescription);
|
||||||
//print_r($POLineItemList);
|
//print_r($POLineItemList);
|
||||||
//echo "\n *** ";
|
|
||||||
$POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList);
|
$POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList);
|
||||||
|
|
||||||
//$LineItemNo = 'LI000';
|
|
||||||
$LineItemNo = '';
|
$LineItemNo = '';
|
||||||
if(count($POLineItem)>0)
|
if(count($POLineItem)>0)
|
||||||
{
|
{
|
||||||
$LineItemNo = $POLineItem[0]['LineItemNo'];
|
$LineItemNo = $POLineItem[0]['LineItemNo'];
|
||||||
log_message('error'," Revenue Emr-po Line Item Number . ".$LineItemNo);
|
|
||||||
}
|
}
|
||||||
//echo $LineItemNo;
|
//echo $LineItemNo;
|
||||||
|
|
||||||
@ -771,6 +771,8 @@ $prefile =array();
|
|||||||
|
|
||||||
// $logaddpo = $this->purchaseorder_model->newlogpo($logpo);
|
// $logaddpo = $this->purchaseorder_model->newlogpo($logpo);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*----------------------------*/
|
/*----------------------------*/
|
||||||
|
|
||||||
|
|
||||||
@ -779,10 +781,8 @@ $prefile =array();
|
|||||||
// echo 'Success';
|
// 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);
|
$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);
|
//print_r($RevenueTaxList);
|
||||||
//echo "\n";
|
|
||||||
$RevenueList = $this->purchaseorder_model->addRevenueTax($RevenueTaxList);
|
$RevenueList = $this->purchaseorder_model->addRevenueTax($RevenueTaxList);
|
||||||
//echo 'Revenue tax Success';
|
//echo 'Revenue tax Success';
|
||||||
log_message('error'," Revenue Emr-po tax Successfully . ");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -791,8 +791,14 @@ $prefile =array();
|
|||||||
|
|
||||||
if($txtspl==1 || $txtspl==2)
|
if($txtspl==1 || $txtspl==2)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
//secho "cwwe";
|
||||||
|
//die();
|
||||||
|
|
||||||
$PONOigr = $PONO;
|
$PONOigr = $PONO;
|
||||||
|
|
||||||
|
//echo $PONOigr;
|
||||||
|
//die();
|
||||||
//IGR Data Entry
|
//IGR Data Entry
|
||||||
//$DeliveryChellanOrInvoiceNo = $this->input->post('ChallanInvNo');
|
//$DeliveryChellanOrInvoiceNo = $this->input->post('ChallanInvNo');
|
||||||
|
|
||||||
@ -826,19 +832,42 @@ $prefile =array();
|
|||||||
$igr = array('PONO'=>$PONO,'VehicleNo'=>$Vehicle,'DeliveryChellanOrInvoiceNo'=>$DeliveryChellanInvoiceNo,'DeliveryChellanDate'=>$DeliveryChellanDate,'MaterialRcvdDate'=>$DeliveryChellanDate,'CourierNo'=>$Courier,'IGRStatus'=>$IGRStatus,'CreatedBy'=>$CreatedBy,'CreatedDate' =>$createddt,'MaterialRcvdDate'=>$MaterialReceivedate,'Paymentstatus'=>$paymentstatus);
|
$igr = array('PONO'=>$PONO,'VehicleNo'=>$Vehicle,'DeliveryChellanOrInvoiceNo'=>$DeliveryChellanInvoiceNo,'DeliveryChellanDate'=>$DeliveryChellanDate,'MaterialRcvdDate'=>$DeliveryChellanDate,'CourierNo'=>$Courier,'IGRStatus'=>$IGRStatus,'CreatedBy'=>$CreatedBy,'CreatedDate' =>$createddt,'MaterialRcvdDate'=>$MaterialReceivedate,'Paymentstatus'=>$paymentstatus);
|
||||||
|
|
||||||
//print_r($igr);
|
//print_r($igr);
|
||||||
//echo "\n";
|
|
||||||
|
|
||||||
$igrM = $this->inwardgateregister_model->addigrM($igr);
|
$igrM = $this->inwardgateregister_model->addigrM($igr);
|
||||||
//$IGRNO = 'igr001';
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$IGRNO = '';
|
$IGRNO = '';
|
||||||
if(count($igrM)>0)
|
if(count($igrM)>0)
|
||||||
{
|
{
|
||||||
foreach ($igrM as $key )
|
foreach ($igrM as $key )
|
||||||
{
|
{
|
||||||
$IGRNO=$key->IGRNO;
|
$IGRNO=$key->IGRNO;
|
||||||
log_message('error'," Revenue Emr-po IGR Number.".$IGRNO);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// echo $IGRNO;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if($Qualitycheck==0)
|
if($Qualitycheck==0)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -848,16 +877,15 @@ $prefile =array();
|
|||||||
$mrirmaster = $this->mrir_model->master_mrir($mrirmastervalues);
|
$mrirmaster = $this->mrir_model->master_mrir($mrirmastervalues);
|
||||||
|
|
||||||
|
|
||||||
// $MRIRNO = 'MRIR001';
|
|
||||||
$MRIRNO = '';
|
$MRIRNO = '';
|
||||||
|
|
||||||
|
|
||||||
if(count($mrirmaster)>0)
|
if(count($mrirmaster)>0)
|
||||||
|
|
||||||
{
|
{
|
||||||
foreach ($mrirmaster as $key ) {
|
foreach ($mrirmaster as $key ) {
|
||||||
|
|
||||||
$MRIRNO=$key->MRIRNo; }
|
$MRIRNO=$key->MRIRNo; }
|
||||||
log_message('error'," Revenue Emr-po MRIR Number.".$MRIRNO);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -867,7 +895,9 @@ $prefile =array();
|
|||||||
|
|
||||||
$MaterialCode = $this->input->post('materialCode'.$i);
|
$MaterialCode = $this->input->post('materialCode'.$i);
|
||||||
$Quantity = $this->input->post('quantity'.$i);
|
$Quantity = $this->input->post('quantity'.$i);
|
||||||
|
|
||||||
$Remarked = "Special PO Without Quality Check";
|
$Remarked = "Special PO Without Quality Check";
|
||||||
|
|
||||||
$MRIRStatus=MRIR_APPROVED;
|
$MRIRStatus=MRIR_APPROVED;
|
||||||
|
|
||||||
|
|
||||||
@ -875,27 +905,34 @@ $prefile =array();
|
|||||||
//this array to store the value in child table..
|
//this array to store the value in child table..
|
||||||
$mrirdetailvalues = array('MRIRNO'=>$MRIRNO,'MaterialCode'=>$MaterialCode,'ActualQuantityReceived'=>$Quantity,'Remarks'=>$Remarked,'MRIRStatus'=>$MRIRStatus);
|
$mrirdetailvalues = array('MRIRNO'=>$MRIRNO,'MaterialCode'=>$MaterialCode,'ActualQuantityReceived'=>$Quantity,'Remarks'=>$Remarked,'MRIRStatus'=>$MRIRStatus);
|
||||||
|
|
||||||
// print_r($mrirdetailvalues);
|
|
||||||
// echo 'MRIRItemNo001';
|
//print_r($mrirdetailvalues);
|
||||||
|
//die();
|
||||||
|
|
||||||
$mrirdetails = $this->mrir_model->detail_mrir($mrirdetailvalues);
|
$mrirdetails = $this->mrir_model->detail_mrir($mrirdetailvalues);
|
||||||
log_message('error'," Revenue Emr-po MRIR Item Number.".$mrirdetails[0]['MRIRItemNo']);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$getAvailableqty = $this->mrir_model->getItemQuantityFromStock(trim($MaterialCode));
|
$getAvailableqty = $this->mrir_model->getItemQuantityFromStock(trim($MaterialCode));
|
||||||
// print_r($getAvailableqty);
|
|
||||||
// echo "\n get available Qty";
|
|
||||||
if(count($getAvailableqty)>0)
|
if(count($getAvailableqty)>0)
|
||||||
{
|
{
|
||||||
$avlQty = $getAvailableqty[0]['Quantity'];
|
$avlQty = $getAvailableqty[0]['Quantity'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$updatStock = array('Quantity'=>($Quantity+$avlQty),'Status'=>'0','UpdatedOn'=>$createddt,'UpdatedBy'=>$CreatedBy,'Remarks'=>'Stock added for '. $MRIRNO);
|
$updatStock = array('Quantity'=>($Quantity+$avlQty),'Status'=>'0','UpdatedOn'=>$createddt,'UpdatedBy'=>$CreatedBy,'Remarks'=>'Stock added for '. $MRIRNO);
|
||||||
// print_r($updatStock);
|
|
||||||
// echo "\n updat Stock";
|
|
||||||
$this->mrir_model->UpdateStock($updatStock,trim($MaterialCode));
|
$this->mrir_model->UpdateStock($updatStock,trim($MaterialCode));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$IGRItemStatus = REQITEM_NEW;
|
$IGRItemStatus = REQITEM_NEW;
|
||||||
|
|
||||||
|
|
||||||
@ -924,6 +961,7 @@ $prefile =array();
|
|||||||
//if($QuantityAsPerInvoice == $OrderedQuantity)
|
//if($QuantityAsPerInvoice == $OrderedQuantity)
|
||||||
|
|
||||||
if($PendingQty == 0.00 )
|
if($PendingQty == 0.00 )
|
||||||
|
|
||||||
{
|
{
|
||||||
$ItemStatus = IGR_CREATED;
|
$ItemStatus = IGR_CREATED;
|
||||||
}
|
}
|
||||||
@ -940,27 +978,26 @@ $prefile =array();
|
|||||||
|
|
||||||
//print_r($igrDetails);
|
//print_r($igrDetails);
|
||||||
|
|
||||||
//echo "\n **** ";
|
|
||||||
|
|
||||||
$igrD = $this->inwardgateregister_model->addigrD($igrDetails);
|
$igrD = $this->inwardgateregister_model->addigrD($igrDetails);
|
||||||
|
|
||||||
//print_r($igrD);
|
|
||||||
//* ================================================== * /
|
|
||||||
//$IGRItemNo = 'IGRItemNo001';
|
//print_r($igrD);
|
||||||
|
//* ================================================== * /
|
||||||
$IGRItemNo = '';
|
$IGRItemNo = '';
|
||||||
foreach($igrD as $value)
|
foreach($igrD as $value)
|
||||||
{
|
{
|
||||||
|
|
||||||
$IGRItemNo = $value->IGRItemNo;
|
$IGRItemNo = $value->IGRItemNo;
|
||||||
log_message('error'," Revenue Emr-po IGR Item Number.".$IGRItemNo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//echo $IGRItemNo;
|
//echo $IGRItemNo;
|
||||||
$MaterialstockHistoryadd= array('Ref_No'=>$IGRItemNo,'MaterialCode'=>$MaterialCode,'Transaction_type'=>'Add','Ref_Type'=>'IGR','SupplierID'=>$SupplierID,'Quantity'=>$QuantityAsPerInvoice,'ItemValue'=>$itemRate,'CreatedBy'=>$CreatedBy,'CreatedOn'=>$createddt);
|
$MaterialstockHistoryadd= array('Ref_No'=>$IGRItemNo,'MaterialCode'=>$MaterialCode,'Transaction_type'=>'Add','Ref_Type'=>'IGR','SupplierID'=>$SupplierID,'Quantity'=>$QuantityAsPerInvoice,'ItemValue'=>$itemRate,'CreatedBy'=>$CreatedBy,'CreatedOn'=>$createddt);
|
||||||
|
|
||||||
|
|
||||||
$MStockHistory = $this->inwardgateregister_model->addMaterialStockHistory($MaterialstockHistoryadd);
|
$this->inwardgateregister_model->addMaterialStockHistory($MaterialstockHistoryadd);
|
||||||
//print_r($MaterialstockHistoryadd);
|
|
||||||
log_message('error'," Revenue Emr-po Material Stock History added. count ".count($MStockHistory));
|
|
||||||
//*=====================================================*/
|
//*=====================================================*/
|
||||||
|
|
||||||
|
|
||||||
@ -980,10 +1017,11 @@ $prefile =array();
|
|||||||
|
|
||||||
|
|
||||||
$current_qty= array('Current_stock'=>$currentav_qty);
|
$current_qty= array('Current_stock'=>$currentav_qty);
|
||||||
// print_r($current_qty);
|
|
||||||
// echo "\n ****";
|
$this->inwardgateregister_model->addmaterialmaster($current_qty,$MaterialCode);
|
||||||
$mMaster = $this->inwardgateregister_model->addmaterialmaster($current_qty,$MaterialCode);
|
|
||||||
log_message('error'," Revenue Emr-po Material Master Qty added.".$mMaster);
|
|
||||||
|
|
||||||
|
|
||||||
//*==================================================*/
|
//*==================================================*/
|
||||||
|
|
||||||
@ -1004,8 +1042,7 @@ $prefile =array();
|
|||||||
|
|
||||||
$POLineItem = array('ReceivedQuantity'=>$totalReceivedqty,'Status'=>$ItemStatus,'UpdateBY'=>$CreatedBy,'UpdatedOn'=>$createddt );
|
$POLineItem = array('ReceivedQuantity'=>$totalReceivedqty,'Status'=>$ItemStatus,'UpdateBY'=>$CreatedBy,'UpdatedOn'=>$createddt );
|
||||||
|
|
||||||
$pod = $this->inwardgateregister_model->UpdatePOLineItem($POLineItem,$PONO,$MaterialCode);
|
$this->inwardgateregister_model->UpdatePOLineItem($POLineItem,$PONO,$MaterialCode);
|
||||||
log_message('error'," Revenue Emr-po updating PO.sub details totalReceivedqty,Status ".$totalReceivedqty." ".$ItemStatus." ".$pod);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1013,56 +1050,63 @@ $prefile =array();
|
|||||||
// $emergencyitemcode = $this->input->post('emergencyitemcode'.$i);
|
// $emergencyitemcode = $this->input->post('emergencyitemcode'.$i);
|
||||||
// ($this->input->post('materialCode'.$i));
|
// ($this->input->post('materialCode'.$i));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$counts = $this->input->post('hidecounter');
|
$counts = $this->input->post('hidecounter');
|
||||||
$constants = $this->input->post('hideconstant');
|
$constants = $this->input->post('hideconstant');
|
||||||
|
|
||||||
|
|
||||||
// $arr = [];
|
// $arr = [];
|
||||||
|
|
||||||
// for($i=1;$i<=$constants;$i++){
|
// for($i=1;$i<=$constants;$i++){
|
||||||
// $pathname = 'browseFiles'.$i;
|
// $pathname = 'browseFiles'.$i;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// if(!empty($_FILES[$pathname]['name']))
|
// if(!empty($_FILES[$pathname]['name']))
|
||||||
// {
|
// {
|
||||||
// $Picture = $this->addfile($pathname);
|
// $Picture = $this->addfile($pathname);
|
||||||
// //echo $Picture;
|
// //echo $Picture;
|
||||||
// $arr[$i] = array($Picture);
|
// $arr[$i] = array($Picture);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
// }
|
// }
|
||||||
|
|
||||||
$arr = [];
|
$arr = [];
|
||||||
$prefile =array();
|
$prefile =array();
|
||||||
|
|
||||||
for($i=1;$i<=$constants;$i++)
|
for($i=1;$i<=$constants;$i++)
|
||||||
{
|
{
|
||||||
$pathname = 'browseFiles'.$i;
|
$pathname = 'browseFiles'.$i;
|
||||||
log_message('error'," Revenue Emr-po Browse File Path Name ".$pathname);
|
|
||||||
|
|
||||||
if(!empty($_FILES[$pathname]['name']))
|
if(!empty($_FILES[$pathname]['name']))
|
||||||
{
|
{
|
||||||
|
|
||||||
$files = str_replace(" ","",$_FILES[$pathname]['name']);
|
$files = str_replace(" ","",$_FILES[$pathname]['name']);
|
||||||
log_message('error'," Revenue Emr-po File Name ".$files);
|
|
||||||
|
|
||||||
$fcount = 0;
|
$fcount = 0;
|
||||||
|
|
||||||
foreach ($prefile as $value)
|
foreach ($prefile as $value)
|
||||||
{
|
{
|
||||||
|
|
||||||
if($value == $files) $fcount++;
|
|
||||||
|
if($value == $files)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
$fcount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if($fcount == 0)
|
if($fcount == 0)
|
||||||
{
|
{
|
||||||
$Picture = $this->addfile($pathname);
|
$Picture = $this->addfile($pathname);
|
||||||
log_message('error'," Revenue Emr-po File status ".$Picture);
|
//echo $Picture;
|
||||||
$arr[] = array($Picture);
|
$arr[] = array($Picture);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1077,6 +1121,7 @@ $prefile =array();
|
|||||||
foreach($arr as $ma)
|
foreach($arr as $ma)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
$index = 0;
|
$index = 0;
|
||||||
$filename = null;
|
$filename = null;
|
||||||
foreach($ma as $key=>$value)
|
foreach($ma as $key=>$value)
|
||||||
@ -1086,12 +1131,11 @@ $prefile =array();
|
|||||||
$filename = $value;
|
$filename = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!empty($filename)){
|
if(!empty($filename))
|
||||||
|
{
|
||||||
|
|
||||||
$myfile = array('FilePath'=>$filename,'PONO'=>$PONO,'IGRNO'=>$IGRNO);
|
$myfile = array('FilePath'=>$filename,'PONO'=>$PONO,'IGRNO'=>$IGRNO);
|
||||||
//print_r($myfile);
|
$this->purchaseorder_model->fileupload($myfile);
|
||||||
$fileno = $this->purchaseorder_model->fileupload($myfile);
|
|
||||||
log_message('error'," Revenue Emr-po File Number.".$fileno);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1102,10 +1146,12 @@ $prefile =array();
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
echo "<script>alert('You Have Successfully created the Purchase order! $PONO');</script>";
|
echo "<script>alert('You Have Successfully created the Purchase order! $PONO');</script>";
|
||||||
log_message('error'," Revenue Emr-po successfully created. ".$PONO);
|
|
||||||
redirect('purchaseorder/PurchaseOrderList','refresh');
|
redirect('purchaseorder/PurchaseOrderList','refresh');
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -588,7 +588,7 @@ $prefile =array();
|
|||||||
$IGRNO=$key->IGRNO;
|
$IGRNO=$key->IGRNO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
echo $IGRNO;
|
//echo $IGRNO;
|
||||||
|
|
||||||
$IGRItemStatus = REQITEM_NEW;
|
$IGRItemStatus = REQITEM_NEW;
|
||||||
$TotalPendingQty = '';
|
$TotalPendingQty = '';
|
||||||
|
|||||||
@ -255,12 +255,16 @@ class Login extends CI_Controller
|
|||||||
// start zoho API
|
// start zoho API
|
||||||
|
|
||||||
function zohobooks_api_fetch_all(){
|
function zohobooks_api_fetch_all(){
|
||||||
|
// print_r($_GET);
|
||||||
|
// echo isset($_GET['from']) ? $_GET['from'] : 'n';
|
||||||
|
// echo isset($_GET['to']) ? $_GET['to'] : 'n';
|
||||||
|
// die();
|
||||||
try{
|
try{
|
||||||
if (isset($_POST['sync']) || $_GET['from'] != null && $_GET['to'] != null)
|
// if (isset($_POST['sync']) || $_GET['from'] != null && $_GET['to'] != null)
|
||||||
{
|
// {
|
||||||
// $ch=curl_init();
|
// $ch=curl_init();
|
||||||
$this->load->helper('zohobooks_fetch_api_helper');
|
$this->load->helper('zohobooks_fetch_api_helper');
|
||||||
if($_GET['from'] != null && $_GET['to'] != null)
|
if(isset($_GET['from']) && $_GET['from'] != null && isset($_GET['to']) && $_GET['to'] != null)
|
||||||
{
|
{
|
||||||
$date_today = $_GET['to'];
|
$date_today = $_GET['to'];
|
||||||
$date_yesterday = $_GET['from'];
|
$date_yesterday = $_GET['from'];
|
||||||
@ -268,21 +272,33 @@ class Login extends CI_Controller
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$date_today = date('Y-m-d');
|
$date_today = date('Y-m-d');
|
||||||
$date_yesterday = date('Y-m-d',strtotime('-1 day',strtotime($date_today)));
|
$date_yesterday = date('Y-m-d',strtotime('-3 day',strtotime($date_today)));
|
||||||
}
|
}
|
||||||
|
// echo $date_today.'--'.$date_yesterday;
|
||||||
$chk_acc_token_val = $this->Zohobook_model->get_data('zohobook_accesstoken','id' , 1);
|
$chk_acc_token_val = $this->Zohobook_model->get_data('zohobook_accesstoken','id' , 1);
|
||||||
$date = new DateTime($chk_acc_token_val[0]['created_at']); $date->add(new DateInterval('PT1H'));
|
// print_r($chk_acc_token_val);//die();
|
||||||
|
$date = new DateTime($chk_acc_token_val[0]['created_at']);
|
||||||
|
//print_r($date);
|
||||||
|
$date->add(new DateInterval('PT1H'));
|
||||||
|
//print_r($date);
|
||||||
|
//echo '****************';
|
||||||
|
//print_r(date('Y-m-d h:i:s'));
|
||||||
$token = 0;
|
$token = 0;
|
||||||
if ($date->format('Y-m-d h:i:s') > date('Y-m-d h:i:s')) { $token = $chk_acc_token_val[0]['token']; }
|
if ($date->format('Y-m-d H:i:s') > date('Y-m-d H:i:s')) { $token = $chk_acc_token_val[0]['token']; }
|
||||||
else { $token = generateNewToken(); $tokendata['token'] = $token; $this->Zohobook_model->update($tokendata , 1,'zohobook_accesstoken'); }
|
else { $token = generateNewToken(); $tokendata['token'] = $token; $this->Zohobook_model->update($tokendata , 1,'zohobook_accesstoken'); }
|
||||||
|
// $token = generateNewToken(); $tokendata['token'] = $token;
|
||||||
|
//$this->Zohobook_model->update($tokendata , 1,'zohobook_accesstoken');
|
||||||
$result = getheringInvoiceDetails($date_today , $date_yesterday , $token);
|
$result = getheringInvoiceDetails($date_today , $date_yesterday , $token);
|
||||||
// echo json_encode($result);
|
// echo json_encode($result);die();
|
||||||
$headers_new = $result['headers_new'];
|
$headers_new = $result['headers_new'];
|
||||||
$res = json_decode($result['data'],true);
|
$res = json_decode($result['data'],true);
|
||||||
$inv_array = $res['invoices'];
|
$inv_array = $res['invoices'];
|
||||||
|
// echo json_encode($inv_array);die();
|
||||||
foreach($inv_array as $inv){
|
foreach($inv_array as $inv){
|
||||||
$invoice_id = $inv['invoice_id'];
|
$invoice_id = $inv['invoice_id'];
|
||||||
if($invoice_id!==""){
|
//filter only einvoice status pushed invoices only
|
||||||
|
//&& isset($inv['einvoice_details']) && isset($inv['einvoice_details']['status']) && ($inv['einvoice_details']['status'] == 'pushed')
|
||||||
|
if($invoice_id !== "" ){
|
||||||
$organization_id = '655654572';
|
$organization_id = '655654572';
|
||||||
$result2=getheringInvoiceSubDetails($invoice_id,$organization_id,$headers_new);
|
$result2=getheringInvoiceSubDetails($invoice_id,$organization_id,$headers_new);
|
||||||
$resall = json_decode($result2,true);
|
$resall = json_decode($result2,true);
|
||||||
@ -291,86 +307,24 @@ class Login extends CI_Controller
|
|||||||
}
|
}
|
||||||
$insert_count = 0;
|
$insert_count = 0;
|
||||||
$update_count = 0;
|
$update_count = 0;
|
||||||
|
// echo json_encode($res2);die();
|
||||||
foreach($res2 as $rs)
|
foreach($res2 as $rs)
|
||||||
{
|
{
|
||||||
$gst_no = $rs['gst_no'];
|
$gst_no = $rs['gst_no'];
|
||||||
$sku = $rs['line_items'][0]['sku'];
|
|
||||||
$invoice_number = $rs['invoice_number'];
|
|
||||||
$invoice_date = $rs['date'];
|
|
||||||
|
|
||||||
$sql_invoice_chk = $this->Zohobook_model->ip_invoices($invoice_number , $invoice_date);
|
|
||||||
if($sql_invoice_chk <= 0)
|
|
||||||
{
|
|
||||||
$gst_no = $rs['gst_no'];
|
|
||||||
$sku = $rs['line_items'][0]['sku'];
|
|
||||||
$invoice_number = $rs['invoice_number'];
|
$invoice_number = $rs['invoice_number'];
|
||||||
$invoice_date = $rs['date'];
|
$invoice_date = $rs['date'];
|
||||||
|
$status = $rs['status'];
|
||||||
$due_date = $rs['due_date'];
|
$due_date = $rs['due_date'];
|
||||||
$item_price = $rs['line_items'][0]['rate'];
|
|
||||||
$item_order = $rs['line_items'][0]['item_order'];
|
|
||||||
$item_product_unit = $rs['line_items'][0]['unit'];
|
|
||||||
$item_name = $rs['line_items'][0]['name'];
|
|
||||||
$item_description = $rs['line_items'][0]['description'];
|
|
||||||
$item_quantity = $rs['line_items'][0]['quantity'];
|
|
||||||
// $batch_no = $rs['custom_fields'][5]['value'];
|
|
||||||
$batch_no = "";
|
|
||||||
$invoice_time=$rs['created_time'];
|
$invoice_time=$rs['created_time'];
|
||||||
$time_array = explode("T", $invoice_time);
|
$time_array = explode("T", $invoice_time);
|
||||||
$time_array = explode("+",$time_array[1]);
|
$time_array = explode("+",$time_array[1]);
|
||||||
$invoice_time = $time_array[0];
|
$invoice_time = $time_array[0];
|
||||||
$status = $rs['status'];
|
|
||||||
|
|
||||||
$vehicle_number = $rs['custom_field_hash']['cf_vehicle_number'];
|
$sql_invoice_chk = $this->Zohobook_model->ip_invoices($invoice_number , $invoice_date);
|
||||||
$transport_mode =$rs['custom_field_hash']['cf_transport_mode'];
|
if($sql_invoice_chk <= 0)
|
||||||
$purchase_order_date = $rs['custom_field_hash']['cf_purchase_order_date'];
|
|
||||||
$driver = $rs['custom_field_hash']['cf_driver'];
|
|
||||||
$place_of_supply = $rs['custom_field_hash']['cf_place_of_supply'];
|
|
||||||
|
|
||||||
$cgst = $rs['taxes'][0]['tax_name'];
|
|
||||||
$sgst = $rs['taxes'][1]['tax_name'];
|
|
||||||
$cgst = $cgst[4];
|
|
||||||
$sgst = $sgst[4];
|
|
||||||
$cgst = $cgst.'.000';
|
|
||||||
$getcgsttax = $this->Zohobook_model->ip_tax_rates($cgst);
|
|
||||||
if($getcgsttax)
|
|
||||||
{
|
{
|
||||||
$cgsttaxid = $getcgsttax[0]['tax_rate_id'];
|
|
||||||
log_message('error', 'Data fetch success DB : ip_tax_rates cgst'. $cgst);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
log_message('error', 'No data => Data fetch failed DB : ip_tax_rates '. $cgst);
|
|
||||||
$cgst_data['tax_rate_percent'] = $cgst;
|
|
||||||
$getcgsttax = $this->Zohobook_model->insert($cgst_data,'ip_tax_rates');
|
|
||||||
$cgsttaxid = $getcgsttax[0]['tax_rate_id'];
|
|
||||||
log_message('error', 'New Data Created : DB : ip_tax_rates , tax_rate_id : '.$cgsttaxid);
|
|
||||||
}
|
|
||||||
|
|
||||||
$sgst = $sgst.'.000';
|
|
||||||
$getsgsttax = $this->Zohobook_model->ip_tax_rates($sgst);
|
|
||||||
if($getsgsttax)
|
|
||||||
{
|
|
||||||
$sgsttaxid = $getsgsttax[0]['tax_rate_id'];
|
|
||||||
log_message('error', 'Data fetch success DB : ip_tax_rates sgst'. $sgst);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
log_message('error', 'No data => Data fetch failed DB : ip_tax_rates '. $sgst);
|
|
||||||
$sgst_data['tax_rate_percent'] = $sgst;
|
|
||||||
$getsgsttax = $this->Zohobook_model->insert($sgst_data,'ip_tax_rates');
|
|
||||||
$sgsttaxid = $getsgsttax[0]['tax_rate_id'];
|
|
||||||
log_message('error', 'New Data Created : DB : ip_tax_rates , tax_rate_id : '.$sgsttaxid);
|
|
||||||
}
|
|
||||||
|
|
||||||
$item_subtotal = $rs['line_items'][0]['item_total'];
|
|
||||||
$item_tax_total = $rs['tax_total'];
|
|
||||||
$item_total = $rs['total'];
|
|
||||||
$item_sgst_amt = $rs['taxes'][1]['tax_amount'];
|
|
||||||
$item_cgst_amt = $rs['taxes'][0]['tax_amount'];
|
|
||||||
|
|
||||||
$item_discount = 0.00;
|
|
||||||
$item_igst_amt = 0.00;
|
|
||||||
if($batch_no==""){ $batch_no = "";}
|
|
||||||
$gst_sql = $this->Zohobook_model->ip_clients($gst_no);
|
$gst_sql = $this->Zohobook_model->ip_clients($gst_no);
|
||||||
if($gst_sql)
|
if($gst_sql)
|
||||||
{
|
{
|
||||||
@ -386,23 +340,6 @@ class Login extends CI_Controller
|
|||||||
log_message('error', 'New Data Created : DB : ip_clients , client_id : '.$client_id);
|
log_message('error', 'New Data Created : DB : ip_clients , client_id : '.$client_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sku_sql = $this->Zohobook_model->ip_products($sku);
|
|
||||||
if($sku_sql)
|
|
||||||
{
|
|
||||||
$product_id = $sku_sql[0]['product_id'];
|
|
||||||
log_message('error', 'Data fetch success DB : ip_products , product_id : '.$product_id);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
log_message('error', 'No data => Data fetch failed DB : ip_products '. $sku);
|
|
||||||
$sku_data['product_name'] = $item_name;
|
|
||||||
$sku_data['product_description'] = $item_description;
|
|
||||||
$sku_data['sku'] = $sku;
|
|
||||||
$sku_sql = $this->Zohobook_model->insert($sku_data,'ip_products');
|
|
||||||
$product_id = $sku_sql[0]['sku'];
|
|
||||||
log_message('error', 'sku'.$sku);
|
|
||||||
log_message('error', 'New Data Created : DB : product_id , product_id : '.$product_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||||
$charactersLength = strlen($characters);
|
$charactersLength = strlen($characters);
|
||||||
@ -413,7 +350,7 @@ class Login extends CI_Controller
|
|||||||
$ip_invoices['user_id'] = 1;
|
$ip_invoices['user_id'] = 1;
|
||||||
$ip_invoices['client_id'] = $client_id;
|
$ip_invoices['client_id'] = $client_id;
|
||||||
$ip_invoices['invoice_group_id'] = 6;
|
$ip_invoices['invoice_group_id'] = 6;
|
||||||
$ip_invoices['invoice_status_id'] = 2;
|
$ip_invoices['invoice_status_id'] = ($status == 'draft' ? 1 : (($status == 'sent' || $status == 'overdue') ? 2 : 5));
|
||||||
$ip_invoices['invoice_date_created'] = $invoice_date;
|
$ip_invoices['invoice_date_created'] = $invoice_date;
|
||||||
$ip_invoices['invoice_time_created'] = $invoice_time;
|
$ip_invoices['invoice_time_created'] = $invoice_time;
|
||||||
$ip_invoices['invoice_date_due'] = $due_date;
|
$ip_invoices['invoice_date_due'] = $due_date;
|
||||||
@ -423,43 +360,20 @@ class Login extends CI_Controller
|
|||||||
$ip_invoices['credit_status'] = 0;
|
$ip_invoices['credit_status'] = 0;
|
||||||
$invoice_insert_id = $this->Zohobook_model->insert($ip_invoices,'ip_invoices');
|
$invoice_insert_id = $this->Zohobook_model->insert($ip_invoices,'ip_invoices');
|
||||||
if($invoice_insert_id)
|
if($invoice_insert_id)
|
||||||
|
{
|
||||||
log_message('error', 'Data insert success DB : ip_invoices client id :'. $client_id);
|
log_message('error', 'Data insert success DB : ip_invoices client id :'. $client_id);
|
||||||
else
|
$insert_count = $insert_count + 1;
|
||||||
log_message('error', 'Data insert failed DB : ip_invoice_items client id :'. $client_id);
|
//start invoice level custom fields
|
||||||
|
|
||||||
$ip_invoice_items['invoice_id'] = $invoice_insert_id;
|
|
||||||
$ip_invoice_items['item_product_id'] = $product_id;
|
|
||||||
$ip_invoice_items['item_date_added'] = $invoice_date;
|
|
||||||
$ip_invoice_items['item_name'] = $item_name;
|
|
||||||
$ip_invoice_items['item_description'] = $item_description;
|
|
||||||
$ip_invoice_items['item_quantity'] = $item_quantity;
|
|
||||||
$ip_invoice_items['item_price'] = $item_price;
|
|
||||||
$ip_invoice_items['item_order'] = $item_order;
|
|
||||||
$ip_invoice_items['item_product_unit'] = $item_product_unit;
|
|
||||||
$ip_invoice_items['Sgst_item_tax_rate_id'] = $sgsttaxid;
|
|
||||||
$ip_invoice_items['Cgst_item_tax_rate_id'] = $cgsttaxid;
|
|
||||||
$item_insert_id = $this->Zohobook_model->insert($ip_invoice_items,'ip_invoice_items');
|
|
||||||
if($item_insert_id)
|
|
||||||
log_message('error', 'Data insert success DB : ip_invoice_items => Sgst_item_tax_rate_id :'. $sgsttaxid);
|
|
||||||
else
|
|
||||||
log_message('error', 'Data insert failed DB : ip_invoice_items => Sgst_item_tax_rate_id :'. $sgsttaxid);
|
|
||||||
|
|
||||||
//tax amount -- ip_invoice_item_amounts - table
|
|
||||||
$ip_invoice_item_amounts['item_id'] = $item_insert_id;
|
|
||||||
$ip_invoice_item_amounts['item_subtotal'] = $item_subtotal;
|
|
||||||
$ip_invoice_item_amounts['item_tax_total'] = $item_tax_total;
|
|
||||||
$ip_invoice_item_amounts['item_total'] = $item_total;
|
|
||||||
$ip_invoice_item_amounts['item_sgst_amt'] = $item_sgst_amt;
|
|
||||||
$ip_invoice_item_amounts['item_cgst_amt'] = $item_cgst_amt;
|
|
||||||
$ip_invoice_item_amounts['item_discount'] = $item_discount;
|
|
||||||
$ip_invoice_item_amounts['item_igst_amt'] = $item_igst_amt;
|
|
||||||
$result_tax_amount_insert = $this->Zohobook_model->insert($ip_invoice_item_amounts,'ip_invoice_item_amounts');
|
|
||||||
if($result_tax_amount_insert)
|
|
||||||
log_message('error', 'Data insert success DB : ip_invoice_item_amounts ');
|
|
||||||
else
|
|
||||||
log_message('error', 'Data insert failed DB : ip_invoice_item_amounts ');
|
|
||||||
|
|
||||||
//custom fields insert
|
//custom fields insert
|
||||||
|
|
||||||
|
$batch_no = isset($rs['custom_fields'][5]['value']) ? $rs['custom_fields'][5]['value'] : "";
|
||||||
|
// $batch_no = "";
|
||||||
|
$vehicle_number = $rs['custom_field_hash']['cf_vehicle_number'];
|
||||||
|
$transport_mode =$rs['custom_field_hash']['cf_transport_mode'];
|
||||||
|
$purchase_order_date = $rs['custom_field_hash']['cf_purchase_order_date'];
|
||||||
|
$driver = $rs['custom_field_hash']['cf_driver'];
|
||||||
|
$place_of_supply = $rs['custom_field_hash']['cf_place_of_supply'];
|
||||||
// batch_no
|
// batch_no
|
||||||
$ip_invoice_custom_b['invoice_id'] = $invoice_insert_id;
|
$ip_invoice_custom_b['invoice_id'] = $invoice_insert_id;
|
||||||
$ip_invoice_custom_b['invoice_custom_fieldid'] = 62;
|
$ip_invoice_custom_b['invoice_custom_fieldid'] = 62;
|
||||||
@ -514,13 +428,149 @@ class Login extends CI_Controller
|
|||||||
log_message('error', 'Data insert success DB : ip_invoice_custom ');
|
log_message('error', 'Data insert success DB : ip_invoice_custom ');
|
||||||
else
|
else
|
||||||
log_message('error', 'Data insert failed DB : ip_invoice_custom ');
|
log_message('error', 'Data insert failed DB : ip_invoice_custom ');
|
||||||
$insert_count = $insert_count + 1;
|
//end invoice level custom fields
|
||||||
|
|
||||||
|
//if line items available
|
||||||
|
if(isset($rs['line_items']) && count($rs['line_items']) > 0)
|
||||||
|
{
|
||||||
|
log_message('error', 'Processing line items'.count($rs['line_items']));
|
||||||
|
|
||||||
|
for($i = 0; $i< count($rs['line_items']);$i++)
|
||||||
|
{ //start insert line items
|
||||||
|
$sku = $rs['line_items'][$i]['sku'];
|
||||||
|
|
||||||
|
|
||||||
|
$item_price = $rs['line_items'][$i]['rate'];
|
||||||
|
$item_order = $rs['line_items'][$i]['item_order'];
|
||||||
|
$item_product_unit = $rs['line_items'][$i]['unit'];
|
||||||
|
$item_name = $rs['line_items'][$i]['name'];
|
||||||
|
$item_description = $rs['line_items'][$i]['description'];
|
||||||
|
$item_quantity = $rs['line_items'][$i]['quantity'];
|
||||||
|
$cgst = $rs['line_items'][$i]['line_item_taxes'][1]['tax_name'];
|
||||||
|
$sgst = $rs['line_items'][$i]['line_item_taxes'][0]['tax_name'];
|
||||||
|
$cgst = $cgst[4];
|
||||||
|
$sgst = $sgst[4];
|
||||||
|
$cgst = $cgst.'.000';
|
||||||
|
$getcgsttax = $this->Zohobook_model->ip_tax_rates($cgst);
|
||||||
|
if($getcgsttax)
|
||||||
|
{
|
||||||
|
$cgsttaxid = $getcgsttax[0]['tax_rate_id'];
|
||||||
|
log_message('error', 'Data fetch success DB : ip_tax_rates cgst'. $cgst);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
log_message('error', 'No data => Data fetch failed DB : ip_tax_rates '. $cgst);
|
||||||
|
$cgst_data['tax_rate_percent'] = $cgst;
|
||||||
|
$getcgsttax = $this->Zohobook_model->insert($cgst_data,'ip_tax_rates');
|
||||||
|
$cgsttaxid = $getcgsttax[0]['tax_rate_id'];
|
||||||
|
log_message('error', 'New Data Created : DB : ip_tax_rates , tax_rate_id : '.$cgsttaxid);
|
||||||
|
}
|
||||||
|
|
||||||
|
$sgst = $sgst.'.000';
|
||||||
|
$getsgsttax = $this->Zohobook_model->ip_tax_rates($sgst);
|
||||||
|
if($getsgsttax)
|
||||||
|
{
|
||||||
|
$sgsttaxid = $getsgsttax[0]['tax_rate_id'];
|
||||||
|
log_message('error', 'Data fetch success DB : ip_tax_rates sgst'. $sgst);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
log_message('error', 'No data => Data fetch failed DB : ip_tax_rates '. $sgst);
|
||||||
|
$sgst_data['tax_rate_percent'] = $sgst;
|
||||||
|
$getsgsttax = $this->Zohobook_model->insert($sgst_data,'ip_tax_rates');
|
||||||
|
$sgsttaxid = $getsgsttax[0]['tax_rate_id'];
|
||||||
|
log_message('error', 'New Data Created : DB : ip_tax_rates , tax_rate_id : '.$sgsttaxid);
|
||||||
|
}
|
||||||
|
|
||||||
|
$item_subtotal = $rs['line_items'][$i]['item_total'];
|
||||||
|
|
||||||
|
|
||||||
|
$item_sgst_amt = $rs['line_items'][$i]['line_item_taxes'][0]['tax_amount'];
|
||||||
|
$item_cgst_amt = $rs['line_items'][$i]['line_item_taxes'][1]['tax_amount'];
|
||||||
|
$item_tax_total = ($item_sgst_amt + $item_cgst_amt);
|
||||||
|
$item_total = ($item_subtotal + $item_tax_total);
|
||||||
|
|
||||||
|
$item_discount = 0.00;
|
||||||
|
$item_igst_amt = 0.00;
|
||||||
|
// if($batch_no==""){ $batch_no = "";}
|
||||||
|
|
||||||
|
|
||||||
|
$sku_sql = $this->Zohobook_model->ip_products($sku);
|
||||||
|
if($sku_sql)
|
||||||
|
{
|
||||||
|
$product_id = $sku_sql[0]['product_id'];
|
||||||
|
log_message('error', 'Data fetch success DB : ip_products , product_id : '.$product_id);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
log_message('error', 'No data => Data fetch failed DB : ip_products '. $sku);
|
||||||
|
$sku_data['product_name'] = $item_name;
|
||||||
|
$sku_data['product_description'] = $item_description;
|
||||||
|
$sku_data['sku'] = $sku;
|
||||||
|
$sku_sql = $this->Zohobook_model->insert($sku_data,'ip_products');
|
||||||
|
$product_id = $sku_sql[0]['sku'];
|
||||||
|
log_message('error', 'sku'.$sku);
|
||||||
|
log_message('error', 'New Data Created : DB : product_id , product_id : '.$product_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
//#1
|
||||||
|
|
||||||
|
$ip_invoice_items['invoice_id'] = $invoice_insert_id;
|
||||||
|
$ip_invoice_items['item_product_id'] = $product_id;
|
||||||
|
$ip_invoice_items['item_date_added'] = $invoice_date;
|
||||||
|
$ip_invoice_items['item_name'] = $item_name;
|
||||||
|
$ip_invoice_items['item_description'] = $item_description;
|
||||||
|
$ip_invoice_items['item_quantity'] = $item_quantity;
|
||||||
|
$ip_invoice_items['item_price'] = $item_price;
|
||||||
|
$ip_invoice_items['item_order'] = $item_order;
|
||||||
|
$ip_invoice_items['item_product_unit'] = $item_product_unit;
|
||||||
|
$ip_invoice_items['Sgst_item_tax_rate_id'] = $sgsttaxid;
|
||||||
|
$ip_invoice_items['Cgst_item_tax_rate_id'] = $cgsttaxid;
|
||||||
|
$item_insert_id = $this->Zohobook_model->insert($ip_invoice_items,'ip_invoice_items');
|
||||||
|
if($item_insert_id)
|
||||||
|
log_message('error', 'Data insert success DB : ip_invoice_items => Sgst_item_tax_rate_id :'. $sgsttaxid);
|
||||||
|
else
|
||||||
|
log_message('error', 'Data insert failed DB : ip_invoice_items => Sgst_item_tax_rate_id :'. $sgsttaxid);
|
||||||
|
|
||||||
|
//tax amount -- ip_invoice_item_amounts - table
|
||||||
|
$ip_invoice_item_amounts['item_id'] = $item_insert_id;
|
||||||
|
$ip_invoice_item_amounts['item_subtotal'] = $item_subtotal;
|
||||||
|
$ip_invoice_item_amounts['item_tax_total'] = $item_tax_total;
|
||||||
|
$ip_invoice_item_amounts['item_total'] = $item_total;
|
||||||
|
$ip_invoice_item_amounts['item_sgst_amt'] = $item_sgst_amt;
|
||||||
|
$ip_invoice_item_amounts['item_cgst_amt'] = $item_cgst_amt;
|
||||||
|
$ip_invoice_item_amounts['item_discount'] = $item_discount;
|
||||||
|
$ip_invoice_item_amounts['item_igst_amt'] = $item_igst_amt;
|
||||||
|
$result_tax_amount_insert = $this->Zohobook_model->insert($ip_invoice_item_amounts,'ip_invoice_item_amounts');
|
||||||
|
if($result_tax_amount_insert)
|
||||||
|
log_message('error', 'Data insert success DB : ip_invoice_item_amounts ');
|
||||||
|
else
|
||||||
|
log_message('error', 'Data insert failed DB : ip_invoice_item_amounts ');
|
||||||
|
|
||||||
|
} //end line items insert
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
log_message('error', 'Line Items not found in API result');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
log_message('error', 'Data insert failed DB : ip_invoice_items client id :'. $client_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else // update invoice status, especially for cancelled invoices
|
else // update invoice status, especially for cancelled invoices
|
||||||
{
|
{
|
||||||
if($status == "void")
|
if($status == "void" || $status == "sent" || $status == "ovedue")
|
||||||
{
|
{
|
||||||
$sql_invoice_update['invoice_status_id'] = 5;
|
$sql_invoice_update = array();
|
||||||
|
$sql_invoice_update['invoice_status_id'] = (($status == "sent" || $status == "ovedue") ? 2 : 5);
|
||||||
|
// echo 'script' . $invoice_number. $status;
|
||||||
|
// print_r( $sql_invoice_update);
|
||||||
|
// echo '<br>';
|
||||||
$sql_invoice_update = $this->Zohobook_model->sql_invoice_update($sql_invoice_update,$invoice_number,$invoice_date,'ip_invoices');
|
$sql_invoice_update = $this->Zohobook_model->sql_invoice_update($sql_invoice_update,$invoice_number,$invoice_date,'ip_invoices');
|
||||||
if($sql_invoice_update)
|
if($sql_invoice_update)
|
||||||
{
|
{
|
||||||
@ -534,10 +584,10 @@ class Login extends CI_Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
echo 'new invoice inserted count- '. $insert_count . '/'.'cancelled status updated count - ' . $update_count;
|
echo 'new invoice inserted count- '. $insert_count . '/'.'status updated count - ' . $update_count;
|
||||||
|
|
||||||
// curl_close($ch);
|
// curl_close($ch);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
catch (Exception $e) {
|
catch (Exception $e) {
|
||||||
$data['err'] = $e->getMessage();
|
$data['err'] = $e->getMessage();
|
||||||
@ -550,7 +600,10 @@ class Login extends CI_Controller
|
|||||||
//end
|
//end
|
||||||
// END zoho API
|
// END zoho API
|
||||||
|
|
||||||
|
function check_existing_invoice_with_item($arrToCheck,$arrOfInvoices)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -984,9 +984,12 @@ function phpAlert($msg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$Estimate_first = explode(".",$Estimate);
|
$Estimate_first = explode(".",$Estimate);
|
||||||
if(!is_numeric($Estimate) || (strlen((string)$Estimate))>8 || (strlen((string)$Estimate_first[0]))> 5)
|
if(!is_numeric($Estimate) || (strlen((string)$Estimate))>8 || (strlen((string)$Estimate_first[0]))> 7)
|
||||||
{
|
{
|
||||||
//echo $EmpID . "-Loan Recoverd Invalid Data!";
|
// echo $Estimate;
|
||||||
|
// print_r($Estimate_first);
|
||||||
|
|
||||||
|
// echo $EmpID . "-Loan Recoverd Invalid Data!";
|
||||||
$ErrorFlag++;
|
$ErrorFlag++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1008,6 +1011,9 @@ function phpAlert($msg) {
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// echo $TotalErrorFlag;
|
||||||
|
// echo $ErrorEmpId;
|
||||||
|
// die();
|
||||||
|
|
||||||
if($TotalErrorFlag == 0)
|
if($TotalErrorFlag == 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -535,10 +535,8 @@ class report extends BaseController
|
|||||||
//echo $PONO; die;
|
//echo $PONO; die;
|
||||||
|
|
||||||
$igrfile= $this->dahsboard_Model->getfiles($igr,$PONO);
|
$igrfile= $this->dahsboard_Model->getfiles($igr,$PONO);
|
||||||
print_r($igrfile);
|
|
||||||
// $igrfile = $this->inwardgateregister_model->viewIGRFile($IGRNO);
|
// $igrfile = $this->inwardgateregister_model->viewIGRFile($IGRNO);
|
||||||
$billfile = $this->dahsboard_Model->viewIGRFile1($igr,$PONO);
|
$billfile = $this->dahsboard_Model->viewIGRFile1($igr,$PONO);
|
||||||
print_r($billfile);
|
|
||||||
|
|
||||||
$data = array_merge($igrfile,$billfile);
|
$data = array_merge($igrfile,$billfile);
|
||||||
|
|
||||||
|
|||||||
@ -29,7 +29,6 @@ class requisitionform extends BaseController
|
|||||||
*/
|
*/
|
||||||
function requisitionlisting()
|
function requisitionlisting()
|
||||||
{
|
{
|
||||||
log_message('error'," Requisition Listing Fns Called");
|
|
||||||
$this->global['pageTitle'] = 'Siddharth : Requisition Listing';
|
$this->global['pageTitle'] = 'Siddharth : Requisition Listing';
|
||||||
|
|
||||||
$userID = $this->session->userdata ( 'userId' );
|
$userID = $this->session->userdata ( 'userId' );
|
||||||
@ -52,7 +51,6 @@ class requisitionform extends BaseController
|
|||||||
|
|
||||||
function requisition()
|
function requisition()
|
||||||
{
|
{
|
||||||
log_message('error'," Raise Requisition Fns Called");
|
|
||||||
$this->global['pageTitle'] = 'Siddharth : Raise Requisition';
|
$this->global['pageTitle'] = 'Siddharth : Raise Requisition';
|
||||||
|
|
||||||
$data['RequestType'] = $this->requistion_model->getConfigValue('C020');
|
$data['RequestType'] = $this->requistion_model->getConfigValue('C020');
|
||||||
@ -60,7 +58,6 @@ class requisitionform extends BaseController
|
|||||||
$data['EmpList'] = $this->requistion_model->getAllEmployees();
|
$data['EmpList'] = $this->requistion_model->getAllEmployees();
|
||||||
$data['ServiceOption'] = $this->requistion_model->getConfigValue('C022');
|
$data['ServiceOption'] = $this->requistion_model->getConfigValue('C022');
|
||||||
$userID = $this->session->userdata ( 'userId' );
|
$userID = $this->session->userdata ( 'userId' );
|
||||||
log_message('error'," Raise Requisition userId ".$userID);
|
|
||||||
|
|
||||||
$data['Emp'] = $this->requistion_model->getEmpIdByUserID($userID);
|
$data['Emp'] = $this->requistion_model->getEmpIdByUserID($userID);
|
||||||
|
|
||||||
@ -355,7 +352,6 @@ class requisitionform extends BaseController
|
|||||||
function addNewRequistion()
|
function addNewRequistion()
|
||||||
{
|
{
|
||||||
|
|
||||||
log_message('error'," add new Requisition Fns Called");
|
|
||||||
$this->form_validation->set_rules('RequestType','RequestType','trim|required');
|
$this->form_validation->set_rules('RequestType','RequestType','trim|required');
|
||||||
$this->form_validation->set_rules('EmpID','EmpID','trim|required');
|
$this->form_validation->set_rules('EmpID','EmpID','trim|required');
|
||||||
|
|
||||||
@ -365,18 +361,17 @@ class requisitionform extends BaseController
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
log_message('error'," add new Requisition GET[ID] ".$_GET['ID']);
|
|
||||||
$Status= $_GET['ID'];
|
$Status= $_GET['ID'];
|
||||||
|
log_message('error'," add new Requisition GET[ID] ".$_GET['ID']);
|
||||||
|
|
||||||
$RequestType = strtoupper(trim($this->input->post('RequestType')));
|
$RequestType = strtoupper(trim($this->input->post('RequestType')));
|
||||||
$Requestedby = strtoupper(trim($this->input->post('EmpID')));
|
$Requestedby = strtoupper(trim($this->input->post('EmpID')));
|
||||||
log_message('error'," add new Requisition empid ".$Requestedby);
|
|
||||||
$RequestedbyDept = $this->session->userdata ( 'DEPCode' );
|
$RequestedbyDept = $this->session->userdata ( 'DEPCode' );
|
||||||
$CostCenter = $this->input->post('CostCenter');
|
$CostCenter = $this->input->post('CostCenter');
|
||||||
$CreateBy = $this->session->userdata ( 'userId' );
|
$CreateBy = $this->session->userdata ( 'userId' );
|
||||||
$UpdatedBy = $this->session->userdata ( 'userId' );
|
|
||||||
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
|
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
|
||||||
$createddt = $dt->format('Y-m-d H:i:s');
|
$createddt = $dt->format('Y-m-d H:i:s');
|
||||||
|
$UpdatedBy = $this->session->userdata ( 'userId' );
|
||||||
$DeletedRow = $this->input->post('txtDeletedRow');
|
$DeletedRow = $this->input->post('txtDeletedRow');
|
||||||
$RowCount = $this->input->post('txtRowCount');
|
$RowCount = $this->input->post('txtRowCount');
|
||||||
|
|
||||||
@ -439,7 +434,7 @@ class requisitionform extends BaseController
|
|||||||
$Quantity = $this->input->post('Quantity'.$i);
|
$Quantity = $this->input->post('Quantity'.$i);
|
||||||
$OtherD = $this->input->post('otherD'.$i);
|
$OtherD = $this->input->post('otherD'.$i);
|
||||||
|
|
||||||
//$ReqDetails = array('ReqNo'=>$ReqNumber, 'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'MaterialDescription'=>$OtherD);
|
// $ReqDetails = array('ReqNo'=>$ReqNumber, 'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'MaterialDescription'=>$OtherD);
|
||||||
$ReqDetails = array('ReqNo'=>$ReqNumber, 'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'MaterialDescription'=>$OtherD,'UpdatedBy'=>$UpdatedBy);
|
$ReqDetails = array('ReqNo'=>$ReqNumber, 'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'MaterialDescription'=>$OtherD,'UpdatedBy'=>$UpdatedBy);
|
||||||
$this->requistion_model->addRequistionDetails($ReqDetails,$ReqNumber);
|
$this->requistion_model->addRequistionDetails($ReqDetails,$ReqNumber);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -131,10 +131,10 @@ where (CurrentStock+OpeningStock)<reorder";
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// $query=$CI->db->query($subQuery,array());
|
$query=$CI->db->query($subQuery,array());
|
||||||
//print_r($this->db->last_query());
|
//print_r($this->db->last_query());
|
||||||
|
|
||||||
return array();
|
return $query->result();
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@ -1772,10 +1772,10 @@ if ($cname!= ''){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql.=" group by pono,igrn";
|
$sql.="group by pono,igrn";
|
||||||
// echo $m;
|
// echo $m;
|
||||||
// echo $sid;
|
// echo $sid;
|
||||||
// echo $sql;exit;
|
//echo $sql;
|
||||||
$query = $this->db->query($sql);
|
$query = $this->db->query($sql);
|
||||||
|
|
||||||
$filequery = $query->result();
|
$filequery = $query->result();
|
||||||
|
|||||||
@ -189,8 +189,7 @@ TMD.QuantityRejected,ST.StatusName,TMD.Remarks,AdvanceAmount ');
|
|||||||
|
|
||||||
if($insert_id>0)
|
if($insert_id>0)
|
||||||
{
|
{
|
||||||
// $subQuery = 'select max(MRIRNO) as MRIRNo from T_MRIR_Master';
|
$subQuery = 'select max(MRIRNO) as MRIRNo from T_MRIR_Master';
|
||||||
$subQuery = 'select MRIRNO from T_MRIR_Master order by Createdon desc limit 1';
|
|
||||||
$query = $this->db->query($subQuery);
|
$query = $this->db->query($subQuery);
|
||||||
return $query->result();//_array();
|
return $query->result();//_array();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -451,8 +451,7 @@ function purchaseorderListing($forwhat='')
|
|||||||
// print_r($this->db->last_query());
|
// print_r($this->db->last_query());
|
||||||
if($insert_id>0)
|
if($insert_id>0)
|
||||||
{
|
{
|
||||||
// $subQuery = 'select max(PONO) as PONO from T_PurchaseOrder_Master';
|
$subQuery = 'select max(PONO) as PONO from T_PurchaseOrder_Master';
|
||||||
$subQuery = 'select PONO from T_PurchaseOrder_Master order by CreatedDate desc limit 1';
|
|
||||||
|
|
||||||
$query = $this->db->query($subQuery);
|
$query = $this->db->query($subQuery);
|
||||||
|
|
||||||
@ -491,8 +490,7 @@ function purchaseorderListing($forwhat='')
|
|||||||
// print_r($this->db->last_query());
|
// print_r($this->db->last_query());
|
||||||
if($insert_id>0)
|
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 LineItemNo from T_PurchaseOrder_LineItem order by CreatedDate desc limit 1';
|
|
||||||
|
|
||||||
$query = $this->db->query($subQuery);
|
$query = $this->db->query($subQuery);
|
||||||
|
|
||||||
|
|||||||
@ -350,7 +350,7 @@ class requistion_model extends CI_Model
|
|||||||
$this->db->trans_complete();
|
$this->db->trans_complete();
|
||||||
if($insert_id>0)
|
if($insert_id>0)
|
||||||
{
|
{
|
||||||
$subQuery = 'select ReqNo from T_Requestion_Master order by CreatedDate desc limit 1';
|
$subQuery = 'select max(ReqNo) as ReqNo from T_Requestion_Master';
|
||||||
|
|
||||||
$query = $this->db->query($subQuery);
|
$query = $this->db->query($subQuery);
|
||||||
|
|
||||||
|
|||||||
78
application/models/zohobook_api_model.php
Normal file
78
application/models/zohobook_api_model.php
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
<?php
|
||||||
|
class Zohobook_api_model extends CI_Model {
|
||||||
|
|
||||||
|
public function ip_tax_rates($gst)
|
||||||
|
{
|
||||||
|
$this->db->select();
|
||||||
|
$this->db->from('ip_tax_rates');
|
||||||
|
$this->db->where('tax_rate_percent', $gst);
|
||||||
|
$query = $this->db->get();
|
||||||
|
$query = $query->result_array();
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function ip_clients($gst_no)
|
||||||
|
{
|
||||||
|
$this->db->select();
|
||||||
|
$this->db->from('ip_clients');
|
||||||
|
$this->db->where('client_tax_code', $gst_no);
|
||||||
|
$query = $this->db->get();
|
||||||
|
$query = $query->result_array();
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function ip_products($sku)
|
||||||
|
{
|
||||||
|
$this->db->select();
|
||||||
|
$this->db->from('ip_products');
|
||||||
|
$this->db->where('sku', $sku);
|
||||||
|
$query = $this->db->get();
|
||||||
|
$query = $query->result_array();
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function ip_invoices($invoice_number , $invoice_date)
|
||||||
|
{
|
||||||
|
$this->db->select();
|
||||||
|
$this->db->from('ip_invoices');
|
||||||
|
$this->db->where('invoice_number', $invoice_number);
|
||||||
|
$this->db->where('invoice_date_created', $invoice_date);
|
||||||
|
$query = $this->db->get();
|
||||||
|
$query = $query->num_rows();
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function insert($data,$table)
|
||||||
|
{
|
||||||
|
$this->db->insert($table,$data);
|
||||||
|
return $this->db->insert_id();
|
||||||
|
}
|
||||||
|
|
||||||
|
function sql_invoice_update($action, $invoice_number, $invoice_date_created ,$table)
|
||||||
|
{
|
||||||
|
// echo 'model';
|
||||||
|
// print_r($action);
|
||||||
|
// echo '<br>';
|
||||||
|
$this->db->where('invoice_number',$invoice_number);
|
||||||
|
$this->db->where('invoice_date_created',$invoice_date_created);
|
||||||
|
$this->db->update($table,$action);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_data($table ,$col_name ,$id)
|
||||||
|
{
|
||||||
|
$this->db->select();
|
||||||
|
$this->db->from($table);
|
||||||
|
$this->db->where($col_name , $id);
|
||||||
|
$query = $this->db->get();
|
||||||
|
$query = $query->result_array();
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
|
function update($action,$id,$table){
|
||||||
|
$this->db->where('id',$id);
|
||||||
|
$this->db->update($table,$action);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -37,8 +37,6 @@ foreach($reportdata['company'] as $c)
|
|||||||
$pic = $c->ProfilePic;
|
$pic = $c->ProfilePic;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// echo $pic;die;
|
|
||||||
// echo base_url().'uploads/images/'.$pic;die;
|
|
||||||
?>
|
?>
|
||||||
<style>
|
<style>
|
||||||
td{
|
td{
|
||||||
@ -74,7 +72,6 @@ td{
|
|||||||
<td colspan="6"><h2>PRE DISPATCH INSPECTION REPORT</h2></td>
|
<td colspan="6"><h2>PRE DISPATCH INSPECTION REPORT</h2></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr >
|
<tr >
|
||||||
<!-- <td rowspan="5" ><img src="http://localhost/siddharth_application/uploads/images/LOGO_SI_ISO_90012.png" alt="no image"/></td> -->
|
|
||||||
<td rowspan="5" ><img src="<?php echo base_url().'uploads/images/'.$pic;?>" alt="no image"/></td>
|
<td rowspan="5" ><img src="<?php echo base_url().'uploads/images/'.$pic;?>" alt="no image"/></td>
|
||||||
<td rowspan="5" width="38%"><b><?php echo $cname;?></b><br><?php echo $caddress;?></td>
|
<td rowspan="5" width="38%"><b><?php echo $cname;?></b><br><?php echo $caddress;?></td>
|
||||||
<td width="8%" >CUSTOMER NAME</td>
|
<td width="8%" >CUSTOMER NAME</td>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user