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,25 +584,25 @@ $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');
|
|
||||||
// echo "\n *** txtspl".$txtspl;
|
$txtspl=$this->input->post('txtSpecial');
|
||||||
|
|
||||||
|
|
||||||
$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');
|
}
|
||||||
}
|
else{
|
||||||
else{
|
$Deliverydt = $this->getDateformat($dt);
|
||||||
$Deliverydt = $this->getDateformat($dt);
|
$DeliverySchedule = '';
|
||||||
$DeliverySchedule = '';
|
}
|
||||||
}
|
|
||||||
|
|
||||||
$Modeofshipment=$this->input->post('emergmodeofshipment');
|
$Modeofshipment=$this->input->post('emergmodeofshipment');
|
||||||
$supplierreference=$this->input->post('emergsupplierreference');
|
$supplierreference=$this->input->post('emergsupplierreference');
|
||||||
@ -621,23 +611,30 @@ $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{
|
||||||
$CostCenterName = $this->input->post('CostCenterName');
|
$insuranceno="";
|
||||||
|
}
|
||||||
|
$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');
|
||||||
|
|
||||||
$SpcialInstruction = $this->input->post('txtSpcialInstruction');
|
$SpcialInstruction = $this->input->post('txtSpcialInstruction');
|
||||||
$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,56 +646,62 @@ $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;
|
||||||
$Local_Interstate=$this->input->post('Range');
|
$Local_Interstate=$this->input->post('Range');
|
||||||
|
|
||||||
$comma_separated = explode(':', $DeletedRow);
|
$comma_separated = explode(':', $DeletedRow);
|
||||||
|
|
||||||
$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');
|
||||||
$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
|
$RegDetailsStatus=REQITEM_POCREATED;
|
||||||
$RegDetailsStatus=REQITEM_POCREATED;
|
$LineItemStatus = REQITEM_NEW;
|
||||||
$LineItemStatus = REQITEM_NEW;
|
|
||||||
|
|
||||||
for ($i = 1; $i <= $RowCount; $i++)
|
for ($i = 1; $i <= $RowCount; $i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
$MaterialCode = $this->input->post('materialCode'.$i);
|
$MaterialCode = $this->input->post('materialCode'.$i);
|
||||||
@ -718,7 +721,7 @@ $prefile =array();
|
|||||||
$FreightType = $this->input->post('FreightType'.$i);
|
$FreightType = $this->input->post('FreightType'.$i);
|
||||||
$FreightValue = $this->input->post('FreightVal'.$i);
|
$FreightValue = $this->input->post('FreightVal'.$i);
|
||||||
$AfterFreightValue = $this->input->post('AfterFreightVal'.$i);
|
$AfterFreightValue = $this->input->post('AfterFreightVal'.$i);
|
||||||
$NOOfTrip = $this->input->post('NoOfTrip'.$i);
|
$NOOfTrip = $this->input->post('NoOfTrip'.$i);
|
||||||
$InsuranceValue = $this->input->post('Insval'.$i);
|
$InsuranceValue = $this->input->post('Insval'.$i);
|
||||||
$TotalOrderValue = $this->input->post('TotalOrderValue'.$i);
|
$TotalOrderValue = $this->input->post('TotalOrderValue'.$i);
|
||||||
$revenuedescription = $this->input->post('service_description'.$i);
|
$revenuedescription = $this->input->post('service_description'.$i);
|
||||||
@ -743,196 +746,231 @@ $prefile =array();
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($SkipInsert == "False")
|
if($SkipInsert == "False")
|
||||||
{
|
{
|
||||||
//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);
|
|
||||||
log_message('error'," Revenue Emr-po RequistionDetails count . ".count($ReqDetQuery)." ReqNo".isset($ReqDetQuery[0]['ItemNo'])?$ReqDetQuery[0]['ItemNo']:" -- ");
|
$ReqDetQuery = $this->requistion_model->addRequistionDetails($ReqDetails);
|
||||||
|
|
||||||
$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;
|
||||||
|
|
||||||
/*----------------------------*/
|
/*----------------------------*/
|
||||||
// $logpo =array('PONO'=>$PONO,'Date'=>$PODate,'POType'=>$POType,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'SupplierID'=>$SupplierID,'LineItemNos'=>$LineItemNo);
|
// $logpo =array('PONO'=>$PONO,'Date'=>$PODate,'POType'=>$POType,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'SupplierID'=>$SupplierID,'LineItemNos'=>$LineItemNo);
|
||||||
|
|
||||||
|
// $logaddpo = $this->purchaseorder_model->newlogpo($logpo);
|
||||||
|
|
||||||
|
|
||||||
// $logaddpo = $this->purchaseorder_model->newlogpo($logpo);
|
|
||||||
|
|
||||||
/*----------------------------*/
|
/*----------------------------*/
|
||||||
|
|
||||||
|
|
||||||
if(trim($POType) == REVENUE )
|
if(trim($POType) == REVENUE )
|
||||||
{
|
{
|
||||||
// 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 . ");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if($txtspl==1 || $txtspl==2)
|
if($txtspl==1 || $txtspl==2)
|
||||||
{
|
{
|
||||||
$PONOigr = $PONO;
|
|
||||||
|
|
||||||
//IGR Data Entry
|
//secho "cwwe";
|
||||||
//$DeliveryChellanOrInvoiceNo = $this->input->post('ChallanInvNo');
|
//die();
|
||||||
|
|
||||||
$DeliveryChellanInvoiceNo=$this->input->post('ChallanInvNo');
|
$PONOigr = $PONO;
|
||||||
|
|
||||||
$DeliveryChellan = $this->input->post('ChallanInvDate');
|
//echo $PONOigr;
|
||||||
$DeliveryChellanDate = $this->getDateformat($DeliveryChellan);
|
//die();
|
||||||
|
//IGR Data Entry
|
||||||
|
//$DeliveryChellanOrInvoiceNo = $this->input->post('ChallanInvNo');
|
||||||
|
|
||||||
$MaterialReceive = $this->input->post('MRC');
|
$DeliveryChellanInvoiceNo=$this->input->post('ChallanInvNo');
|
||||||
$MaterialReceivedate = $this->getDateformat($MaterialReceive);
|
|
||||||
|
|
||||||
$Vehicle = $this->input->post('VehicleNo');
|
$DeliveryChellan = $this->input->post('ChallanInvDate');
|
||||||
$Courier = $this->input->post('CourierNo');
|
$DeliveryChellanDate = $this->getDateformat($DeliveryChellan);
|
||||||
|
|
||||||
|
$MaterialReceive = $this->input->post('MRC');
|
||||||
|
$MaterialReceivedate = $this->getDateformat($MaterialReceive);
|
||||||
|
|
||||||
|
$Vehicle = $this->input->post('VehicleNo');
|
||||||
|
$Courier = $this->input->post('CourierNo');
|
||||||
|
|
||||||
|
|
||||||
$CreatedBy = $this->session->userdata('userId');
|
$CreatedBy = $this->session->userdata('userId');
|
||||||
|
|
||||||
$Remarksmrir='Emergency PO without Quality Check';
|
$Remarksmrir='Emergency PO without Quality Check';
|
||||||
//$Remarks = $this->input->post('Remarks');
|
//$Remarks = $this->input->post('Remarks');
|
||||||
//$RowCount = $this->input->post('TextRowCount');
|
//$RowCount = $this->input->post('TextRowCount');
|
||||||
//echo $RowCount;
|
//echo $RowCount;
|
||||||
$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');
|
||||||
|
|
||||||
$IGRStatus = IGR_CREATED;
|
$IGRStatus = IGR_CREATED;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$igr = array();
|
$igr = array();
|
||||||
$paymentstatus = NO_PAIDIGR;
|
$paymentstatus = NO_PAIDIGR;
|
||||||
$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 = '';
|
|
||||||
if(count($igrM)>0)
|
|
||||||
{
|
|
||||||
foreach ($igrM as $key )
|
|
||||||
{
|
|
||||||
$IGRNO=$key->IGRNO;
|
|
||||||
log_message('error'," Revenue Emr-po IGR Number.".$IGRNO);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if($Qualitycheck==0)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
$mrirmastervalues = array('MRIRStatus'=>MRIR_APPROVED,'IGRNO'=>$IGRNO,'PONO'=>$PONO,'CreatedBy'=>$CreatedBy,'Createdon'=>$createddt,'Remarks'=>$Remarksmrir);
|
|
||||||
|
|
||||||
$mrirmaster = $this->mrir_model->master_mrir($mrirmastervalues);
|
|
||||||
|
|
||||||
|
|
||||||
// $MRIRNO = 'MRIR001';
|
|
||||||
$MRIRNO = '';
|
|
||||||
|
|
||||||
|
|
||||||
if(count($mrirmaster)>0)
|
|
||||||
{
|
|
||||||
foreach ($mrirmaster as $key ) {
|
|
||||||
|
|
||||||
$MRIRNO=$key->MRIRNo; }
|
|
||||||
log_message('error'," Revenue Emr-po MRIR Number.".$MRIRNO);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
for ($i = 1; $i <= $RowCount; $i++)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
$MaterialCode = $this->input->post('materialCode'.$i);
|
|
||||||
$Quantity = $this->input->post('quantity'.$i);
|
|
||||||
$Remarked = "Special PO Without Quality Check";
|
|
||||||
$MRIRStatus=MRIR_APPROVED;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//this array to store the value in child table..
|
|
||||||
$mrirdetailvalues = array('MRIRNO'=>$MRIRNO,'MaterialCode'=>$MaterialCode,'ActualQuantityReceived'=>$Quantity,'Remarks'=>$Remarked,'MRIRStatus'=>$MRIRStatus);
|
|
||||||
|
|
||||||
// print_r($mrirdetailvalues);
|
|
||||||
// echo 'MRIRItemNo001';
|
|
||||||
$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));
|
|
||||||
// print_r($getAvailableqty);
|
|
||||||
// echo "\n get available Qty";
|
|
||||||
if(count($getAvailableqty)>0)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$IGRNO = '';
|
||||||
|
if(count($igrM)>0)
|
||||||
|
{
|
||||||
|
foreach ($igrM as $key )
|
||||||
|
{
|
||||||
|
$IGRNO=$key->IGRNO;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// echo $IGRNO;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if($Qualitycheck==0)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
$mrirmastervalues = array('MRIRStatus'=>MRIR_APPROVED,'IGRNO'=>$IGRNO,'PONO'=>$PONO,'CreatedBy'=>$CreatedBy,'Createdon'=>$createddt,'Remarks'=>$Remarksmrir);
|
||||||
|
|
||||||
|
$mrirmaster = $this->mrir_model->master_mrir($mrirmastervalues);
|
||||||
|
|
||||||
|
|
||||||
|
$MRIRNO = '';
|
||||||
|
|
||||||
|
|
||||||
|
if(count($mrirmaster)>0)
|
||||||
|
|
||||||
|
{
|
||||||
|
foreach ($mrirmaster as $key ) {
|
||||||
|
|
||||||
|
$MRIRNO=$key->MRIRNo; }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
for ($i = 1; $i <= $RowCount; $i++)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
$MaterialCode = $this->input->post('materialCode'.$i);
|
||||||
|
$Quantity = $this->input->post('quantity'.$i);
|
||||||
|
|
||||||
|
$Remarked = "Special PO Without Quality Check";
|
||||||
|
|
||||||
|
$MRIRStatus=MRIR_APPROVED;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//this array to store the value in child table..
|
||||||
|
$mrirdetailvalues = array('MRIRNO'=>$MRIRNO,'MaterialCode'=>$MaterialCode,'ActualQuantityReceived'=>$Quantity,'Remarks'=>$Remarked,'MRIRStatus'=>$MRIRStatus);
|
||||||
|
|
||||||
|
|
||||||
|
//print_r($mrirdetailvalues);
|
||||||
|
//die();
|
||||||
|
|
||||||
|
$mrirdetails = $this->mrir_model->detail_mrir($mrirdetailvalues);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$getAvailableqty = $this->mrir_model->getItemQuantityFromStock(trim($MaterialCode));
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
|
||||||
|
for ($i = 1; $i <= $RowCount; $i++)
|
||||||
|
{
|
||||||
|
|
||||||
|
$MaterialCode = trim($this->input->post('materialCode'.$i));
|
||||||
|
|
||||||
|
$QuantityAsPerInvoice = $this->input->post('quantity'.$i);
|
||||||
|
|
||||||
|
$OrderedQuantity = $this->input->post('quantity'.$i);
|
||||||
|
|
||||||
|
$ReceivedQty = $this->input->post('AQuantity'.$i);
|
||||||
|
|
||||||
|
$emergencyitemcode = $this->input->post('emergencyitemcode');
|
||||||
|
|
||||||
|
$PendingQty = 0;
|
||||||
|
//echo $QuantityAsPerInvoice;
|
||||||
|
//echo $PendingQty.'ReceivedQty'.$ReceivedQty;
|
||||||
|
//echo ' ';
|
||||||
|
|
||||||
|
if(strlen($QuantityAsPerInvoice)>0 && $QuantityAsPerInvoice != '0')
|
||||||
|
{
|
||||||
|
$Remarks = "Special PO Created";
|
||||||
|
$ItemStatus = '';
|
||||||
|
//if($QuantityAsPerInvoice == $OrderedQuantity)
|
||||||
|
|
||||||
|
if($PendingQty == 0.00 )
|
||||||
|
|
||||||
|
{
|
||||||
|
$ItemStatus = IGR_CREATED;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$ItemStatus = POLINEITEM_IGRPARTIAL_CREATED;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
$CreatedBy = $this->session->userdata('userId');
|
||||||
|
|
||||||
$IGRItemStatus = REQITEM_NEW;
|
|
||||||
|
|
||||||
|
|
||||||
for ($i = 1; $i <= $RowCount; $i++)
|
|
||||||
{
|
|
||||||
|
|
||||||
$MaterialCode = trim($this->input->post('materialCode'.$i));
|
|
||||||
|
|
||||||
$QuantityAsPerInvoice = $this->input->post('quantity'.$i);
|
|
||||||
|
|
||||||
$OrderedQuantity = $this->input->post('quantity'.$i);
|
|
||||||
|
|
||||||
$ReceivedQty = $this->input->post('AQuantity'.$i);
|
|
||||||
|
|
||||||
$emergencyitemcode = $this->input->post('emergencyitemcode');
|
|
||||||
|
|
||||||
$PendingQty = 0;
|
|
||||||
//echo $QuantityAsPerInvoice;
|
|
||||||
//echo $PendingQty.'ReceivedQty'.$ReceivedQty;
|
|
||||||
//echo ' ';
|
|
||||||
|
|
||||||
if(strlen($QuantityAsPerInvoice)>0 && $QuantityAsPerInvoice != '0')
|
|
||||||
{
|
|
||||||
$Remarks = "Special PO Created";
|
|
||||||
$ItemStatus = '';
|
|
||||||
//if($QuantityAsPerInvoice == $OrderedQuantity)
|
|
||||||
|
|
||||||
if($PendingQty == 0.00 )
|
|
||||||
{
|
|
||||||
$ItemStatus = IGR_CREATED;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$ItemStatus = POLINEITEM_IGRPARTIAL_CREATED;
|
|
||||||
}
|
|
||||||
|
|
||||||
$CreatedBy = $this->session->userdata('userId');
|
|
||||||
|
|
||||||
|
|
||||||
$igrDetails = array('IGRNO'=>$IGRNO,'MaterialCode'=>$MaterialCode,'QuantityAsPerInvoice'=>$QuantityAsPerInvoice,'Remarks'=>$Remarks,'IGRItemStatus'=>$IGRItemStatus,'CreatedBy'=>$CreatedBy,'CreatedDate'=>$createddt);
|
$igrDetails = array('IGRNO'=>$IGRNO,'MaterialCode'=>$MaterialCode,'QuantityAsPerInvoice'=>$QuantityAsPerInvoice,'Remarks'=>$Remarks,'IGRItemStatus'=>$IGRItemStatus,'CreatedBy'=>$CreatedBy,'CreatedDate'=>$createddt);
|
||||||
@ -940,52 +978,52 @@ $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));
|
|
||||||
//*=====================================================*/
|
|
||||||
|
|
||||||
|
|
||||||
//*===================================================*/
|
//*===================================================*/
|
||||||
|
|
||||||
$get_pre_qty= $this->inwardgateregister_model->get_CurrentQty($MaterialCode);
|
$get_pre_qty= $this->inwardgateregister_model->get_CurrentQty($MaterialCode);
|
||||||
$av_qty=0;
|
$av_qty=0;
|
||||||
if(!empty($get_pre_qty))
|
if(!empty($get_pre_qty))
|
||||||
{
|
{
|
||||||
foreach($get_pre_qty as $gt)
|
foreach($get_pre_qty as $gt)
|
||||||
{
|
{
|
||||||
$av_qty=$gt->Current_stock;
|
$av_qty=$gt->Current_stock;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$currentav_qty= $QuantityAsPerInvoice+$av_qty;
|
$currentav_qty= $QuantityAsPerInvoice+$av_qty;
|
||||||
|
|
||||||
|
|
||||||
$current_qty= array('Current_stock'=>$currentav_qty);
|
$current_qty= array('Current_stock'=>$currentav_qty);
|
||||||
// print_r($current_qty);
|
|
||||||
// echo "\n ****";
|
|
||||||
$mMaster = $this->inwardgateregister_model->addmaterialmaster($current_qty,$MaterialCode);
|
|
||||||
log_message('error'," Revenue Emr-po Material Master Qty added.".$mMaster);
|
|
||||||
|
|
||||||
//*==================================================*/
|
$this->inwardgateregister_model->addmaterialmaster($current_qty,$MaterialCode);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//*==================================================*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -998,115 +1036,123 @@ $prefile =array();
|
|||||||
$ReceivedQuantity=$key->ReceivedQuantity;
|
$ReceivedQuantity=$key->ReceivedQuantity;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$totalReceivedqty = $ReceivedQuantity + $QuantityAsPerInvoice;
|
$totalReceivedqty = $ReceivedQuantity + $QuantityAsPerInvoice;
|
||||||
|
|
||||||
//echo '';
|
//echo '';
|
||||||
|
|
||||||
$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);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//$myfile = array('FilePath'=>$filename);
|
|
||||||
// $emergencyitemcode = $this->input->post('emergencyitemcode'.$i);
|
|
||||||
// ($this->input->post('materialCode'.$i));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$counts = $this->input->post('hidecounter');
|
|
||||||
$constants = $this->input->post('hideconstant');
|
//$myfile = array('FilePath'=>$filename);
|
||||||
|
// $emergencyitemcode = $this->input->post('emergencyitemcode'.$i);
|
||||||
|
// ($this->input->post('materialCode'.$i));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$counts = $this->input->post('hidecounter');
|
||||||
|
$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;
|
||||||
|
|
||||||
|
if(!empty($_FILES[$pathname]['name']))
|
||||||
|
{
|
||||||
|
|
||||||
|
$files = str_replace(" ","",$_FILES[$pathname]['name']);
|
||||||
|
|
||||||
|
$fcount = 0;
|
||||||
|
|
||||||
|
foreach ($prefile as $value)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
if($value == $files)
|
||||||
{
|
{
|
||||||
$pathname = 'browseFiles'.$i;
|
|
||||||
log_message('error'," Revenue Emr-po Browse File Path Name ".$pathname);
|
|
||||||
|
|
||||||
if(!empty($_FILES[$pathname]['name']))
|
|
||||||
{
|
|
||||||
|
|
||||||
$files = str_replace(" ","",$_FILES[$pathname]['name']);
|
|
||||||
log_message('error'," Revenue Emr-po File Name ".$files);
|
|
||||||
|
|
||||||
$fcount = 0;
|
|
||||||
|
|
||||||
foreach ($prefile as $value)
|
|
||||||
{
|
|
||||||
|
|
||||||
if($value == $files) $fcount++;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if($fcount == 0)
|
|
||||||
{
|
|
||||||
$Picture = $this->addfile($pathname);
|
|
||||||
log_message('error'," Revenue Emr-po File status ".$Picture);
|
|
||||||
$arr[] = array($Picture);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
$prefile[] = $files;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!empty($arr))
|
|
||||||
{
|
|
||||||
foreach($arr as $ma)
|
|
||||||
{
|
|
||||||
|
|
||||||
$index = 0;
|
|
||||||
$filename = null;
|
|
||||||
foreach($ma as $key=>$value)
|
|
||||||
{
|
|
||||||
$index++;
|
|
||||||
if($index == 1){
|
|
||||||
$filename = $value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(!empty($filename)){
|
|
||||||
|
|
||||||
$myfile = array('FilePath'=>$filename,'PONO'=>$PONO,'IGRNO'=>$IGRNO);
|
|
||||||
//print_r($myfile);
|
|
||||||
$fileno = $this->purchaseorder_model->fileupload($myfile);
|
|
||||||
log_message('error'," Revenue Emr-po File Number.".$fileno);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
$fcount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
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');
|
if($fcount == 0)
|
||||||
|
{
|
||||||
|
$Picture = $this->addfile($pathname);
|
||||||
|
//echo $Picture;
|
||||||
|
$arr[] = array($Picture);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$prefile[] = $files;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!empty($arr))
|
||||||
|
{
|
||||||
|
foreach($arr as $ma)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
$index = 0;
|
||||||
|
$filename = null;
|
||||||
|
foreach($ma as $key=>$value)
|
||||||
|
{
|
||||||
|
$index++;
|
||||||
|
if($index == 1){
|
||||||
|
$filename = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!empty($filename))
|
||||||
|
{
|
||||||
|
|
||||||
|
$myfile = array('FilePath'=>$filename,'PONO'=>$PONO,'IGRNO'=>$IGRNO);
|
||||||
|
$this->purchaseorder_model->fileupload($myfile);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
echo "<script>alert('You Have Successfully created the Purchase order! $PONO');</script>";
|
||||||
|
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,236 +307,270 @@ 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_number = $rs['invoice_number'];
|
||||||
$invoice_date = $rs['date'];
|
$invoice_date = $rs['date'];
|
||||||
|
$status = $rs['status'];
|
||||||
|
$due_date = $rs['due_date'];
|
||||||
|
|
||||||
|
$invoice_time=$rs['created_time'];
|
||||||
|
$time_array = explode("T", $invoice_time);
|
||||||
|
$time_array = explode("+",$time_array[1]);
|
||||||
|
$invoice_time = $time_array[0];
|
||||||
|
|
||||||
$sql_invoice_chk = $this->Zohobook_model->ip_invoices($invoice_number , $invoice_date);
|
$sql_invoice_chk = $this->Zohobook_model->ip_invoices($invoice_number , $invoice_date);
|
||||||
if($sql_invoice_chk <= 0)
|
if($sql_invoice_chk <= 0)
|
||||||
{
|
{
|
||||||
$gst_no = $rs['gst_no'];
|
|
||||||
$sku = $rs['line_items'][0]['sku'];
|
|
||||||
$invoice_number = $rs['invoice_number'];
|
|
||||||
$invoice_date = $rs['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'];
|
|
||||||
$time_array = explode("T", $invoice_time);
|
|
||||||
$time_array = explode("+",$time_array[1]);
|
|
||||||
$invoice_time = $time_array[0];
|
|
||||||
$status = $rs['status'];
|
|
||||||
|
|
||||||
$vehicle_number = $rs['custom_field_hash']['cf_vehicle_number'];
|
$gst_sql = $this->Zohobook_model->ip_clients($gst_no);
|
||||||
$transport_mode =$rs['custom_field_hash']['cf_transport_mode'];
|
if($gst_sql)
|
||||||
$purchase_order_date = $rs['custom_field_hash']['cf_purchase_order_date'];
|
{
|
||||||
$driver = $rs['custom_field_hash']['cf_driver'];
|
$client_id = $gst_sql[0]['client_id'];
|
||||||
$place_of_supply = $rs['custom_field_hash']['cf_place_of_supply'];
|
log_message('error', 'Data fetch success DB : ip_clients , client_id : '.$client_id);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
log_message('error', 'No data => Data fetch failed DB : ip_clients '.$gst_no);
|
||||||
|
$gst_no_data['client_tax_code'] = $gst_no;
|
||||||
|
$gst_sql = $this->Zohobook_model->insert($gst_no_data,'ip_clients');
|
||||||
|
$client_id = $gst_sql[0]['tax_rate_id'];
|
||||||
|
log_message('error', 'New Data Created : DB : ip_clients , client_id : '.$client_id);
|
||||||
|
}
|
||||||
|
|
||||||
$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';
|
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||||
$getsgsttax = $this->Zohobook_model->ip_tax_rates($sgst);
|
$charactersLength = strlen($characters);
|
||||||
if($getsgsttax)
|
$randomString = '';
|
||||||
{
|
for ($i = 0; $i < 16; $i++) { $randomString .= $characters[rand(0, $charactersLength - 1)]; }
|
||||||
$sgsttaxid = $getsgsttax[0]['tax_rate_id'];
|
$url_key = $randomString;
|
||||||
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'];
|
$ip_invoices['user_id'] = 1;
|
||||||
$item_tax_total = $rs['tax_total'];
|
$ip_invoices['client_id'] = $client_id;
|
||||||
$item_total = $rs['total'];
|
$ip_invoices['invoice_group_id'] = 6;
|
||||||
$item_sgst_amt = $rs['taxes'][1]['tax_amount'];
|
$ip_invoices['invoice_status_id'] = ($status == 'draft' ? 1 : (($status == 'sent' || $status == 'overdue') ? 2 : 5));
|
||||||
$item_cgst_amt = $rs['taxes'][0]['tax_amount'];
|
$ip_invoices['invoice_date_created'] = $invoice_date;
|
||||||
|
$ip_invoices['invoice_time_created'] = $invoice_time;
|
||||||
|
$ip_invoices['invoice_date_due'] = $due_date;
|
||||||
|
$ip_invoices['invoice_number'] = $invoice_number;
|
||||||
|
$ip_invoices['invoice_url_key'] = $url_key;
|
||||||
|
$ip_invoices['receivedstatus'] = 'ST066';
|
||||||
|
$ip_invoices['credit_status'] = 0;
|
||||||
|
$invoice_insert_id = $this->Zohobook_model->insert($ip_invoices,'ip_invoices');
|
||||||
|
if($invoice_insert_id)
|
||||||
|
{
|
||||||
|
log_message('error', 'Data insert success DB : ip_invoices client id :'. $client_id);
|
||||||
|
$insert_count = $insert_count + 1;
|
||||||
|
//start invoice level custom fields
|
||||||
|
|
||||||
$item_discount = 0.00;
|
//custom fields insert
|
||||||
$item_igst_amt = 0.00;
|
|
||||||
if($batch_no==""){ $batch_no = "";}
|
|
||||||
$gst_sql = $this->Zohobook_model->ip_clients($gst_no);
|
|
||||||
if($gst_sql)
|
|
||||||
{
|
|
||||||
$client_id = $gst_sql[0]['client_id'];
|
|
||||||
log_message('error', 'Data fetch success DB : ip_clients , client_id : '.$client_id);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
log_message('error', 'No data => Data fetch failed DB : ip_clients '.$gst_no);
|
|
||||||
$gst_no_data['client_tax_code'] = $gst_no;
|
|
||||||
$gst_sql = $this->Zohobook_model->insert($gst_no_data,'ip_clients');
|
|
||||||
$client_id = $gst_sql[0]['tax_rate_id'];
|
|
||||||
log_message('error', 'New Data Created : DB : ip_clients , client_id : '.$client_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
$sku_sql = $this->Zohobook_model->ip_products($sku);
|
$batch_no = isset($rs['custom_fields'][5]['value']) ? $rs['custom_fields'][5]['value'] : "";
|
||||||
if($sku_sql)
|
// $batch_no = "";
|
||||||
{
|
$vehicle_number = $rs['custom_field_hash']['cf_vehicle_number'];
|
||||||
$product_id = $sku_sql[0]['product_id'];
|
$transport_mode =$rs['custom_field_hash']['cf_transport_mode'];
|
||||||
log_message('error', 'Data fetch success DB : ip_products , product_id : '.$product_id);
|
$purchase_order_date = $rs['custom_field_hash']['cf_purchase_order_date'];
|
||||||
}
|
$driver = $rs['custom_field_hash']['cf_driver'];
|
||||||
else
|
$place_of_supply = $rs['custom_field_hash']['cf_place_of_supply'];
|
||||||
{
|
// batch_no
|
||||||
log_message('error', 'No data => Data fetch failed DB : ip_products '. $sku);
|
$ip_invoice_custom_b['invoice_id'] = $invoice_insert_id;
|
||||||
$sku_data['product_name'] = $item_name;
|
$ip_invoice_custom_b['invoice_custom_fieldid'] = 62;
|
||||||
$sku_data['product_description'] = $item_description;
|
$ip_invoice_custom_b['invoice_custom_fieldvalue'] = $batch_no;
|
||||||
$sku_data['sku'] = $sku;
|
$result_invoice_custom_insert = $this->Zohobook_model->insert($ip_invoice_custom_b,'ip_invoice_custom');
|
||||||
$sku_sql = $this->Zohobook_model->insert($sku_data,'ip_products');
|
if($result_invoice_custom_insert)
|
||||||
$product_id = $sku_sql[0]['sku'];
|
log_message('error', 'Data insert success DB : ip_invoice_custom ');
|
||||||
log_message('error', 'sku'.$sku);
|
else
|
||||||
log_message('error', 'New Data Created : DB : product_id , product_id : '.$product_id);
|
log_message('error', 'Data insert failed DB : ip_invoice_custom ');
|
||||||
}
|
// vehicle_number
|
||||||
|
$ip_invoice_custom_v['invoice_id'] = $invoice_insert_id;
|
||||||
|
$ip_invoice_custom_v['invoice_custom_fieldid'] = 8;
|
||||||
|
$ip_invoice_custom_v['invoice_custom_fieldvalue'] = $vehicle_number;
|
||||||
|
$res_vehicle = $this->Zohobook_model->insert($ip_invoice_custom_v,'ip_invoice_custom');
|
||||||
|
if($res_vehicle)
|
||||||
|
log_message('error', 'Data insert success DB : ip_invoice_custom ');
|
||||||
|
else
|
||||||
|
log_message('error', 'Data insert failed DB : ip_invoice_custom ');
|
||||||
|
// transport_mode
|
||||||
|
$ip_invoice_custom_t['invoice_id'] = $invoice_insert_id;
|
||||||
|
$ip_invoice_custom_t['invoice_custom_fieldid'] = 7;
|
||||||
|
$ip_invoice_custom_t['invoice_custom_fieldvalue'] = $transport_mode;
|
||||||
|
$res_transport_mode = $this->Zohobook_model->insert($ip_invoice_custom_t,'ip_invoice_custom');
|
||||||
|
if($res_transport_mode)
|
||||||
|
log_message('error', 'Data insert success DB : ip_invoice_custom ');
|
||||||
|
else
|
||||||
|
log_message('error', 'Data insert failed DB : ip_invoice_custom ');
|
||||||
|
// purchase_order_date
|
||||||
|
$ip_invoice_custom_p['invoice_id'] = $invoice_insert_id;
|
||||||
|
$ip_invoice_custom_p['invoice_custom_fieldid'] = 15;
|
||||||
|
$ip_invoice_custom_p['invoice_custom_fieldvalue'] = $purchase_order_date;
|
||||||
|
$res_purchase_order_date =$this->Zohobook_model->insert($ip_invoice_custom_p,'ip_invoice_custom');
|
||||||
|
if($res_purchase_order_date)
|
||||||
|
log_message('error', 'Data insert success DB : ip_invoice_custom ');
|
||||||
|
else
|
||||||
|
log_message('error', 'Data insert failed DB : ip_invoice_custom ');
|
||||||
|
// driver
|
||||||
|
$ip_invoice_custom_d['invoice_id'] = $invoice_insert_id;
|
||||||
|
$ip_invoice_custom_d['invoice_custom_fieldid'] = 58;
|
||||||
|
$ip_invoice_custom_d['invoice_custom_fieldvalue'] = $driver;
|
||||||
|
$res_driver = $this->Zohobook_model->insert($ip_invoice_custom_d,'ip_invoice_custom');
|
||||||
|
if($res_driver)
|
||||||
|
log_message('error', 'Data insert success DB : ip_invoice_custom ');
|
||||||
|
else
|
||||||
|
log_message('error', 'Data insert failed DB : ip_invoice_custom ');
|
||||||
|
// place_of_supply
|
||||||
|
$ip_invoice_custom_d['invoice_id'] = $invoice_insert_id;
|
||||||
|
$ip_invoice_custom_d['invoice_custom_fieldid'] = 10;
|
||||||
|
$ip_invoice_custom_d['invoice_custom_fieldvalue'] = $place_of_supply;
|
||||||
|
$res_place = $this->Zohobook_model->insert($ip_invoice_custom_d,'ip_invoice_custom');
|
||||||
|
if($res_place)
|
||||||
|
log_message('error', 'Data insert success DB : ip_invoice_custom ');
|
||||||
|
else
|
||||||
|
log_message('error', 'Data insert failed DB : ip_invoice_custom ');
|
||||||
|
//end invoice level custom fields
|
||||||
|
|
||||||
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
//if line items available
|
||||||
$charactersLength = strlen($characters);
|
if(isset($rs['line_items']) && count($rs['line_items']) > 0)
|
||||||
$randomString = '';
|
{
|
||||||
for ($i = 0; $i < 16; $i++) { $randomString .= $characters[rand(0, $charactersLength - 1)]; }
|
log_message('error', 'Processing line items'.count($rs['line_items']));
|
||||||
$url_key = $randomString;
|
|
||||||
|
|
||||||
$ip_invoices['user_id'] = 1;
|
for($i = 0; $i< count($rs['line_items']);$i++)
|
||||||
$ip_invoices['client_id'] = $client_id;
|
{ //start insert line items
|
||||||
$ip_invoices['invoice_group_id'] = 6;
|
$sku = $rs['line_items'][$i]['sku'];
|
||||||
$ip_invoices['invoice_status_id'] = 2;
|
|
||||||
$ip_invoices['invoice_date_created'] = $invoice_date;
|
|
||||||
$ip_invoices['invoice_time_created'] = $invoice_time;
|
|
||||||
$ip_invoices['invoice_date_due'] = $due_date;
|
|
||||||
$ip_invoices['invoice_number'] = $invoice_number;
|
|
||||||
$ip_invoices['invoice_url_key'] = $url_key;
|
|
||||||
$ip_invoices['receivedstatus'] = 'ST066';
|
|
||||||
$ip_invoices['credit_status'] = 0;
|
|
||||||
$invoice_insert_id = $this->Zohobook_model->insert($ip_invoices,'ip_invoices');
|
|
||||||
if($invoice_insert_id)
|
|
||||||
log_message('error', 'Data insert success DB : ip_invoices client id :'. $client_id);
|
|
||||||
else
|
|
||||||
log_message('error', 'Data insert failed DB : ip_invoice_items client id :'. $client_id);
|
|
||||||
|
|
||||||
$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
|
$item_price = $rs['line_items'][$i]['rate'];
|
||||||
$ip_invoice_item_amounts['item_id'] = $item_insert_id;
|
$item_order = $rs['line_items'][$i]['item_order'];
|
||||||
$ip_invoice_item_amounts['item_subtotal'] = $item_subtotal;
|
$item_product_unit = $rs['line_items'][$i]['unit'];
|
||||||
$ip_invoice_item_amounts['item_tax_total'] = $item_tax_total;
|
$item_name = $rs['line_items'][$i]['name'];
|
||||||
$ip_invoice_item_amounts['item_total'] = $item_total;
|
$item_description = $rs['line_items'][$i]['description'];
|
||||||
$ip_invoice_item_amounts['item_sgst_amt'] = $item_sgst_amt;
|
$item_quantity = $rs['line_items'][$i]['quantity'];
|
||||||
$ip_invoice_item_amounts['item_cgst_amt'] = $item_cgst_amt;
|
$cgst = $rs['line_items'][$i]['line_item_taxes'][1]['tax_name'];
|
||||||
$ip_invoice_item_amounts['item_discount'] = $item_discount;
|
$sgst = $rs['line_items'][$i]['line_item_taxes'][0]['tax_name'];
|
||||||
$ip_invoice_item_amounts['item_igst_amt'] = $item_igst_amt;
|
$cgst = $cgst[4];
|
||||||
$result_tax_amount_insert = $this->Zohobook_model->insert($ip_invoice_item_amounts,'ip_invoice_item_amounts');
|
$sgst = $sgst[4];
|
||||||
if($result_tax_amount_insert)
|
$cgst = $cgst.'.000';
|
||||||
log_message('error', 'Data insert success DB : ip_invoice_item_amounts ');
|
$getcgsttax = $this->Zohobook_model->ip_tax_rates($cgst);
|
||||||
else
|
if($getcgsttax)
|
||||||
log_message('error', 'Data insert failed DB : ip_invoice_item_amounts ');
|
{
|
||||||
|
$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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//custom fields insert
|
|
||||||
// batch_no
|
|
||||||
$ip_invoice_custom_b['invoice_id'] = $invoice_insert_id;
|
|
||||||
$ip_invoice_custom_b['invoice_custom_fieldid'] = 62;
|
|
||||||
$ip_invoice_custom_b['invoice_custom_fieldvalue'] = $batch_no;
|
|
||||||
$result_invoice_custom_insert = $this->Zohobook_model->insert($ip_invoice_custom_b,'ip_invoice_custom');
|
|
||||||
if($result_invoice_custom_insert)
|
|
||||||
log_message('error', 'Data insert success DB : ip_invoice_custom ');
|
|
||||||
else
|
|
||||||
log_message('error', 'Data insert failed DB : ip_invoice_custom ');
|
|
||||||
// vehicle_number
|
|
||||||
$ip_invoice_custom_v['invoice_id'] = $invoice_insert_id;
|
|
||||||
$ip_invoice_custom_v['invoice_custom_fieldid'] = 8;
|
|
||||||
$ip_invoice_custom_v['invoice_custom_fieldvalue'] = $vehicle_number;
|
|
||||||
$res_vehicle = $this->Zohobook_model->insert($ip_invoice_custom_v,'ip_invoice_custom');
|
|
||||||
if($res_vehicle)
|
|
||||||
log_message('error', 'Data insert success DB : ip_invoice_custom ');
|
|
||||||
else
|
|
||||||
log_message('error', 'Data insert failed DB : ip_invoice_custom ');
|
|
||||||
// transport_mode
|
|
||||||
$ip_invoice_custom_t['invoice_id'] = $invoice_insert_id;
|
|
||||||
$ip_invoice_custom_t['invoice_custom_fieldid'] = 7;
|
|
||||||
$ip_invoice_custom_t['invoice_custom_fieldvalue'] = $transport_mode;
|
|
||||||
$res_transport_mode = $this->Zohobook_model->insert($ip_invoice_custom_t,'ip_invoice_custom');
|
|
||||||
if($res_transport_mode)
|
|
||||||
log_message('error', 'Data insert success DB : ip_invoice_custom ');
|
|
||||||
else
|
|
||||||
log_message('error', 'Data insert failed DB : ip_invoice_custom ');
|
|
||||||
// purchase_order_date
|
|
||||||
$ip_invoice_custom_p['invoice_id'] = $invoice_insert_id;
|
|
||||||
$ip_invoice_custom_p['invoice_custom_fieldid'] = 15;
|
|
||||||
$ip_invoice_custom_p['invoice_custom_fieldvalue'] = $purchase_order_date;
|
|
||||||
$res_purchase_order_date =$this->Zohobook_model->insert($ip_invoice_custom_p,'ip_invoice_custom');
|
|
||||||
if($res_purchase_order_date)
|
|
||||||
log_message('error', 'Data insert success DB : ip_invoice_custom ');
|
|
||||||
else
|
|
||||||
log_message('error', 'Data insert failed DB : ip_invoice_custom ');
|
|
||||||
// driver
|
|
||||||
$ip_invoice_custom_d['invoice_id'] = $invoice_insert_id;
|
|
||||||
$ip_invoice_custom_d['invoice_custom_fieldid'] = 58;
|
|
||||||
$ip_invoice_custom_d['invoice_custom_fieldvalue'] = $driver;
|
|
||||||
$res_driver = $this->Zohobook_model->insert($ip_invoice_custom_d,'ip_invoice_custom');
|
|
||||||
if($res_driver)
|
|
||||||
log_message('error', 'Data insert success DB : ip_invoice_custom ');
|
|
||||||
else
|
|
||||||
log_message('error', 'Data insert failed DB : ip_invoice_custom ');
|
|
||||||
// place_of_supply
|
|
||||||
$ip_invoice_custom_d['invoice_id'] = $invoice_insert_id;
|
|
||||||
$ip_invoice_custom_d['invoice_custom_fieldid'] = 10;
|
|
||||||
$ip_invoice_custom_d['invoice_custom_fieldvalue'] = $place_of_supply;
|
|
||||||
$res_place = $this->Zohobook_model->insert($ip_invoice_custom_d,'ip_invoice_custom');
|
|
||||||
if($res_place)
|
|
||||||
log_message('error', 'Data insert success DB : ip_invoice_custom ');
|
|
||||||
else
|
|
||||||
log_message('error', 'Data insert failed DB : ip_invoice_custom ');
|
|
||||||
$insert_count = $insert_count + 1;
|
|
||||||
}
|
}
|
||||||
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)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -514,8 +514,8 @@ class report extends BaseController
|
|||||||
$PO= $this->input->post('id');
|
$PO= $this->input->post('id');
|
||||||
|
|
||||||
//$PONO= substr($PO,10);
|
//$PONO= substr($PO,10);
|
||||||
$split_id = explode('-', $PO,2);
|
$split_id = explode('-', $PO,2);
|
||||||
$PONO=$split_id[1];
|
$PONO=$split_id[1];
|
||||||
$data = $this->dahsboard_Model->getfile($PONO);
|
$data = $this->dahsboard_Model->getfile($PONO);
|
||||||
|
|
||||||
// print_r( $data);die;
|
// print_r( $data);die;
|
||||||
@ -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,8 +434,8 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -19,7 +19,7 @@ class user extends BaseController
|
|||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->load->model('user_model');
|
$this->load->model('user_model');
|
||||||
$this->load->model('dahsboard_Model');
|
$this->load->model('dahsboard_Model');
|
||||||
$this->load->library('form_validation');
|
$this->load->library('form_validation');
|
||||||
$this->load->model('costcenter_model');
|
$this->load->model('costcenter_model');
|
||||||
|
|
||||||
$this->isLoggedIn();
|
$this->isLoggedIn();
|
||||||
@ -39,40 +39,40 @@ class user extends BaseController
|
|||||||
$this->load->model('employeedetails_model');
|
$this->load->model('employeedetails_model');
|
||||||
|
|
||||||
|
|
||||||
$this->load->model('dahsboard_Model');
|
$this->load->model('dahsboard_Model');
|
||||||
|
|
||||||
$data['EmpCount'] = $this->employeedetails_model->getEmployeeCount();
|
$data['EmpCount'] = $this->employeedetails_model->getEmployeeCount();
|
||||||
|
|
||||||
$data['totalpurchaseorder']=$this->dahsboard_Model->totalpurchaseorder();
|
$data['totalpurchaseorder']=$this->dahsboard_Model->totalpurchaseorder();
|
||||||
|
|
||||||
//print_r( $data['totalpurchaseorder']);
|
//print_r( $data['totalpurchaseorder']);
|
||||||
$data['totalordervalue']=$this->dahsboard_Model->totalordervalue();
|
$data['totalordervalue']=$this->dahsboard_Model->totalordervalue();
|
||||||
$data['pendingpo']=$this->dahsboard_Model->pendingpo();
|
$data['pendingpo']=$this->dahsboard_Model->pendingpo();
|
||||||
// $data['totalserviceamount']=$this->dahsboard_Model->totalserviceamount();
|
// $data['totalserviceamount']=$this->dahsboard_Model->totalserviceamount();
|
||||||
// $data['totalcapitalamount']=$this->dahsboard_Model->totalcapitalamount();
|
// $data['totalcapitalamount']=$this->dahsboard_Model->totalcapitalamount();
|
||||||
// $data['totalimportamount']=$this->dahsboard_Model->totalimportamount();
|
// $data['totalimportamount']=$this->dahsboard_Model->totalimportamount();
|
||||||
// $data['totalrevenueamount']=$this->dahsboard_Model->totalrevenueamount();
|
// $data['totalrevenueamount']=$this->dahsboard_Model->totalrevenueamount();
|
||||||
|
|
||||||
|
|
||||||
// $data['totalservicepo']=$this->dahsboard_Model->totalservicepo();
|
// $data['totalservicepo']=$this->dahsboard_Model->totalservicepo();
|
||||||
// $data['totalrevenuepo']=$this->dahsboard_Model->totalrevenuepo();
|
// $data['totalrevenuepo']=$this->dahsboard_Model->totalrevenuepo();
|
||||||
$data['totalimportpo']=$this->dahsboard_Model->totalimportpo();
|
$data['totalimportpo']=$this->dahsboard_Model->totalimportpo();
|
||||||
//$data['totalcapitalpo']=$this->dahsboard_Model->totalcapitalpo();
|
//$data['totalcapitalpo']=$this->dahsboard_Model->totalcapitalpo();
|
||||||
|
|
||||||
$data['details']=$this->dahsboard_Model->reqdetail();
|
$data['details']=$this->dahsboard_Model->reqdetail();
|
||||||
|
|
||||||
$data['pending_details']=$this->dahsboard_Model->req_pending();
|
$data['pending_details']=$this->dahsboard_Model->req_pending();
|
||||||
// $data['list']=$this->dahsboard_Model->req_list();
|
// $data['list']=$this->dahsboard_Model->req_list();
|
||||||
|
|
||||||
$data['serviceprogress']=$this->dahsboard_Model->serviceprogress();
|
$data['serviceprogress']=$this->dahsboard_Model->serviceprogress();
|
||||||
$data['revenueprogress']=$this->dahsboard_Model->revenueprogress();
|
$data['revenueprogress']=$this->dahsboard_Model->revenueprogress();
|
||||||
$data['importprogress']=$this->dahsboard_Model->importprogress();
|
$data['importprogress']=$this->dahsboard_Model->importprogress();
|
||||||
$data['capitalprogress']=$this->dahsboard_Model->capitalprogress();
|
$data['capitalprogress']=$this->dahsboard_Model->capitalprogress();
|
||||||
//month-wise area chart
|
//month-wise area chart
|
||||||
$data['getTotalServicePoCount'] = $this->dahsboard_Model->getTotalServicePoCount();
|
$data['getTotalServicePoCount'] = $this->dahsboard_Model->getTotalServicePoCount();
|
||||||
$data['getTotalimportPoCount'] = $this->dahsboard_Model->getTotalimportPoCount();
|
$data['getTotalimportPoCount'] = $this->dahsboard_Model->getTotalimportPoCount();
|
||||||
$data['getTotalcapitalPoCount'] = $this->dahsboard_Model->getTotalcapitalPoCount();
|
$data['getTotalcapitalPoCount'] = $this->dahsboard_Model->getTotalcapitalPoCount();
|
||||||
$data['getTotalrevenuePoCount'] = $this->dahsboard_Model->getTotalrevenuePoCount();
|
$data['getTotalrevenuePoCount'] = $this->dahsboard_Model->getTotalrevenuePoCount();
|
||||||
|
|
||||||
|
|
||||||
//dashboard pie chart
|
//dashboard pie chart
|
||||||
@ -91,7 +91,7 @@ class user extends BaseController
|
|||||||
$data['totpay'] = $this->dahsboard_Model->totpay();
|
$data['totpay'] = $this->dahsboard_Model->totpay();
|
||||||
$data['totrec'] = $this->dahsboard_Model->totrec();
|
$data['totrec'] = $this->dahsboard_Model->totrec();
|
||||||
$data['emplist'] = $this->dahsboard_Model->emplist();
|
$data['emplist'] = $this->dahsboard_Model->emplist();
|
||||||
//print_r($data['totemp']);die;
|
//print_r($data['totemp']);die;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -561,10 +561,10 @@ function dateFunctionChangeVales()
|
|||||||
|
|
||||||
$data['employeeSalary'] = $employeeSalary;
|
$data['employeeSalary'] = $employeeSalary;
|
||||||
|
|
||||||
$working = array();
|
$working = array();
|
||||||
$overtime = array();
|
$overtime = array();
|
||||||
//$holid = array();
|
//$holid = array();
|
||||||
$len = date('d',strtotime($date));
|
$len = date('d',strtotime($date));
|
||||||
for ($i = 1; $i <= $len; $i++) //echo $dat; die;
|
for ($i = 1; $i <= $len; $i++) //echo $dat; die;
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -684,7 +684,7 @@ function dateFunctionChangeVales()
|
|||||||
}
|
}
|
||||||
$data['totalSalary'] = $totalSalary;
|
$data['totalSalary'] = $totalSalary;
|
||||||
|
|
||||||
//print_r($data['totalSalary']);die;
|
//print_r($data['totalSalary']);die;
|
||||||
// }
|
// }
|
||||||
echo json_encode($data);
|
echo json_encode($data);
|
||||||
}
|
}
|
||||||
@ -1136,9 +1136,9 @@ function attendanceyear($empID ='')
|
|||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
$data['EmpList'] = $this->user_model->getAllEmployees();
|
$data['EmpList'] = $this->user_model->getAllEmployees();
|
||||||
|
|
||||||
$data['roles'] = $this->user_model->getUserRoles();
|
$data['roles'] = $this->user_model->getUserRoles();
|
||||||
|
|
||||||
$data['Department'] = $this->costcenter_model->getDepartment();
|
$data['Department'] = $this->costcenter_model->getDepartment();
|
||||||
|
|
||||||
@ -1166,10 +1166,10 @@ function attendanceyear($empID ='')
|
|||||||
else { echo("false"); }
|
else { echo("false"); }
|
||||||
}
|
}
|
||||||
/* Validation for Employee Dropdown
|
/* Validation for Employee Dropdown
|
||||||
*/
|
*/
|
||||||
function Employee_validate($selectValue)
|
function Employee_validate($selectValue)
|
||||||
{
|
{
|
||||||
//echo 'select_validate method called';
|
//echo 'select_validate method called';
|
||||||
// 'none' is the first option and the text says something like "-Choose one-"
|
// 'none' is the first option and the text says something like "-Choose one-"
|
||||||
if($selectValue == '0')
|
if($selectValue == '0')
|
||||||
{
|
{
|
||||||
@ -1182,10 +1182,10 @@ function attendanceyear($empID ='')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Validation for Employee Dropdown
|
/* Validation for Employee Dropdown
|
||||||
*/
|
*/
|
||||||
function Role_validate($selectValue)
|
function Role_validate($selectValue)
|
||||||
{
|
{
|
||||||
//echo 'select_validate method called';
|
//echo 'select_validate method called';
|
||||||
// 'none' is the first option and the text says something like "-Choose one-"
|
// 'none' is the first option and the text says something like "-Choose one-"
|
||||||
if($selectValue == '0')
|
if($selectValue == '0')
|
||||||
{
|
{
|
||||||
@ -1338,17 +1338,17 @@ function Adduserdepartment()
|
|||||||
}
|
}
|
||||||
|
|
||||||
$Uid = $_GET['UID'];
|
$Uid = $_GET['UID'];
|
||||||
$Empid = $_GET['EMPID'];
|
$Empid = $_GET['EMPID'];
|
||||||
|
|
||||||
|
|
||||||
$data['roles'] = $this->user_model->getUserRoles();
|
$data['roles'] = $this->user_model->getUserRoles();
|
||||||
|
|
||||||
//print_r($data);
|
//print_r($data);
|
||||||
|
|
||||||
$data['EmpList'] = $this->user_model->GetEmployeeDetails($Uid);
|
$data['EmpList'] = $this->user_model->GetEmployeeDetails($Uid);
|
||||||
//print_r($data);
|
//print_r($data);
|
||||||
$data['Departmentlist'] = $this->costcenter_model->getDepartmentnotadded($Empid);
|
$data['Departmentlist'] = $this->costcenter_model->getDepartmentnotadded($Empid);
|
||||||
$data['EmpRole'] = $this->user_model->GetRoleNameByUserID($Uid);
|
$data['EmpRole'] = $this->user_model->GetRoleNameByUserID($Uid);
|
||||||
$data['AccessDept'] = $this->costcenter_model ->getaccessDept($Empid);
|
$data['AccessDept'] = $this->costcenter_model ->getaccessDept($Empid);
|
||||||
|
|
||||||
// $data['userInfo'] = $this->user_model->getUserInfo($userId);
|
// $data['userInfo'] = $this->user_model->getUserInfo($userId);
|
||||||
@ -1371,9 +1371,9 @@ function Adduserdepartment()
|
|||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
$userId = $this->input->post('EmpList');
|
$userId = $this->input->post('EmpList');
|
||||||
$this->form_validation->set_rules('EmpList','EmpList','trim|callback_Employee_validateS');
|
$this->form_validation->set_rules('EmpList','EmpList','trim|callback_Employee_validateS');
|
||||||
$this->form_validation->set_rules('role','role','trim|callback_Role_validate');
|
$this->form_validation->set_rules('role','role','trim|callback_Role_validate');
|
||||||
$this->form_validation->set_rules('password','Password','required|max_length[20]');
|
$this->form_validation->set_rules('password','Password','required|max_length[20]');
|
||||||
$this->form_validation->set_rules('cpassword','Confirm Password','trim|required|matches[password]|max_length[20]');
|
$this->form_validation->set_rules('cpassword','Confirm Password','trim|required|matches[password]|max_length[20]');
|
||||||
|
|
||||||
@ -1384,17 +1384,17 @@ function Adduserdepartment()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$EmpID = $this->input->post('EmpList');
|
$EmpID = $this->input->post('EmpList');
|
||||||
$role = $this->input->post('role');
|
$role = $this->input->post('role');
|
||||||
$password = $this->input->post('password');
|
$password = $this->input->post('password');
|
||||||
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
|
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
|
||||||
$updatedDate = $dt->format('Y-m-d H:i:s');
|
$updatedDate = $dt->format('Y-m-d H:i:s');
|
||||||
|
|
||||||
// echo $EmpID;
|
// echo $EmpID;
|
||||||
|
|
||||||
$userInfo = array();
|
$userInfo = array();
|
||||||
|
|
||||||
|
|
||||||
$userInfo = array('password'=>getHashedPassword($password),'roleId'=>$role,'EmpId'=>$EmpID,'updatedDtm'=>$updatedDate);
|
$userInfo = array('password'=>getHashedPassword($password),'roleId'=>$role,'EmpId'=>$EmpID,'updatedDtm'=>$updatedDate);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1423,16 +1423,16 @@ function Adduserdepartment()
|
|||||||
function deleteUser()
|
function deleteUser()
|
||||||
{
|
{
|
||||||
echo 'Delete';
|
echo 'Delete';
|
||||||
$Uid = $this->input->post('id');
|
$Uid = $this->input->post('id');
|
||||||
|
|
||||||
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
|
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
|
||||||
$updatedDate = $dt->format('Y-m-d H:i:s');
|
$updatedDate = $dt->format('Y-m-d H:i:s');
|
||||||
|
|
||||||
$userInfo = array('isDeleted'=>1,'updatedBy'=>$this->vendorId, 'updatedDtm'=>$updatedDate);
|
$userInfo = array('isDeleted'=>1,'updatedBy'=>$this->vendorId, 'updatedDtm'=>$updatedDate);
|
||||||
|
|
||||||
$result = $this->user_model->deleteUser($Uid, $userInfo);
|
$result = $this->user_model->deleteUser($Uid, $userInfo);
|
||||||
|
|
||||||
echo 'Succssfully change the user status to InAcive';
|
echo 'Succssfully change the user status to InAcive';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -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