diff --git a/app/Controllers/Amendmentpurchaseorder.php b/app/Controllers/Amendmentpurchaseorder.php index df3325dc..ea0fc03c 100755 --- a/app/Controllers/Amendmentpurchaseorder.php +++ b/app/Controllers/Amendmentpurchaseorder.php @@ -266,7 +266,8 @@ class Amendmentpurchaseorder extends BaseController } $POType = $this->request->getPost('POType'); - $PoRange = $this->request->getPost('Range'); + $Local_Interstate = $this->request->getPost('Range'); + $PaymentTermsText = $this->request->getPost('beforePaymentTermsText'); $PaymentTerms = $this->request->getPost('PaymentTerms'); $Otherpayment = $this->request->getPost('Otherpayment'); @@ -308,7 +309,7 @@ class Amendmentpurchaseorder extends BaseController } $AmendmentNewPoNo = generate_amendment_po_number($PONO); - $POMaster = array('PONO' => $AmendmentNewPoNo, 'ParentPO' => $PONO, 'SupplierID' => $SupplierID, 'POType' => $POType, 'PORange' => $PoRange, 'TotalOrderValue' => $TotalOrderValueSummary, 'PODate' => $PODate, 'Status' => $changeStatus , 'PaymentTerms' => $PaymentTerms, 'PaymentOtherDescription' => $Otherpayment, 'Mode_Of_Shipment' => $Modeofshipment, 'Supplier_Reference' => $supplierreference, 'Supplier_Offer_No' => $supplieroffno, 'Other_Reference' => $otherreference, 'Fincap' => $fincap, 'InsuranceStatus' => $insurancestatus, 'InsuranceNumber' => $InsuranceNumber, 'POSubType' => $revenuetype, 'DeliverySchedule' => $DeliverySchedule, 'DeliveryOption' => $DeliveryOption, 'ServiceDescription' => $SpecialInstruction, 'CreatedBy' => $updatedBy, 'DeliveryAddress' => $DeliveryAddr, 'DeliveryDate' => $Deliverydt, 'UpdatedOn' => $updateddt, 'ReleasedBy' => $updatedBy, 'ReleasedOn' => $updateddt, 'AmendedDetails' => $MAD, 'IsQualityChkReqired' => $qtycheckresult); + $POMaster = array('PONO' => $AmendmentNewPoNo, 'ParentPO' => $PONO, 'SupplierID' => $SupplierID, 'POType' => $POType, 'PORange' => $Local_Interstate, 'TotalOrderValue' => $TotalOrderValueSummary, 'PODate' => $PODate, 'Status' => $changeStatus , 'PaymentTerms' => $PaymentTerms, 'PaymentOtherDescription' => $Otherpayment, 'Mode_Of_Shipment' => $Modeofshipment, 'Supplier_Reference' => $supplierreference, 'Supplier_Offer_No' => $supplieroffno, 'Other_Reference' => $otherreference, 'Fincap' => $fincap, 'InsuranceStatus' => $insurancestatus, 'InsuranceNumber' => $InsuranceNumber, 'POSubType' => $revenuetype, 'DeliverySchedule' => $DeliverySchedule, 'DeliveryOption' => $DeliveryOption, 'ServiceDescription' => $SpecialInstruction, 'CreatedBy' => $updatedBy, 'DeliveryAddress' => $DeliveryAddr, 'DeliveryDate' => $Deliverydt, 'UpdatedOn' => $updateddt, 'ReleasedBy' => $updatedBy, 'ReleasedOn' => $updateddt, 'AmendedDetails' => $MAD, 'IsQualityChkReqired' => $qtycheckresult); $file = $this->request->getFile('POFile'); $requestfilename = $file->getName(); $PrePOFile = $this->request->getPost('PrePOFile'); diff --git a/app/Controllers/Assetdetails.php b/app/Controllers/Assetdetails.php index ec4fe370..24396451 100755 --- a/app/Controllers/Assetdetails.php +++ b/app/Controllers/Assetdetails.php @@ -435,6 +435,7 @@ class Assetdetails extends BaseController $User = $this->request->getPost('User'); $SupplierName = $this->request->getPost('SupplierName'); $DateOfPurchase = $this->request->getPost('DateOfPurchase'); + $DOpurchase = ""; if ($DateOfPurchase != '') { $DOpurchase = get_date_time_format($DateOfPurchase); } diff --git a/app/Controllers/Purchaseorder.php b/app/Controllers/Purchaseorder.php index dc0be372..3ef446ad 100755 --- a/app/Controllers/Purchaseorder.php +++ b/app/Controllers/Purchaseorder.php @@ -1226,6 +1226,7 @@ class Purchaseorder extends BaseController $AfterSgst = $this->request->getPost('RevenueAfterSgst' . $i); $AfterIgst = $this->request->getPost('RevenueAfterIgst' . $i); $LineitemAuditorNotes = $this->request->getPost('LineItemNoteForAuditor' . $i); + $LineitemAuditorNotes = ($LineitemAuditorNotes === null || $LineitemAuditorNotes === '') ? '-' : $LineitemAuditorNotes; if($itemRate != 0){ $this->purchaseorder_model->updateMaterialRate($MaterialCode, $itemRate); } $SkipInsert = "False"; @@ -1421,6 +1422,7 @@ class Purchaseorder extends BaseController $POLineItemNo = $this->request->getPost('LineItemNo' . $i); $CostCenter = $this->request->getPost('costCode' . $i); $LineitemAuditorNotes = $this->request->getPost('LineItemNoteForAuditor' . $i); + $LineitemAuditorNotes = ($LineitemAuditorNotes === null || $LineitemAuditorNotes === '') ? '-' : $LineitemAuditorNotes; $LineItemNo = ''; /*---------start---------------------*/ @@ -2112,7 +2114,7 @@ class Purchaseorder extends BaseController $specialinstruction = $this->request->getPost('Addinstruction' . $i); $per = $this->request->getPost('Per' . $i); $LineitemAuditorNotes = $this->request->getPost('LineItemNoteForAuditor' . $i); - + $LineitemAuditorNotes = ($LineitemAuditorNotes === null || $LineitemAuditorNotes === '') ? '-' : $LineitemAuditorNotes; if($itemRate != 0){ $this->purchaseorder_model->updateMaterialRate($MaterialCode, $itemRate); } $SkipInsert = "False"; @@ -2419,6 +2421,8 @@ class Purchaseorder extends BaseController $per = $this->request->getPost('Per' . $i); $LineitemAuditorNotes = $this->request->getPost('LineItemNoteForAuditor' . $i); + $LineitemAuditorNotes = ($LineitemAuditorNotes === null || $LineitemAuditorNotes === '') ? '-' : $LineitemAuditorNotes; + // echo $per; //die(); $LineItemNo = ''; @@ -2845,6 +2849,8 @@ class Purchaseorder extends BaseController $CapitalItemDescription = $this->request->getPost('CapitalItemDescrition' . $i); $Per = $this->request->getPost('per' . $i); $LineitemAuditorNotes = $this->request->getPost('LineItemNoteForAuditor' . $i); + $LineitemAuditorNotes = ($LineitemAuditorNotes === null || $LineitemAuditorNotes === '') ? '-' : $LineitemAuditorNotes; + if($itemRate != 0){ $this->purchaseorder_model->updateMaterialRate($MaterialCode, $itemRate); } $SkipInsert = "False"; @@ -3153,6 +3159,7 @@ class Purchaseorder extends BaseController $Freightrateloc = $this->request->getPost('Fvalue' . $i); $FreightAmountloc = $this->request->getPost('Afvalue' . $i); $LineitemAuditorNotes = $this->request->getPost('LineItemNoteForAuditor' . $i); + $LineitemAuditorNotes = ($LineitemAuditorNotes === null || $LineitemAuditorNotes === '') ? '-' : $LineitemAuditorNotes; // echo $FreightTypeloc; // echo 'n'; // echo $FreightNoofTriploc; diff --git a/app/Controllers/Servicepurchaseorder.php b/app/Controllers/Servicepurchaseorder.php index 9207e172..9b08f986 100755 --- a/app/Controllers/Servicepurchaseorder.php +++ b/app/Controllers/Servicepurchaseorder.php @@ -290,6 +290,7 @@ class Servicepurchaseorder extends BaseController $OtherAmt = $this->request->getPost('OtherAmt' . $i); $TotalOrderValue = $this->request->getPost('TotalOrderValue' . $i); $LineitemAuditorNotes = $this->request->getPost('LineItemNoteForAuditor' . $i); + $LineitemAuditorNotes = ($LineitemAuditorNotes === null || $LineitemAuditorNotes === '') ? '-' : $LineitemAuditorNotes; $SkipInsert = "False"; if (count($comma_separated) > 0) { @@ -316,6 +317,7 @@ class Servicepurchaseorder extends BaseController $POLineItemList = array('PONO' => $PONO, 'ReqNo' => $Reqnumber, 'MaterialCode' => $MaterialCode, 'Quantity' => $Quantity, 'Rate' => $itemRate, 'Status' => $LineItemStatus, 'CreatedBy' => $CreateBy, 'CreatedDate' => $createddt, 'CostCenterCode' => $CostCenter, 'ServiceFrequency' => $ServiceFrequency, 'ServiceMaterialDescription' => $ItemDescription, 'Per' => $Per, 'ItemNo' => $ItemNo,'LineitemAuditorNotes' => $LineitemAuditorNotes); + print_r($POLineItemList); $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList); @@ -341,12 +343,13 @@ class Servicepurchaseorder extends BaseController } } } + die; echo 'Service Purchase Order Created Successfully! PO Number Is: ' . $PONO; } //update service po function UpdateServicePurchaseOrder() { - // print_r($this->request->getPost());die; + // echo "
"; print_r($this->request->getPost()); echo ""; die; $PONO = $this->request->getPost('txtPONO'); $newsup = $this->request->getPost('newsup'); // $newSupId = split("[ - ]+", $newsup); @@ -381,40 +384,34 @@ class Servicepurchaseorder extends BaseController $InsuranceNumber = $this->request->getPost('InsuranceNumber'); $ServiceTypeOptions = $this->request->getPost('PoTypeOptions'); $DescriptionOfPo = $this->request->getPost('editdescofpo'); - - $PaymentTerms = $this->request->getPost('PaymentTerms'); $OtherPayment = $this->request->getPost('Otherpayment'); - $POType = $this->request->getPost('POType'); - $BudgetType = $this->request->getPost('Budget'); - $SpcialInstruction = $this->request->getPost('ScopeofWork'); $TotalOrderValueSummary = $this->request->getPost('txtTotalOrderValueSummary'); $POStatus = $this->request->getPost('txtStatus'); - $updatedBy = $this->session->get('userId'); $RowCount = $this->request->getPost('txtRowCount'); $DeletedRow = $this->request->getPost('txtDeletedRow'); $comma_separated = explode(':', (string)$DeletedRow); - $updateddt = get_current_date_time(); $WorkStatus = $this->request->getPost('workstatus'); - $IsOpenOrder = ($this->request->getPost('IsOpenOrder') !== null && !empty($this->request->getPost('IsOpenOrder')) && $this->request->getPost('IsOpenOrder') === '1') ? $this->request->getPost('IsOpenOrder') : null; // $lastPONO = $this->purchaseorder_model->lastPONO(); // $newPONO = generate_po_number($lastPONO); + // PO Master $POList = array('SupplierID' => $SupplierID, 'TotalOrderValue' => $TotalOrderValueSummary, 'PODate' => $PODate, 'Status' => $POStatus, 'DeliverySchedule' => $DeliverySchedule, 'DeliveryOption' => $DeliveryOption, 'ServiceDescription' => $SpcialInstruction, 'UpdateBY' => $updatedBy, 'DeliveryAddress' => $DeliveryAddr, 'DeliveryDate' => $Deliverydt, 'UpdatedOn' => $updateddt, 'PaymentTerms' => $PaymentTerms, 'ServiceWorkStatus' => $WorkStatus, 'PaymentOtherDescription' => $OtherPayment, 'Supplier_Reference' => $SupplierReference, 'Mode_Of_Shipment' => $ModeOfShipment, 'Supplier_Offer_No' => $SuppliersOfferNo, 'Other_Reference' => $OtherReferences, 'Fincap' => $Fincap, 'Description_Of_Service' => $DescriptionOfPo, 'InsuranceStatus' => $InsuranceOptions, 'InsuranceNumber' => $InsuranceNumber, 'POSubType' => $ServiceTypeOptions, 'BudgetType' => $BudgetType, 'IsOpenOrder' => $IsOpenOrder); + if ($POStatus == 'ST026') { $POList['ApprovedOn'] = get_current_date_time(); $POList['ApprovedBy'] = $this->session->get('userId'); $POList['ReleasedOn'] = get_current_date_time(); $POList['ReleasedBy'] = $this->session->get('userId'); } - + // echo "
"; print_r($POList); echo ""; die; $file = $this->request->getFile('POFile'); if ($file !== null) { @@ -441,15 +438,13 @@ class Servicepurchaseorder extends BaseController $POMaster = $this->purchaseorder_model->updatePOMaster($PONO, $POList); - + // echo "pomaster".$POMaster;die; $LineItemStatus = REQITEM_NEW; if ($PODate != $b4podate) { $logpo = array('PONO' => $PONO, 'LineItemNos' => '-', 'UpdateBy' => $updatedBy, 'UpdatedOn' => $updateddt, 'oldValue' => $b4podate, 'newValue' => $PODate, 'entity' => 'PO DateChanged'); - - $this->purchaseorder_model->insertlogpo($logpo); } @@ -458,12 +453,10 @@ class Servicepurchaseorder extends BaseController //$newsupname = $newSupId[0].'-'.$newSupId[1]; //echo $newsup;die; $logpo = array('PONO' => $PONO, 'LineItemNos' => '-', 'UpdateBy' => $updatedBy, 'UpdatedOn' => $updateddt, 'oldValue' => $b4supplier, 'newValue' => $newsup, 'entity' => 'Supplier Changed'); - - $this->purchaseorder_model->insertlogpo($logpo); } } - + // echo "
"; echo($RowCount); echo ""; die; for ($i = 1; $i <= $RowCount; $i++) { $MaterialCode = $this->request->getPost('materialCode' . $i); $Quantity = $this->request->getPost('quantity' . $i); @@ -487,23 +480,16 @@ class Servicepurchaseorder extends BaseController $OtherAmt = $this->request->getPost('OtherAmt' . $i); $Per = $this->request->getPost('per' . $i); $LineitemAuditorNotes = $this->request->getPost('LineItemNoteForAuditor' . $i); + $LineitemAuditorNotes = ($LineitemAuditorNotes === null || $LineitemAuditorNotes === '') ? '-' : $LineitemAuditorNotes; - - - /*------------------------------*/ + /*------------------------------ Quantity update the req details --*/ //if($MaterialCode!= ''){ $ReqDetails = array('Quantity' => $Quantity, 'UpdatedBy' => $updatedBy, 'UpdatedOn' => $updateddt); - //print_r($ReqDetails); - $this->purchaseorder_model->updateReqDetails($Reqnumber, $MaterialCode, $ReqDetails); // } + /*------------------------------------------------------------------*/ - /*------------------------------*/ - - - - /*---------start---------------------*/ // if(($PODate != $b4podate )||($SupplierID != $b4supplier) || ($itemRate!=$b4rate) || // ($Quantity != $b4qty )) @@ -515,24 +501,24 @@ class Servicepurchaseorder extends BaseController // } + /*--------- Quantity log start ---------------------*/ if ($Quantity != $b4qty) { $logpo = array('PONO' => $PONO, 'LineItemNos' => $POLineItemNo, 'UpdateBy' => $updatedBy, 'UpdatedOn' => $updateddt, 'oldValue' => $b4qty, 'newValue' => $Quantity, 'entity' => 'Quantity Changed'); - - $this->purchaseorder_model->insertlogpo($logpo); } + /*--------- Quantity log ends ---------------------*/ + /*--------- Rate log start ---------------------*/ if ($itemRate != $b4rate) { $logpo = array('PONO' => $PONO, 'LineItemNos' => $POLineItemNo, 'UpdateBy' => $updatedBy, 'UpdatedOn' => $updateddt, 'oldValue' => $b4rate, 'newValue' => $itemRate, 'entity' => 'Rate Changed'); $this->purchaseorder_model->insertlogpo($logpo); } + /*--------- Rate log ends ---------------------*/ - - /*----------end--------------------*/ - + /*--------- Lineitem Section starts ---------------------*/ $POLineItem = array(); $LineItemNo = ''; @@ -552,7 +538,6 @@ class Servicepurchaseorder extends BaseController if ($SkipInsert == "False") { if (strlen((string)$POLineItemNo) == 0) { $this->requistion_model = new requistion_model(); - $RetItemNo = $this->requistion_model->getItemNumber($Reqnumber, $MaterialCode); $ItemNo = ''; @@ -560,8 +545,10 @@ class Servicepurchaseorder extends BaseController $ItemNo = $RetItemNo[0]['ItemNo']; } $POLineItemList = array('PONO' => $PONO, 'ReqNo' => $Reqnumber, 'MaterialCode' => $MaterialCode, 'Quantity' => $Quantity, 'Rate' => $itemRate, 'Status' => $LineItemStatus, 'CreatedBy' => $updatedBy, 'CreatedDate' => $updateddt, 'CostCenterCode' => $CostCenter, 'ServiceFrequency' => $ServiceFrequency, 'ServiceMaterialDescription' => $ItemDescription, 'Per' => $Per, 'ItemNo' => $ItemNo,'LineitemAuditorNotes' => $LineitemAuditorNotes); + // print_r($POLineItemList);die; $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList); + // print_r($POLineItem);die; if (count($POLineItem) > 0) { $LineItemNo = $POLineItem[0]['LineItemNo']; } @@ -619,18 +606,13 @@ class Servicepurchaseorder extends BaseController } } } + /*--------- Lineitem Section starts ---------------------*/ } echo 'Purchase Order Updated Successfully! PO Number Is: ' . $PONO; } - - - - - - /*-----------------------------------*/ function uploadfile() { diff --git a/app/Controllers/User.php b/app/Controllers/User.php index 59ab3187..170fa718 100755 --- a/app/Controllers/User.php +++ b/app/Controllers/User.php @@ -15,6 +15,7 @@ use App\Models\Ipinvoice_model; use App\Models\Ipattachment_model; use App\Models\Zohobooks_api_model; use App\Models\CreditNoteModel; +use App\Models\IpCreditNotesItemsModel; require_once 'vendor/autoload.php'; @@ -36,6 +37,7 @@ class User extends BaseController protected $ipinvoice_model; protected $ipattachment_model; protected $CreditNoteModel; + protected $CreditNotesItemsModel; protected $session; /** @@ -53,6 +55,7 @@ class User extends BaseController $this->ipinvoice_model = new Ipinvoice_model(); $this->ipattachment_model = new Ipattachment_model(); $this->CreditNoteModel = new CreditNoteModel(); + $this->CreditNotesItemsModel = new IpCreditNotesItemsModel(); $this->session = session(); helper('form'); //$this->load->library('form_validation'); $this->isLoggedIn(); @@ -1382,13 +1385,14 @@ class User extends BaseController $tokenWithCreditNoteScope = generateNewTokenForCreditNoteScope(); $cteditNotesRes = getAllCreditNotes($date_today, $date_yesterday, $tokenWithCreditNoteScope); - $cteditNotesData = json_decode($cteditNotesRes['data'],true); + $cteditNotesData = json_decode($cteditNotesRes['data'],true); + if(count($cteditNotesData['creditnotes'])) { - $this->saveOrUpdateCreditNote($cteditNotesData['creditnotes']); + $this->saveOrUpdateCreditNote($cteditNotesData['creditnotes'] , $tokenWithCreditNoteScope); } - + // dd($cteditNotesData); foreach ($inv_array as $inv) { @@ -1714,7 +1718,7 @@ class User extends BaseController } // END zoho API - public function saveOrUpdateCreditNote($data) + public function saveOrUpdateCreditNote($data , $tokenWithCreditNoteScope ) { foreach ($data as $key => $value) { @@ -1730,6 +1734,36 @@ class User extends BaseController $this->CreditNoteModel->insert($value); } + + //credit note line item api call + $cteditNotesLineItemsRes = getCreditNotesItemDetails($value['creditnote_id'], $tokenWithCreditNoteScope); + + $lineItemData = json_decode($cteditNotesLineItemsRes['data'],true); + + if(count($lineItemData['creditnote']['line_items'])) + { + foreach ($lineItemData['creditnote']['line_items'] as $itemkey => $itemvalue) + { + $itemvalue['creditnote_id'] = $value['creditnote_id']; + + + + $existingCreditNoteItems = $this->CreditNotesItemsModel->where('line_item_id', $itemvalue['line_item_id'])->first(); + + if ($existingCreditNoteItems) { + // Update existing record + $this->CreditNotesItemsModel->update($itemvalue['line_item_id'], $itemvalue); + + } else { + // Insert new record + $this->CreditNotesItemsModel->insert($itemvalue); + + } + + + } + + } } } diff --git a/app/Helpers/zohobook_helper.php b/app/Helpers/zohobook_helper.php index c92a8c99..8d8be658 100755 --- a/app/Helpers/zohobook_helper.php +++ b/app/Helpers/zohobook_helper.php @@ -185,6 +185,58 @@ if (! function_exists('getAllCreditNotes')) { 'headers_new' => $headers, 'data' => $result ]; + + + + + } + +} + + + +if (! function_exists('getCreditNotesItemDetails')) { + function getCreditNotesItemDetails($creditNoteId, $accesstoken) + { + // Initialize cURL + $ch = curl_init(); + + // Zoho API credentials + $organization_id = '776847408'; + $url_org = "https://www.zohoapis.com/books/v3/creditnotes/".$creditNoteId."?organization_id=$organization_id"; + + + // Set headers + $headers = array( + 'Authorization: Zoho-oauthtoken ' . $accesstoken, + // 'Content-Type: application/json' + ); + + // Set cURL options + curl_setopt($ch, CURLOPT_URL, $url_org ); + curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET"); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + + // Execute cURL request + $result = curl_exec($ch); + + // Check for errors + if ($result === false) { + return ['error' => curl_error($ch)]; + } + + // Close cURL session + curl_close($ch); + + return [ + 'headers_new' => $headers, + 'data' => $result + ]; + + + + } } diff --git a/app/Models/CreditNoteModel.php b/app/Models/CreditNoteModel.php index 5bcd0406..a202f7a3 100644 --- a/app/Models/CreditNoteModel.php +++ b/app/Models/CreditNoteModel.php @@ -47,14 +47,25 @@ class CreditNoteModel extends Model /** * Fetch all credit notes */ - public function getAllCreditNotes($fromDate,$toDate) + // public function getAllCreditNotes($fromDate,$toDate) + // { + // return $this->where('date >=', $fromDate ) + // ->where('date <=', $toDate ) + // ->orderBy('date', 'DESC') + // ->findAll(); + // } + + public function getAllCreditNotes($fromDate, $toDate) { - return $this->where('date >=', $fromDate ) - ->where('date <=', $toDate ) - ->orderBy('date', 'DESC') + return $this->select('ip_credit_notes.*, ip_credit_notes_items.name as item_name') + ->join('ip_credit_notes_items', 'ip_credit_notes.creditnote_id = ip_credit_notes_items.creditnote_id', 'left') + ->where('ip_credit_notes.date >=', $fromDate) + ->where('ip_credit_notes.date <=', $toDate) + ->orderBy('ip_credit_notes.date', 'DESC') ->findAll(); } + /** * Fetch a single credit note by ID */ diff --git a/app/Models/Inwardgateregister_model.php b/app/Models/Inwardgateregister_model.php index ee8cc2cc..74ab8b73 100755 --- a/app/Models/Inwardgateregister_model.php +++ b/app/Models/Inwardgateregister_model.php @@ -408,7 +408,7 @@ class Inwardgateregister_model extends Model FROM t_igr_details IGRD LEFT JOIN t_purchaseorder_lineitem POL ON PONO = POL.PONO AND IGRD.MaterialCode = POL.MaterialCode LEFT JOIN t_revenue_tax tax ON tax.LineItemNo = POL.LineItemNo - WHERE IGRD.IGRNO = igr.IGRNO AND IGRD.QuantityAsPerInvoice != 0 + WHERE IGRD.IGRNO = igr.IGRNO AND IGRD.QuantityAsPerInvoice != 0 and igr.PONO = POL.PONO GROUP BY POL.PONO LIMIT 1 ) @@ -420,7 +420,7 @@ class Inwardgateregister_model extends Model FROM t_igr_details IGRD LEFT JOIN t_purchaseorder_lineitem POL ON PONO = POL.PONO AND IGRD.MaterialCode = POL.MaterialCode LEFT JOIN t_service_tax tax ON tax.LineItemNo = POL.LineItemNo - WHERE IGRD.IGRNO = igr.IGRNO AND IGRD.QuantityAsPerInvoice != 0 + WHERE IGRD.IGRNO = igr.IGRNO AND IGRD.QuantityAsPerInvoice != 0 and igr.PONO = POL.PONO GROUP BY POL.PONO LIMIT 1 ) diff --git a/app/Models/IpCreditNotesItemsModel.php b/app/Models/IpCreditNotesItemsModel.php new file mode 100644 index 00000000..09a61944 --- /dev/null +++ b/app/Models/IpCreditNotesItemsModel.php @@ -0,0 +1,71 @@ +where('creditnote_id', $creditnoteId)->findAll(); + } +} diff --git a/app/Models/Purchaseorder_model.php b/app/Models/Purchaseorder_model.php index 049f8966..8ce9adcd 100755 --- a/app/Models/Purchaseorder_model.php +++ b/app/Models/Purchaseorder_model.php @@ -464,7 +464,7 @@ mstr.CourierNo,pom.Status,pom.POType') //,bill.BillNo,bill.FilePath, if ($forwhat == 'amendment') { $builder->where('POMast.Status', PO_RELEASED); } else { - $builder->where('POMast.Status !=', PO_AMENDED); + // $builder->where('POMast.Status !=', PO_AMENDED); // $builder->orderBy('POMast.Status !=',PO_AMENDED); } diff --git a/app/Views/EditservicePurchaseorder.php b/app/Views/EditservicePurchaseorder.php index ae89c7d9..a7071e59 100755 --- a/app/Views/EditservicePurchaseorder.php +++ b/app/Views/EditservicePurchaseorder.php @@ -346,16 +346,13 @@ if (!empty($getlogpodtl)) { /*****************************/ - var update = ''; - - - if (update != 'null') - - { - $('#editpodiv').show(); - } else { - $('#editpodiv').hide(); - } + // var update = ''; + // if (update != 'null') + // { + // $('#editpodiv').show(); + // } else { + // $('#editpodiv').hide(); + // } /*****************************/ @@ -907,11 +904,14 @@ if (!empty($getlogpodtl)) {
Cost Of The Product Per UOM
+| SNo | Requisition No | Item Description | @@ -1215,7 +1206,7 @@ if (!empty($RequistionDetails)) {Rate | Basic Amount | +Total Order Amount | -->Action | Rate ?> | BasicValue ?> | +TotalOrderValue ?> | --> + diff --git a/app/Views/editRevenueAmendPO.php b/app/Views/editRevenueAmendPO.php index be615a82..0e3cf0f9 100755 --- a/app/Views/editRevenueAmendPO.php +++ b/app/Views/editRevenueAmendPO.php @@ -64,7 +64,7 @@ $insurenceno = ''; $BudgetType = ''; if (!empty($POMaster)) { - // print_r($POMaster); + // dd($POMaster); // print_r($Payment); // echo "****"; @@ -1219,9 +1219,8 @@ if (!empty($INRSYMBOL)) {
|---|
| SNo | Requisition No | diff --git a/app/Views/editRevenuepurchaseorder.php b/app/Views/editRevenuepurchaseorder.php index c68ab4c3..9ff9c976 100755 --- a/app/Views/editRevenuepurchaseorder.php +++ b/app/Views/editRevenuepurchaseorder.php @@ -368,12 +368,12 @@ if (!empty($getlogpodtl)) { $('#splpodiv').hide(); } /*****************************/ - var update = ''; - if (update != 'null') { - $('#editpodiv').show(); - } else { - $('#editpodiv').hide(); - } + // var update = ''; + // if (update != 'null') { + // $('#editpodiv').show(); + // } else { + // $('#editpodiv').hide(); + // } /*****************************/ $('#PoTypeOptions').attr("style", "pointer-events: none;"); if (DelOpt == "0") { @@ -2036,11 +2036,14 @@ if (!empty($getlogpodtl)) {Invoice Qty | Net weight | - +Total Amt | Vechicle No | Driver | Transporter | @@ -281,9 +281,9 @@ReceivedQuantity ?> | NetWeight ?> | - +taxable_value + (int)$record->gst_amount) ?> | VehicleNo ?> | DriverName ?> | diff --git a/public/assets/js/CreatePOValidation.js b/public/assets/js/CreatePOValidation.js index aba375d6..7591250e 100755 --- a/public/assets/js/CreatePOValidation.js +++ b/public/assets/js/CreatePOValidation.js @@ -43,7 +43,7 @@ function enableButtons() { function revenueValidate(){ var radioValue = parseInt($("input[name='DateRange']:checked").val()); - + var scheduleBy = $('#Scheduleby').val(); // Get the value if ($('#drpSupplier').val() == "0") { alert('Please Select the Supplier details'); $('#drpSupplier').focus(); @@ -60,13 +60,10 @@ function revenueValidate(){ alert('Please Select the Delivery Date'); $('#Deliverydt').focus(); return false; - }else if (radioValue == 1) { - var scheduleBy = $('#Scheduleby').val(); // Get the value - if (!scheduleBy || scheduleBy.trim() == '') { // Check if it's empty or undefined + }else if (radioValue == 1 && (!scheduleBy || scheduleBy.trim() == '')) { alert('Please Enter the Schedule By'); $('#Scheduleby').focus(); return false; - } }else if($('#PODate').val() == ''){ alert('Please Enter the Purchase Order date'); $('#PODate').focus(); @@ -97,54 +94,68 @@ function revenueValidate(){ function serviceValidate(){ var radioValue = parseInt($("input[name='DateRange']:checked").val()); + var scheduleBy = $('#Scheduleby').val(); // Get the value if ($('#drpSupplier').val() == "0") { + console.log('Please Select the Supplier details'); alert('Please Select the Supplier details'); $('#drpSupplier').focus(); return false; }else if ($('#workstatus').val() == "0") { + console.log('Please Select the Work Status'); alert('Please Select the Work Status'); $('#workstatus').focus(); return false; }else if ($('#PODate').val().trim() == '') { + console.log('Please Enter the Purchase Order date'); alert('Please Enter the Purchase Order date'); $('#PODate').focus(); return false; }else if ($('#DeliveryAddr').val().trim() == '') { + console.log('Please Enter the Delivery Address'); alert('Please Enter the Delivery Address'); $('#DeliveryAddr').focus(); return false; }else if (radioValue === 0 && $('#Deliverydt').val() == '') { + console.log('Please Select the Delivery Date'); alert('Please Select the Delivery Date'); $('#Deliverydt').focus(); return false; - }else if (radioValue == 1) { - var scheduleBy = $('#Scheduleby').val(); // Get the value - if (!scheduleBy || scheduleBy.trim() == '') { // Check if it's empty or undefined + }else if (radioValue == 1 && (!scheduleBy || scheduleBy.trim() == '')) { + console.log('Please Enter the Schedule By'); alert('Please Enter the Schedule By'); $('#Scheduleby').focus(); return false; - } + }else if($('#PODate').val() == ''){ + console.log('Please Enter the Purchase Order date'); alert('Please Enter the Purchase Order date'); $('#PODate').focus(); return false; }else if ($('#PoTypeOptions').val() == "0") { + console.log('Please Select Service Type'); alert('Please Select Service Type'); $('#PoTypeOptions').focus(); return false; }else if ($('#Otherpayment').val() == '' && $('#PaymentTerms').val() == 'PT08') { + console.log('Please Enter Payable Terms Description'); alert('Please Enter Payable Terms Description'); $('#Otherpayment').focus(); return false; }else if($('#insuranceStatus').val() == "1" && $('#InsuranceNumber').val().trim() == ''){ + console.log('Please Enter the Insurance No / Insurance Details'); alert('Please Enter the Insurance No / Insurance Details'); $('#InsuranceNumber').focus(); return false; }else if ($('#BudgetType').val() == "0") { + console.log('Please Select Budget Type'); alert('Please Select Budget Type'); $('#BudgetType').focus(); return false; + } + else { + console.log("JS else part"); + return true; } // else if ($('#ServiceTable tbody tr').length < 1) { // alert('Atleast One Line needed'); @@ -154,9 +165,7 @@ function serviceValidate(){ // $('#descofpo').focus(); // return false; // } - else { - return true; - } + } function capitalValidate(){ @@ -189,13 +198,13 @@ function capitalValidate(){ alert('Please Enter the Dispatch Instruction'); $('#Deliverydate').focus(); return false; - } else if ($('#ExchangeRate').val() == '') { + } else if ($('#ExchangeRt').val() == '') { alert('Please Enter the Exchange Rate'); - $('#ExchangeRate').focus(); + $('#ExchangeRt').focus(); return false; - } else if ($('#ExchangeRate').val() == 0) { + } else if ($('#ExchangeRt').val() == 0) { alert('Please Enter the Exchange Rate'); - $('#ExchangeRate').focus(); + $('#ExchangeRt').focus(); return false; } else if ($('#PlaceOforigin').val() == '') { alert('Please Enter Place Of Origin'); @@ -332,21 +341,21 @@ function importValidate(){ function validate() { var radioValue = $("input[name='DateRange']:checked").val(); - - var PoType = $('#POType').val(); - var currencyType = $('#currencytype').val(); - if($('#PODate').val() == '') + var PoType = $('#POType').val(); + var currencyType = $('#currencytype').val(); + + if($('#drpSupplier').val() == "0") + { + alert('Please Select the Supplier details'); + $('#drpSupplier').focus(); + return false; + } + else if($('#PODate').val() == '') { alert('Please Enter the Purchase Order date'); $('#PODate').focus(); return false; } - else if($('#drpSupplier').val() == "0") - { - alert('Please Select the Supplier details'); - $('#drpSupplier').focus(); - return false; - } else if(radioValue==0 && $('#Deliverydate').val()==''){ alert('Please Select the Delivery Date'); $('#Deliverydate').focus();
|---|