CHANGE_PURCHASE_ORDER_ISSUE_SERVICE

This commit is contained in:
aadhavan valli 2024-09-20 16:27:06 +05:30
parent 825d56b4df
commit 5ca7372af5
7 changed files with 131 additions and 104 deletions

View File

@ -230,6 +230,7 @@ $routes->post('emergencypurchaseorder/addNewRevenuePurchaseOrder','Emergencypurc
$routes->post('purchaseorder/addNewPurchaseOrder', 'Purchaseorder::addNewPurchaseOrder'); $routes->post('purchaseorder/addNewPurchaseOrder', 'Purchaseorder::addNewPurchaseOrder');
$routes->post('purchaseorder/DeletePODetails', 'Purchaseorder::DeletePODetails');
$routes->post('purchaseorder/addNewCapitalPurchaseOrder', 'Purchaseorder::addNewCapitalPurchaseOrder'); $routes->post('purchaseorder/addNewCapitalPurchaseOrder', 'Purchaseorder::addNewCapitalPurchaseOrder');
$routes->post('purchaseorder/addNewImportPurchaseOrder', 'Purchaseorder::addNewImportPurchaseOrder'); $routes->post('purchaseorder/addNewImportPurchaseOrder', 'Purchaseorder::addNewImportPurchaseOrder');
$routes->post('servicepurchaseorder/addNewServicePurchaseOrder', 'Servicepurchaseorder::addNewServicePurchaseOrder'); $routes->post('servicepurchaseorder/addNewServicePurchaseOrder', 'Servicepurchaseorder::addNewServicePurchaseOrder');

View File

@ -1446,6 +1446,7 @@ class Purchaseorder extends BaseController
if ($SkipInsert == "False") { if ($SkipInsert == "False") {
if (strlen((string)$POLineItemNo) == 0) { if (strlen((string)$POLineItemNo) == 0) {
} else { } else {
$LineItemNo = $POLineItemNo; $LineItemNo = $POLineItemNo;
@ -1455,9 +1456,10 @@ class Purchaseorder extends BaseController
$POLineItem = $this->purchaseorder_model->updatePOLineItem($PONO, $POLineItemNo, $POLineItemList); $POLineItem = $this->purchaseorder_model->updatePOLineItem($PONO, $POLineItemNo, $POLineItemList);
} }
$isExists = $this->purchaseorder_model->LineItemExistsinRevenueTax($LineItemNo); $isExists = $this->purchaseorder_model->LineItemExistsinRevenueTax($LineItemNo);
if (count($isExists) == 0) {
} else {
if (count($isExists) == 0) {
} else {
$RevenueTaxList = array('DiscountType' => $DiscountType, 'DiscountValue' => $DiscountValue, 'AfterDiscount' => $AfterDiscount, 'PackagingType' => $PackagingType, 'PackagingValue' => $PackagingValue, 'PackagingCalulatedOn' => $PackagingOption, 'AfterPackagingValue' => $AfterPackagingValue, 'FreightType' => $FreightType, 'FreightValue' => $FreightValue, 'AfterFreightValue' => $AfterFreightValue, 'Insurance' => $InsuranceValue, 'TotalValue' => $TotalOrderValue, 'UpdateBY' => $updatedBy, 'UpdatedOn' => $updateddt, 'CGST' => $Cgst, 'AfterCGST' => $AfterCgst, 'SGST' => $Sgst, 'AfterSGST' => $AfterSgst, 'IGST' => $Igst, 'AfterIGST' => $AfterIgst, 'CreatedBy' => $updatedBy, 'NoOfTrip' => $NOOfTrip); $RevenueTaxList = array('DiscountType' => $DiscountType, 'DiscountValue' => $DiscountValue, 'AfterDiscount' => $AfterDiscount, 'PackagingType' => $PackagingType, 'PackagingValue' => $PackagingValue, 'PackagingCalulatedOn' => $PackagingOption, 'AfterPackagingValue' => $AfterPackagingValue, 'FreightType' => $FreightType, 'FreightValue' => $FreightValue, 'AfterFreightValue' => $AfterFreightValue, 'Insurance' => $InsuranceValue, 'TotalValue' => $TotalOrderValue, 'UpdateBY' => $updatedBy, 'UpdatedOn' => $updateddt, 'CGST' => $Cgst, 'AfterCGST' => $AfterCgst, 'SGST' => $Sgst, 'AfterSGST' => $AfterSgst, 'IGST' => $Igst, 'AfterIGST' => $AfterIgst, 'CreatedBy' => $updatedBy, 'NoOfTrip' => $NOOfTrip);
$this->purchaseorder_model->updateRevenueTax($LineItemNo, $RevenueTaxList); $this->purchaseorder_model->updateRevenueTax($LineItemNo, $RevenueTaxList);
} }

View File

@ -241,18 +241,18 @@ class Servicepurchaseorder extends BaseController
if ($file->isValid() && !$file->hasMoved()) { if ($file->isValid() && !$file->hasMoved()) {
$path = ROOTPATH . 'public/uploads/POfiles/'; $path = ROOTPATH . 'public/uploads/POfiles/';
if(!is_dir($path)) { mkdir($path, 0777, true); } if (!is_dir($path)) {
mkdir($path, 0777, true);
}
if (!empty($this->purchaseorder_model->isFileExists($requestfilename))) { if (!empty($this->purchaseorder_model->isFileExists($requestfilename))) {
log_message('error', 'File already exists in the database' . $requestfilename); log_message('error', 'File already exists in the database' . $requestfilename);
$requestfilename = ""; $requestfilename = "";
} } else {
else{
$file->move($path, $requestfilename); $file->move($path, $requestfilename);
} }
} else { } else {
$requestfilename = ""; $requestfilename = "";
} }
} }
// PO Master // PO Master
@ -391,7 +391,6 @@ class Servicepurchaseorder extends BaseController
$updatedBy = $this->session->get('userId'); $updatedBy = $this->session->get('userId');
$RowCount = $this->request->getPost('txtRowCount'); $RowCount = $this->request->getPost('txtRowCount');
$DeletedRow = $this->request->getPost('txtDeletedRow'); $DeletedRow = $this->request->getPost('txtDeletedRow');
$comma_separated = explode(':', (string)$DeletedRow); $comma_separated = explode(':', (string)$DeletedRow);
$updateddt = get_current_date_time(); $updateddt = get_current_date_time();
@ -414,11 +413,12 @@ class Servicepurchaseorder extends BaseController
if (!empty($requestfilename)) { if (!empty($requestfilename)) {
if ($file && $file->isValid() && !$file->hasMoved()) { if ($file && $file->isValid() && !$file->hasMoved()) {
$path = ROOTPATH . 'public/uploads/POfiles/'; $path = ROOTPATH . 'public/uploads/POfiles/';
if(!is_dir($path)) { mkdir($path, 0777, true); } if (!is_dir($path)) {
mkdir($path, 0777, true);
}
if (!empty($this->purchaseorder_model->isFileExists($requestfilename))) { if (!empty($this->purchaseorder_model->isFileExists($requestfilename))) {
log_message('error', 'File already exists in the database' . $requestfilename); log_message('error', 'File already exists in the database' . $requestfilename);
} } else {
else{
$file->move($path, $requestfilename); $file->move($path, $requestfilename);
$POList['POFile'] = $requestfilename; $POList['POFile'] = $requestfilename;
} }
@ -559,13 +559,45 @@ class Servicepurchaseorder extends BaseController
if (trim((string)$POType) == SERVICE) { if (trim((string)$POType) == SERVICE) {
// Check if LineItemExists() returns a valid array
$isExists = $this->purchaseorder_model->LineItemExists($LineItemNo); $isExists = $this->purchaseorder_model->LineItemExists($LineItemNo);
if (is_array($isExists) && count($isExists) == 0) {
$ServiceTaxList = array('LineItemNo' => $LineItemNo, 'CGST' => $Cgst, 'After_CGST' => $AfterCgst, 'SGST' => $Sgst, 'After_SGST' => $AfterSgst, 'IGST' => $Igst, 'After_IGST' => $AfterIgst, 'TotalValue' => $TotalOrderValue, 'CreatedBy' => $updatedBy, 'CreatedDate' => $updateddt, 'otherallowance' => $OtherAmt); // Ensure $isExists is an array, or initialize it as an empty array
if (!is_array($isExists)) {
$isExists = [];
}
if (count($isExists) == 0) {
// Insert new service tax record
$ServiceTaxList = array(
'LineItemNo' => $LineItemNo,
'CGST' => $Cgst,
'After_CGST' => $AfterCgst,
'SGST' => $Sgst,
'After_SGST' => $AfterSgst,
'IGST' => $Igst,
'After_IGST' => $AfterIgst,
'TotalValue' => $TotalOrderValue,
'CreatedBy' => $updatedBy,
'CreatedDate' => $updateddt,
'otherallowance' => $OtherAmt
);
$this->purchaseorder_model->addServiceTax($ServiceTaxList); $this->purchaseorder_model->addServiceTax($ServiceTaxList);
} else { } else {
$ServiceTaxList1 = array('CGST' => $Cgst, 'After_CGST' => $AfterCgst, 'SGST' => $Sgst, 'After_SGST' => $AfterSgst, 'IGST' => $Igst, 'After_IGST' => $AfterIgst, 'TotalValue' => $TotalOrderValue, 'UpdateBY' => $updatedBy, 'UpdatedOn' => $updateddt, 'otherallowance' => $OtherAmt); // Update existing service tax record
$ServiceTaxList1 = array(
'CGST' => $Cgst,
'After_CGST' => $AfterCgst,
'SGST' => $Sgst,
'After_SGST' => $AfterSgst,
'IGST' => $Igst,
'After_IGST' => $AfterIgst,
'TotalValue' => $TotalOrderValue,
'UpdateBY' => $updatedBy,
'UpdatedOn' => $updateddt,
'otherallowance' => $OtherAmt
);
$this->purchaseorder_model->updateServiceTax($LineItemNo, $ServiceTaxList1); $this->purchaseorder_model->updateServiceTax($LineItemNo, $ServiceTaxList1);
} }

View File

@ -1012,12 +1012,12 @@ mstr.CourierNo,pom.Status,pom.POType') //,bill.BillNo,bill.FilePath,
$subQuery = 'SELECT distinct LineItem.LineItemNo,LineItem.ReqNo,LineItem.Per,Mat.MaterialCode,Mat.MaterialName,Mat.UOM,LineItem.Quantity,ReceivedQuantity,Rate,LineItem.Status,(LineItem.Quantity *Rate) as BasicValue ,(After_CGST + After_SGST + After_IGST) as Taxamount,Dept.DepartmentName $subQuery = 'SELECT distinct LineItem.LineItemNo,LineItem.ReqNo,LineItem.Per,Mat.MaterialCode,Mat.MaterialName,Mat.UOM,LineItem.Quantity,ReceivedQuantity,Rate,LineItem.Status,(LineItem.Quantity *Rate) as BasicValue ,(After_CGST + After_SGST + After_IGST) as Taxamount,Dept.DepartmentName
,TotalValue,CGST,After_CGST,SGST,After_SGST,IGST,After_IGST,otherallowance,LineItem.CostCenterCode,LineItem.ServiceFrequency,LineItem.ServiceMaterialDescription,Req.Schedule_Type,Req.NumberOfService,Req.Service_Period,ReqDet.MaterialDescription ,TotalValue,CGST,After_CGST,SGST,After_SGST,IGST,After_IGST,otherallowance,LineItem.CostCenterCode,LineItem.ServiceFrequency,LineItem.ServiceMaterialDescription,Req.Schedule_Type,Req.NumberOfService,Req.Service_Period,ReqDet.MaterialDescription
FROM t_purchaseorder_lineitem LineItem FROM t_purchaseorder_lineitem LineItem
join t_materialmaster Mat on Mat.MaterialCode = LineItem.MaterialCode left join t_materialmaster Mat on Mat.MaterialCode = LineItem.MaterialCode
join t_service_tax Tax on Tax.LineItemNo = LineItem.LineItemNo left join t_service_tax Tax on Tax.LineItemNo = LineItem.LineItemNo
join t_requestion_master Req on Req.ReqNo = LineItem.ReqNo left join t_requestion_master Req on Req.ReqNo = LineItem.ReqNo
join t_requestion_details ReqDet on ReqDet.ReqNo = LineItem.ReqNo and LineItem.MaterialCode = ReqDet.MaterialCode left join t_requestion_details ReqDet on ReqDet.ReqNo = LineItem.ReqNo and LineItem.MaterialCode = ReqDet.MaterialCode
left join t_employee_details emp on Req.Requestedby = emp.EmpID left join t_employee_details emp on Req.Requestedby = emp.EmpID
join t_departmentdetails Dept on Req.RequestedDept = Dept.DEPCode left join t_departmentdetails Dept on Req.RequestedDept = Dept.DEPCode
where LineItem.PONO =?'; where LineItem.PONO =?';
$query = $this->db->query($subQuery, array($PONO)); $query = $this->db->query($subQuery, array($PONO));

View File

@ -3019,21 +3019,21 @@ if (!empty($getlogpodtl)) {
processData: false, processData: false,
contentType: false, contentType: false,
success: function(data) { success: function(data) {
console.log(data); // console.log(data);
// if (data) { if (data) {
// // $('#content').loader('hide'); // $('#content').loader('hide');
// alert(data); alert(data);
// $('#txtRowCount').val(''); $('#txtRowCount').val('');
// $('#txtDeletedRow').val(''); $('#txtDeletedRow').val('');
// $('#txtStatus').val(''); $('#txtStatus').val('');
// $('#SpcialInstruction').val(''); $('#SpcialInstruction').val('');
// $('#txtDeliveryAddress').val('') $('#txtDeliveryAddress').val('')
// window.location = "purchaseorderListing"; window.location = "purchaseorderListing";
// } else { } else {
// // $('#content').loader('hide'); // $('#content').loader('hide');
// alert("Error"); alert("Error");
// } }
} }

View File

@ -4003,15 +4003,9 @@ if (!empty($getlogpodtl)) {
<td align="right">${quantity}</td> <td align="right">${quantity}</td>
<td align="left">${uom}</td> <td align="left">${uom}</td>
<td align="right">${itemRate}</td> <td align="right">${itemRate}</td>
<td align="right">${PER}</td>
<td align="right">${service_description}</td>
<td align="right">${basicval}</td> <td align="right">${basicval}</td>
<td align="right">${TotalTaxValue}</td> <td align="right">${TotalTaxValue}</td>
<td align="right">${TotalOrderValue}</td> <td align="right">${TotalOrderValue}</td>
<td align="right">${quantity}</td>
<td align="right">0</td>
<td align="right">${quantity}</td>
<td> <td>
<a data-target='#EDITREVENUE' data-id="${temp}" data-userid="${temp}" data-toggle="modal" href="#EDITREVENUE"> <a data-target='#EDITREVENUE' data-id="${temp}" data-userid="${temp}" data-toggle="modal" href="#EDITREVENUE">
<i class="ri-pencil-fill"></i> <i class="ri-pencil-fill"></i>
@ -4891,15 +4885,15 @@ if (!empty($getlogpodtl)) {
processData: false, processData: false,
contentType: false, contentType: false,
success: function(data) { success: function(data) {
// console.log(data); console.log(data);
if (data) { if (data) {
alert(data); // alert(data);
$('#txtRowCount').val(''); // $('#txtRowCount').val('');
$('#txtDeletedRow').val(''); // $('#txtDeletedRow').val('');
$('#txtStatus').val(''); // $('#txtStatus').val('');
$('#SpcialInstruction').val(''); // $('#SpcialInstruction').val('');
$('#txtDeliveryAddress').val('') // $('#txtDeliveryAddress').val('')
window.location = "purchaseorderListing"; // window.location = "purchaseorderListing";
} else { } else {
alert("Error"); alert("Error");

View File

@ -1166,13 +1166,13 @@ if (!empty($getlogpodtl)) {
<div class="form-group col-md-12"> <div class="form-group col-md-12">
<div align="right"><br> <div align="right">
<div> <div class="form-group col-md-3">
<input type="file" class="form-control" name="POFile" id="POFile"> <input type="file" class="form-control" name="POFile" id="POFile">
<?php if ($PrePOFile) { ?> <?php if ($PrePOFile) { ?>
<label><a title="previously uploaded PO File" href="<?php echo base_url() . 'public/uploads/POfiles/' . $PrePOFile ?>"><span>previously uploaded - </span><small><?= $PrePOFile; ?></small></a></label> <label><a title="previously uploaded PO File" href="<?php echo base_url() . 'public/uploads/POfiles/' . $PrePOFile ?>"><span>previously uploaded - </span><small><?= $PrePOFile; ?></small></a></label>
<?php } ?> <?php } ?>
<input type="hidden" id="PrePOFile" name="PrePOFile" value="<?php echo $PrePOFile; ?>" /><br><br> <input type="hidden" id="PrePOFile" name="PrePOFile" value="<?php echo $PrePOFile; ?>" />
</div> </div>
<input type="hidden" name="txtPoRange" id="txtPoRange" /> <input type="hidden" name="txtPoRange" id="txtPoRange" />
<input type="hidden" name="isEdit" id="isEdit" value="0" /> <input type="hidden" name="isEdit" id="isEdit" value="0" />
@ -1211,10 +1211,8 @@ if (!empty($getlogpodtl)) {
</div> </div>
<div class="form-row p-3" align="left" style="padding-right:10px"> <div class="form-group col-md-12" align="left" style="padding-right:10px">
<div class="col-md-5 col-md-offset-7" align="left"><br />
<div class="col-md-5 col-md-offset-7" align="right"><br />
<br><br>
<label>Request On :</label><?php echo $Reqon; ?><br /> <label>Request On :</label><?php echo $Reqon; ?><br />
<label>Request By :</label><?php echo $RequesterName; ?><br /> <label>Request By :</label><?php echo $RequesterName; ?><br />
<label>Status : </label><?php <label>Status : </label><?php