siddharth_application/application/views/editRevenuepurchaseorder.php
venbatechnologies 1912eddc75 logdetails
2018-05-17 16:09:32 +05:30

5779 lines
218 KiB
PHP
Executable File

<?php $ReqType ='';
$CompanyAddress = '';
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
$CurrentDate = $dt->format('d-m-Y');
$MaxPoDate = '';
$AvlAmount = 0;
$DeliverSchedule='';
$DeliverOption='';
$StatusName='';
$modeofshipment='';
$supplierref='';
$suppofferno='';
$otherref='';
$fincap='';
$revenuesubtype='';
$insurencestatus='';
$insurenceno='';
if(!empty($MaxPODate))
{
foreach ($MaxPODate as $date)
{
$MaxPoDate = $date->PODate;
}
}
if(!empty($CompanyDetails))
{
foreach ($CompanyDetails as $Req)
{
$CompanyAddress = $Req->Address;
}
}
if(!empty($AvlBudAmt))
{
$AvlAmount = number_format($AvlBudAmt, 2, '.', '');
}
if(!empty($INRSYMBOL))
{
foreach($INRSYMBOL as $INRS)
{
$INRSYM=$INRS->FontCode2000;
}
}
foreach ($PaymentTerms as $TER)
{
$Terms=$TER->PaymentTerms;
}
$SupId = '';
$SupName = '';
$Address = '';
$PODate = '';
$Deliverydt ='';
$DeliveryAddress ='';
$PONOStatus = '';
$PONO = '';
$totBasicAmt = 0;
$totDiscountAmt = 0.0;
$totPackagingAmt = 0.0;
$totCgst = 0.0;
$totSgst = 0.0;
$totIgst = 0.0;
$totFreightAmt = 0.0;
$totInsuranceAmt = 0.0;
$totOrderSummaryAmt = 0.0;
$ServiceDescription = '';
$CapitalRange = '';
$otherPayment='';
$BudgetType = '';
if(!empty($POMaster))
{
//print_r($POMaster);
//print_r($POItem);
foreach ($POMaster as $Req)
{
$SupId = $Req->SupplierID;
$SupName = $Req->SupplierName;
$Address = $Req->Address;
$Pdt = new DateTime($Req->PODate);
$PODate = $Pdt->format('d-m-Y');
$DeliverOption = $Req->DeliveryOption;
$DeliverSchedule = $Req->DeliverySchedule;
$Ddt = new DateTime($Req->DeliveryDate);
$Deliverydt = $Ddt->format('d-m-Y');
$DeliveryAddress =$Req->DeliveryAddress;
$PONOStatus = $Req->StatusCode;
$PONO = $Req->PONO;
$ServiceDescription = $Req->ServiceDescription;
$CapitalRange = $Req->CapitalRange;
$StatusName=$Req->StatusName;
$otherPayment = $Req->PaymentOtherDescription;
$modeofshipment = $Req->Mode_Of_Shipment;
$supplierref = $Req->Supplier_Reference;
$suppofferno = $Req->Supplier_Offer_No;
$otherref = $Req->Other_Reference;
$fincap = $Req->Fincap;
$revenuesubtype = $Req->POSubType;
$insurencestatus = $Req->InsuranceStatus;
$insurenceno = $Req->InsuranceNumber;
$BudgetType = $Req->BudgetType;
// echo $insurenceno;
// echo $otherPayment;
}
}
//echo $BudgetType;
if(!empty($RequistionDetails))
{
foreach ($RequistionDetails as $ReqDet)
{
$Reqonn=new DateTime($ReqDet->ReqDate);
$Reqon=$Reqonn->format('d-m-Y');
// $Pdt = new DateTime($Req->PODate);
// $PODate = $Pdt->format('Y-m-d');
$Requestedby=$ReqDet->Requestedby;
$RequesterName=$ReqDet->FirstName;
//$Status=$ReqDet->Status;
}
}
// foreach ($POSTATUS as $PST )
// {
// $POStatus=$PST->StatusName;
// }
if(!empty($getlogpodtl ))
{
foreach ($getlogpodtl as $values )
{
$update=$values->FirstName;
}
}
?>
<style>
#packagingcalmodel {
margin-top:200px;
z-index: 1080 !important;
}
#freightcalmodel {
margin-top:200px;
z-index: 1080 !important;
}
#ExciseDutyCalModel {
margin-top:200px;
z-index: 1080 !important;
}
#VatCalModel {
margin-top:200px;
z-index: 1080 !important;
}
#CSTCalModel {
margin-top:200px;
z-index: 1080 !important;
}
.modal
{
padding-right:30% ! important;
}
</style>
<script src="<?php echo base_url(); ?>assets/js/CreatePOValidation.js" type="text/javascript"></script>
<script src="<?php echo base_url()?>assets/tinymce/js/tinymce/tinymce.min.js"></script>
<script type="text/javascript">
tinymce.init({
selector: "textarea#txtSpcialInstruction",
menubar: false,
statusbar: false,
toolbar: false
});
tinymce.init({
selector: "textarea#Add_Service_Description",
menubar: false,
statusbar: false,
toolbar: false
});
tinymce.init({
selector: "textarea#Edit_Service_Description",
menubar: false,
statusbar: false,
toolbar: false
});
tinymce.init({
selector: "textarea#View_Service_Description",
menubar: false,
statusbar: false,
toolbar: false,
readonly : 1
});
</script>
<script type="text/javascript">
var DelOpt = '<?php echo $DeliverOption; ?>';
var SchName = <?php echo json_encode($DeliverSchedule); ?>;
var DelDt = '<?php echo $Deliverydt; ?>';
var insurancestatus = '<?php echo $insurencestatus;?>';
//alert(insurancestatus)
var budgettype='<?php echo $BudgetType;?>';
// if(budgettype == 'CAPITAL')
// {
// alert('capital')
// document.getElementById('BudgetType').text = 2;
// document.getElementById('BudgetType').value = 'player';
// $('[name=BudgetType]').val(budgettype);
//}
//else
//{
// alert('revenue')
//document.getElementById('BudgetType').text = 1;
// document.getElementById('BudgetType').value = 'player';
//}
//alert(budgettype);
var insuranceno = '<?php echo $insurenceno;?>';
var statuscheck='<?php echo $PONOStatus;?>';
$(document).ready(function () {
if(statuscheck=="<?php echo SPECIAL_PO;?>")
{
$('#splpodiv').show();
}
else
{
$('#splpodiv').hide();
}
/*****************************/
var update = '<?php echo json_encode($update)?>';
if(update !='null')
{
$('#editpodiv').show();
}
else
{
$('#editpodiv').hide();
}
/*****************************/
$('#PoTypeOptions').attr("style", "pointer-events: none;");
if(DelOpt=="0"){
$('#Deliverydtdiv').show();
$('#Schedulediv').hide();
$('#Deliverydt').val(DelDt);
}
else if(DelOpt=="1"){
$('#Deliverydtdiv').hide();
$('#Schedulediv').show();
$('#Deliverydt').val('');
$('#Scheduleby').val(SchName);
}
var PaymentOther = '<?php echo $otherPayment; ?>';
var PayTerms = '<?php echo $Terms; ?>';
if(PayTerms=='PT08'){
$('#otheroptiondiv').show();
$('#Otherpayment').val(PaymentOther);
}
else{
$('#otheroptiondiv').hide();
$('#Otherpayment').val('');
}
// var insurancestatus = <?php echo $insurencestatus;?>;
// var insuranceno = <?php echo $insurenceno;?>;
if(insurancestatus == 1)
{
$('#insurancestatus').val(insurancestatus);
$("#insurancenodiv").show();
$('#insuranceno').val(insuranceno);
}
else
{
$('#insurancestatus').val(insurancestatus);
$('#insuranceno').val("");
$("#insurancenodiv").hide();
}
});
</script>
<script>
var NilType = '<?php echo NILTYPE;?>';
var PercentageType = '<?php echo PERCENTAGE;?>';
var POMaxDate = '<?php echo $MaxPoDate;?>';
var PackagingCalculation = '';
var FreightCalculation='';
var ExciseCalculation = '';
var StateTaxCheck = '';
var VatCalculation = '';
var CSTCalculation = '';
var RequistQuantity = '';
var IsEdit = '0';
var d = new Date(POMaxDate);
var SelectedMaterialCode = [];
var CollIndex = 0;
var SelectedMaterialList = {
Mat: []
};
// alert(new Date(year,month,day));
$(function() {
$("#PODate").datepicker({
//minDate : d,
//maxDate : 'now',
dateFormat: 'dd-mm-yy',changeMonth: false, changeYear: false
});//,yearRange: '-100:+0'
$("#Deliverydt").datepicker({
minDate : 'now',
dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,yearRange: '0:+10'
});
$('#drpSupplier').change(function() {
var cd = $("#drpSupplier option:selected").text();
//alert(cd);
$("#changeSup").val(cd);
var id = $('#drpSupplier').val();
$("#SupAddress").val('');
if(id != '0')
{
var y = <?php echo json_encode($Suplist, JSON_PRETTY_PRINT) ?>;
var Payment = <?php echo json_encode($Payment, JSON_PRETTY_PRINT) ?>;
var PaymentID='';
$('#PaymentTerms').empty();
$.each(y, function(idx, obj) {
if(obj.SupplierID === id)
{
$("#SupAddress").val(obj.Address);
PaymentID = obj.PaymentID;
}
});
if(PaymentID!='PT08'){
$('#otheroptiondiv').hide();
$('#Otherpayment').val('');
}
else if(PaymentID=='PT08')
{
$('#otheroptiondiv').show();
}
$.each(Payment, function(pay, payobj) {
if(payobj.PaymentID == PaymentID)
{
$("#PaymentTerms").append($('<option></option>').val(payobj.PaymentID).html(payobj.PaymentTerms));
}
});
$.each(Payment, function(pay, payobj) {
if(payobj.PaymentID == PaymentID)
{
}
else{
$("#PaymentTerms").append( $('<option></option>').val(payobj.PaymentID).html(payobj.PaymentTerms));
}
});
}
else
{
alert('Please select the SupplierID');
return false;
}
});
$('#MaterialCode').change(function() {
var id = $('#MaterialCode').val();
$("#ItemName").val('');
$("#UOM").val('');
$("#Quantity").val('');
$("#ItemName").val('');
$("#Rate").val('');
$("#txtBasicValue").val('');
RequistQuantity = '';
resetTaxField();
if(id != '0')
{
var Material = <?php echo json_encode($MaterialList, JSON_PRETTY_PRINT) ?>;
for(i=0;i<Material.length;i++)
{
$.each(Material[i], function(idx, obj) {
if(obj.MaterialCode === id)
{
$("#ItemName").val(obj.MaterialName);
$("#UOM").val(obj.UOM);
$("#Quantity").val(obj.Quantity);
RequistQuantity = obj.Quantity;
}
});
}
}
else
{
alert('Please select the MaterialCode');
return false;
}
});
$('#EditMaterialCode').change(function() {
var id = $('#EditMaterialCode').val();
$("#EditItemName").val('');
$("#EditUOM").val('');
$("#EditQuantity").val('');
$("#EditRate").val('');
$("#txtEditBasicValue").val('');
RequistQuantity = '';
resetTaxField();
if(id != '0')
{
var Material = <?php echo json_encode($MaterialList, JSON_PRETTY_PRINT) ?>;
for(i=0;i<Material.length;i++)
{
$.each(Material[i], function(idx, obj) {
if(obj.MaterialCode === id)
{
$("#EditItemName").val(obj.MaterialName);
$("#EditUOM").val(obj.UOM);
$("#EditQuantity").val(obj.Quantity);
RequistQuantity = obj.Quantity;
}
});
}
}
else
{
alert('Please select the MaterialCode');
return false;
}
});
/* Revenue Tax calcualation */
$('#DiscountType').change(function() {
selValue = $("#DiscountType").val();
$('#txtDiscount').val('');
$('#txtAfterDiscount').val('');
if (selValue == NilType)
{
$('#txtDiscount').attr('readonly', 'true');
$('#txtDiscount').val('0.00');
$('#txtAfterDiscount').val('0.00');
}
else
{
$('#txtDiscount').removeAttr( 'readonly','true' );
$('#txtDiscount').val('');
$('#txtAfterDiscount').val('');
}
change();
});
$('#EditDiscountType').change(function() {
selValue = $("#EditDiscountType").val();
$('#txtEditDiscount').val('');
$('#txtEditAfterDiscount').val('');
if (selValue == NilType)
{
$('#txtEditDiscount').attr('readonly', 'true');
$('#txtEditDiscount').val('0.00');
$('#txtEditAfterDiscount').val('0.00');
}
else
{
$('#txtEditDiscount').removeAttr( 'readonly','true' );
$('#txtEditDiscount').val('');
$('#txtEditAfterDiscount').val('');
}
Editchange();
});
$('#PackagingType').change(function() {
$('#txtPackaging').val('');
$('#txtAfterPackaging').val('');
selValue = $("#PackagingType").val() ;
if(selValue == PercentageType)
{
var PackagingCalculation = '';
$('#packagingcalmodel').modal('show');
$('#txtPackaging').removeAttr( 'readonly','true' );
}
else
{
if (selValue == NilType)
{
$('#txtPackaging').attr('readonly', 'true');
$('#txtPackaging').val('0.00');
change();
}
else
{
$('#txtPackaging').removeAttr( 'readonly','true' );
}
}
calculatePackaging(0);
});
$('#EditPackagingType').change(function() {
$('#txtEditPackaging').val('');
$('#txtEditAfterPackaging').val('');
selValue = $("#EditPackagingType").val() ;
if(selValue == PercentageType)
{
var PackagingCalculation = '';
$('#packagingcalmodel').modal('show');
$('#txtEditPackaging').removeAttr( 'readonly','true' );
}
else
{
if (selValue == NilType)
{
$('#txtEditPackaging').attr('readonly', 'true');
$('#txtEditPackaging').val('0.00');
Editchange();
}
else
{
$('#txtEditPackaging').removeAttr( 'readonly','true' );
}
}
calculatePackaging(1);
});
$('#txtExciseDuty').change(function() {
$('#ExciseDutyCalModel').modal('show');
});
$('#txtEditExciseDuty').change(function() {
$('#ExciseDutyCalModel').modal('show');
});
$('#txtVat').change(function() {
$('#VatCalModel').modal('show');
});
$('#txtEditVat').change(function() {
$('#VatCalModel').modal('show');
});
$('#txtCST').change(function() {
$('#CSTCalModel').modal('show');
});
$('#txtEditCST').change(function() {
$('#CSTCalModel').modal('show');
});
$('#drpFreight').change(function() {
var FreightType =$("#drpFreight").val();
if (FreightType == "PER TRIP")
{
$('#TripsValue').show();
}
else {
$('#TripsValue').hide();
}
selValue = $("#drpFreight").val() ;
$('#txtFreight').val('');
$('#txtAfterFreight').val('');
if(selValue == PercentageType)
{
var FreightCalculation = '';
$('#freightcalmodel').modal('show');
$('#txtFreight').removeAttr( 'readonly','true' );
}
else if (selValue == NilType)
{
$('#txtFreight').attr('readonly', 'true');
$('#txtFreight').val('0.00');
change();
}
else
{
$('#txtFreight').removeAttr( 'readonly','true' );
$('#txtFreight').val('');
}
calculateFreight(0);
});
/* $('#drpViewFreight').change(function() {
var FreightType =$("#drpViewFreight").val();
if (FreightType == "PER TRIP")
{
$('#ViewTripsValue').show();
}
else {
$('#ViewTripsValue').hide();
}
}); */
$('#drpEditFreight').change(function() {
var FreightType =$("#drpEditFreight").val();
if (FreightType == "PER TRIP")
{
$('#EditTripsValue').show();
}
else {
$('#EditTripsValue').hide();
}
selValue = $("#drpEditFreight").val() ;
$('#txtEditFreight').val('');
$('#txtEditAfterFreight').val('');
if(selValue == PercentageType)
{
var FreightCalculation = '';
$('#freightcalmodel').modal('show');
$('#txtEditFreight').removeAttr( 'readonly','true' );
}
else if (selValue == NilType)
{
$('#txtEditFreight').attr('readonly', 'true');
$('#txtEditFreight').val('0.00');
Editchange();
}
else
{
$('#txtEditFreight').removeAttr( 'readonly','true' );
$('#txtEditFreight').val('');
}
calculateFreight(1);
});
$('#drpViewFreight').change(function() {
var FreightType =$("#drpViewFreight").val();
if (FreightType == "PER TRIP")
{
$('#ViewTripsValue').show();
}
else {
$('#ViewTripsValue').hide();
}
selValue = $("#drpViewFreight").val() ;
$('#txtViewFreight').val('');
$('#txtViewAfterFreight').val('');
if(selValue == PercentageType)
{
var FreightCalculation = '';
$('#freightcalmodel').modal('show');
$('#txtViewFreight').removeAttr( 'readonly','true' );
}
else if (selValue == NilType)
{
$('#txtViewFreight').attr('readonly', 'true');
$('#txtViewFreight').val('0.00');
}
else
{
$('#txtViewFreight').removeAttr( 'readonly','true' );
$('#txtViewFreight').val('');
}
calculateFreight(2);
});
});
/*
* To calcuate the Discount */
function calculateDiscount(isEdit)
{
if(isEdit == '0')
{
if($('#MaterialCode').val() == "0")
{
alert('Please Select the Material Code');
$('#MaterialCode').focus();
return false;
}
else if($('#Rate').val() == '')
{
alert('Please Enter the Rate value');
$('#Rate').focus();
return false;
}
if($('#Rate').val() != '' && $('#MaterialCode').val() != "0" )
{
var basicValue = parseFloat($('#txtBasicValue').val());
var DiscountType =$("#DiscountType").val();
if(DiscountType == "0")
{
alert('Please Select the discount Type');
$('#txtDiscount').val('');
$("#DiscountType").focus();
}
else if ($('#txtDiscount').val() != '' && $('#txtDiscount').val() != '0')
{
var AfterDiscount = 0.0;
var Discountval = parseFloat($('#txtDiscount').val());
if(DiscountType == PercentageType)
{
AfterDiscount = <?php echo DIS_PERCENTAGE;?>;
}
else if(DiscountType == NilType )
{
AfterDiscount = "0.00";
}
else
{
AfterDiscount = <?php echo DIS_LUMPSUM;?>;
}
var discount = parseFloat(AfterDiscount).toFixed(2);
$('#txtAfterDiscount').val(discount);
}
else
{
$('#txtAfterDiscount').val("0.00");
}
}
calculateTotalValue();
}
else
{
if($('#EditMaterialCode').val() == "0")
{
alert('Please Select the Material Code');
$('#EditMaterialCode').focus();
return false;
}
else if($('#EditRate').val() == '')
{
alert('Please Enter the Rate value');
$('#EditRate').focus();
return false;
}
if($('#EditRate').val() != '' && $('#EditMaterialCode').val() != "0" )
{
var basicValue = parseFloat($('#txtEditBasicValue').val());
var DiscountType =$("#EditDiscountType").val();
if(DiscountType == "0")
{
alert('Please Select the discount Type');
$('#txtEditDiscount').val('');
$("#EditDiscountType").focus();
}
else if ($('#txtEditDiscount').val() != '' && $('#txtEditDiscount').val() != '0')
{
var AfterDiscount = 0.0;
var Discountval = parseFloat($('#txtEditDiscount').val());
if(DiscountType == PercentageType)
{
AfterDiscount = <?php echo DIS_PERCENTAGE;?>;
}
else if(DiscountType == NilType )
{
AfterDiscount = "0.00";
}
else
{
AfterDiscount = <?php echo DIS_LUMPSUM;?>;
}
var discount = parseFloat(AfterDiscount).toFixed(2);
$('#txtEditAfterDiscount').val(discount);
}
else
{
$('#txtEditAfterDiscount').val("0.00");
}
}
calculateEditTotalValue();
}
}
/*
* To calcuate the Packaging */
function calculatePackaging(isEdit)
{
if(isEdit == '0')
{
if($('#MaterialCode').val() == "0")
{
alert('Please Select the Material Code');
$('#MaterialCode').focus();
return false;
}
else if($('#Rate').val() == '')
{
alert('Please Enter the Rate value');
$('#Rate').focus();
return false;
}
else
{
var basicValue = parseFloat($('#txtBasicValue').val());
var PackagingType =$("#PackagingType").val();
if(PackagingType == "0")
{
alert('Please select the Packaging Type');
$('#txtPackaging').val('');
$("#PackagingType").focus();
}
else if($('#txtPackaging').val() != '' && $('#txtPackaging').val() !='0')
{
var Packagingvalue = parseFloat($('#txtPackaging').val());
var AfterPackaging = 0.0;
if(PackagingType == PercentageType)
{
if($(PackagingCalculation != 0 && '#txtAfterDiscount').val() == '')
{
alert('Please Enter the Discount value');
$('#txtPackaging').val('');
$('#DiscountType').focus();
return false;
}
else
{
var AfterDiscount =parseFloat($('#txtAfterDiscount').val());
AfterPackaging = PackagingCalculation == 0 ? <?php echo PACKAGING_PERCENTAGE_BYBASICVALUE ;?> : <?php echo PACKAGING_PERCENTAGE_BYDISCOUNTVALUE;?> ;
}
}
else if(PackagingType == NilType )
{
AfterPackaging = "0.00";
}
else
{
AfterPackaging = PackagingCalculation == 0 ? <?php echo PACKAGING_LUMPSUM_BYBASICVALUE ;?>:<?php echo PACKAGING_LUMPSUM_BYDISCOUNTVALUE;?> ;
}
var Packaging = parseFloat(AfterPackaging).toFixed(2);
$('#txtAfterPackaging').val(Packaging);
//RevenueChangeSgst();
}
else
{
$('#txtAfterPackaging').val("0.00");
}
}
calculateTotalValue();
}
else
{
if($('#EditMaterialCode').val() == "0")
{
alert('Please Select the Material Code');
$('#EditMaterialCode').focus();
return false;
}
else if($('#EditRate').val() == '')
{
alert('Please Enter the Rate value');
$('#EditRate').focus();
return false;
}
else
{
var basicValue = parseFloat($('#txtEditBasicValue').val());
var PackagingType =$("#EditPackagingType").val();
if(PackagingType == "0")
{
alert('Please select the Packaging Type');
$('#txtEditPackaging').val('');
$("#EditPackagingType").focus();
}
else if($('#txtEditPackaging').val() != '' && $('#txtEditPackaging').val() !='0')
{
var Packagingvalue = parseFloat($('#txtEditPackaging').val());
var AfterPackaging = 0.0;
if(PackagingType == PercentageType)
{
if(PackagingCalculation != 0 &&$('#txtEditAfterDiscount').val() == '')
{
alert('Please Enter the Discount value');
$('#EditDiscountType').focus();
$('#txtEditPackaging').val('');
return false;
}
else
{
var AfterDiscount =parseFloat($('#txtEditAfterDiscount').val());
AfterPackaging = PackagingCalculation == 0 ? <?php echo PACKAGING_PERCENTAGE_BYBASICVALUE ;?> : <?php echo PACKAGING_PERCENTAGE_BYDISCOUNTVALUE;?> ;
}
}
else if(PackagingType == NilType )
{
AfterPackaging = "0.00";
}
else
{
AfterPackaging = PackagingCalculation == 0 ? <?php echo PACKAGING_LUMPSUM_BYBASICVALUE ;?>:<?php echo PACKAGING_LUMPSUM_BYDISCOUNTVALUE;?> ;
}
var Packaging = parseFloat(AfterPackaging).toFixed(2);
$('#txtEditAfterPackaging').val(Packaging);
//RevenueChangeEditSgst();
}
else
{
$('#txtEditAfterPackaging').val("0.00");
}
}
calculateEditTotalValue();
}
}
function calculateExcise(isEdit)
{
if(isEdit == '0')
{
if($('#MaterialCode').val() == "0")
{
alert('Please Select the Material Code');
$('#MaterialCode').focus();
$('#txtExciseDuty').val('');
return false;
}
else if($('#Rate').val() == '')
{
alert('Please Enter the Rate value');
$('#txtExciseDuty').val('');
$('#Rate').focus();
return false;
}
else
{
var basicValue = parseFloat($('#txtBasicValue').val());
if($('#txtExciseDuty').val() != '' && $('#txtExciseDuty').val() != '0')
{
var AfterExciseDuty = 0.0;
var ExciseDuty = parseFloat($('#txtExciseDuty').val());
if(ExciseCalculation == '0')
{
AfterExciseDuty = <?php echo EXCISE_ONBASICVALUE; ?>;
}
else if(ExciseCalculation == '1')
{
if($('#txtAfterDiscount').val() == '')
{
alert('Please Enter the Discount value');
$('#DiscountType').focus();
$('#txtExciseDuty').val('');
return false;
}
else
{
var AfterDiscount =parseFloat($('#txtAfterDiscount').val());
AfterExciseDuty = <?php echo EXCISE_ONBASIC_DISCOUNT; ?>;
}
}
else if(ExciseCalculation == '2')
{
if($('#txtAfterDiscount').val() == '')
{
alert('Please Enter the Discount value');
$('#DiscountType').focus();
$('#txtExciseDuty').val('');
return false;
}
else if($('#txtAfterPackaging').val() == '')
{
alert('Please Enter the Packaging value');
$('#PackagingType').focus();
$('#txtExciseDuty').val('');
return false;
}
else
{
var AfterDiscount =parseFloat($('#txtAfterDiscount').val());
var AfterPackaging = parseFloat($('#txtAfterPackaging').val());
AfterExciseDuty = <?php echo EXCISE_ONBASIC_DISCOUNT_PACKAGING; ?>;
}
}
else
{
if($('#txtAfterPackaging').val() == '')
{
alert('Please Enter the Packaging value');
$('#PackagingType').focus();
$('#txtExciseDuty').val('');
return false;
}
else
{
AfterExciseDuty = <?php echo EXCISE_ONBASIC_PACKAGING; ?>;
var AfterPackaging = parseFloat($('#txtAfterPackaging').val());
}
}
var ExciseVal = parseFloat(AfterExciseDuty).toFixed(2);
$('#txtAfterExciseDuty').val(ExciseVal);
}
else
{
$('#txtAfterExciseDuty').val("0.00");
}
}
calculateTotalValue();
}
else
{
if($('#EditMaterialCode').val() == "0")
{
alert('Please Select the Material Code');
$('#EditMaterialCode').focus();
return false;
}
else if($('#EditRate').val() == '')
{
alert('Please Enter the Rate value');
$('#EditRate').focus();
return false;
}
else
{
var basicValue = parseFloat($('#txtEditBasicValue').val());
if($('#txtEditExciseDuty').val() != '' && $('#txtEditExciseDuty').val() != '0')
{
var AfterExciseDuty = 0.0;
var ExciseDuty = parseFloat($('#txtEditExciseDuty').val());
if(ExciseCalculation == '0')
{
AfterExciseDuty = <?php echo EXCISE_ONBASICVALUE; ?>;
}
else if(ExciseCalculation == '1')
{
if($('#txtEditAfterDiscount').val() == '')
{
alert('Please Enter the Discount value');
$('#EditDiscountType').focus();
$('#txtEditExciseDuty').val('');
return false;
}
else
{
var AfterDiscount =parseFloat($('#txtEditAfterDiscount').val());
AfterExciseDuty = <?php echo EXCISE_ONBASIC_DISCOUNT; ?>;
}
}
else if(ExciseCalculation == '2')
{
if($('#txtEditAfterDiscount').val() == '')
{
alert('Please Enter the Discount value');
$('#EditDiscountType').focus();
$('#txtEditExciseDuty').val('');
return false;
}
else if($('#txtEditAfterPackaging').val() == '')
{
alert('Please Enter the Packaging value');
$('#EditPackagingType').focus();
$('#txtEditExciseDuty').val('');
return false;
}
else
{
var AfterDiscount =parseFloat($('#txtEditAfterDiscount').val());
var AfterPackaging = parseFloat($('#txtEditAfterPackaging').val());
AfterExciseDuty = <?php echo EXCISE_ONBASIC_DISCOUNT_PACKAGING; ?>;
}
}
else
{
if($('#txtEditAfterPackaging').val() == '')
{
alert('Please Enter the Packaging value');
$('#EditPackagingType').focus();
$('#txtEditExciseDuty').val('');
return false;
}
else
{
var AfterPackaging = parseFloat($('#txtEditAfterPackaging').val());
AfterExciseDuty = <?php echo EXCISE_ONBASIC_PACKAGING; ?>;
}
}
var ExciseVal = parseFloat(AfterExciseDuty).toFixed(2);
$('#txtEditAfterExciseDuty').val(ExciseVal);
}
else
{
$('#txtEditAfterExciseDuty').val("0.00");
}
}
calculateEditTotalValue();
}
}
function calculateVat(isEdit)
{
if(isEdit == '0')
{
if($('#MaterialCode').val() == "0")
{
alert('Please Select the Material Code');
$('#MaterialCode').focus();
return false;
}
else if($('#Rate').val() == '')
{
alert('Please Enter the Rate value');
$('#Rate').focus();
return false;
}
else
{
var basicValue = parseFloat($('#txtBasicValue').val());
var AfterVat = 0.0;
if(VatCalculation != 0 && $('#txtVat').val() != '' )
{
if($('#txtAfterExciseDuty').val() == '')
{
alert('Please Enter the Excise value');
$('#txtExciseDuty').focus();
$('#txtVat').val('');
return false;
}
else
{
var ExciseDuty = parseFloat($('#txtAfterExciseDuty').val());
vatValue = parseFloat($('#txtVat').val());
AfterVat = <?php echo VAT_ONEXICSEVALUE; ?>;
var Vatval = parseFloat(AfterVat).toFixed(2);
$('#txtAfterVat').val(Vatval);
}
}
else if(VatCalculation == 0 && $('#txtVat').val() != '')
{
vatValue = parseFloat($('#txtVat').val());
AfterVat = <?php echo VAT_ONBASICVALUE; ?>;
var Vatval = parseFloat(AfterVat).toFixed(2);
$('#txtAfterVat').val(Vatval);
}
else
{
$('#txtAfterVat').val("0.00");
}
calculateTotalValue();
}
}
else
{
if($('#EditMaterialCode').val() == "0")
{
alert('Please Select the Material Code');
$('#EditMaterialCode').focus();
return false;
}
else if($('#EditRate').val() == '')
{
alert('Please Enter the Rate value');
$('#EditRate').focus();
return false;
}
else
{
var basicValue = parseFloat($('#txtEditBasicValue').val());
var ExciseDuty = parseFloat($('#txtEditAfterExciseDuty').val());
var AfterVat = 0.0;
if(VatCalculation != 0 && $('#txtEditVat').val() != '' )
{
if($('#txtEditAfterExciseDuty').val() == '')
{
alert('Please Enter the Excise value');
$('#txtEditAfterExciseDuty').focus();
$('#txtEditVat').val('');
return false;
}
else
{
var ExciseDuty = parseFloat($('#txtEditAfterExciseDuty').val());
vatValue = parseFloat($('#txtEditVat').val());
AfterVat = <?php echo VAT_ONEXICSEVALUE; ?>;
var Vatval = parseFloat(AfterVat).toFixed(2);
$('#txtEditAfterVat').val(Vatval);
}
}
else if(VatCalculation == 0 && $('#txtEditVat').val() != '')
{
vatValue = parseFloat($('#txtEditVat').val());
AfterVat = <?php echo VAT_ONBASICVALUE; ?>;
var Vatval = parseFloat(AfterVat).toFixed(2);
$('#txtEditAfterVat').val(Vatval);
}
else
{
$('#txtEditAfterVat').val("0.00");
}
calculateEditTotalValue();
}
}
}
function calculateCST(isEdit)
{
if(isEdit == '0')
{
if($('#MaterialCode').val() == "0")
{
alert('Please Select the Material Code');
$('#MaterialCode').focus();
return false;
}
else if($('#Rate').val() == '')
{
alert('Please Enter the Rate value');
$('#Rate').focus();
return false;
}
else
{
var basicValue = parseFloat($('#txtBasicValue').val());
var AfterCST = 0.0;
if(CSTCalculation != 0 && $('#txtCST').val() != '' )
{
if($('#txtAfterExciseDuty').val() == '')
{
alert('Please Enter the Excise value');
$('#txtExciseDuty').focus();
$('#txtAfterCST').val('');
return false;
}
else
{
var ExciseDuty = parseFloat($('#txtAfterExciseDuty').val());
var CSTValue= parseFloat($('#txtCST').val());
AfterCST = <?php echo CST_ONBASICVALUE; ?>;
var Vatval = parseFloat(AfterCST).toFixed(2);
$('#txtAfterCST').val(Vatval);
}
}
else if(CSTCalculation == 0 && $('#txtCST').val() != '')
{
var CSTValue= parseFloat($('#txtCST').val());
AfterCST = <?php echo CST_ONBASICVALUE; ?>;
var Vatval = parseFloat(AfterCST).toFixed(2);
$('#txtAfterCST').val(Vatval);
}
else
{
$('#txtAfterCST').val("0.00");
}
calculateTotalValue();
}
}
else
{
if($('#EditMaterialCode').val() == "0")
{
alert('Please Select the Material Code');
$('#EditMaterialCode').focus();
return false;
}
else if($('#EditRate').val() == '')
{
alert('Please Enter the Rate value');
$('#EditRate').focus();
return false;
}
else
{
var basicValue = parseFloat($('#txtEditBasicValue').val());
var AfterCST = 0.0;
if(CSTCalculation != 0 && $('#txtEditCST').val() != '' )
{
if($('#txtEditAfterExciseDuty').val() == '')
{
alert('Please Enter the Excise value');
$('#txtEditAfterExciseDuty').focus();
$('#txtEditCST').val('');
return false;
}
else
{
var ExciseDuty = parseFloat($('#txtEditAfterExciseDuty').val());
var CSTValue= parseFloat($('#txtEditCST').val());
AfterCST = <?php echo CST_ONBASICVALUE; ?>;
var Vatval = parseFloat(AfterCST).toFixed(2);
$('#txtEditAfterCST').val(Vatval);
}
}
else if(CSTCalculation == 0 && $('#txtEditCST').val() != '')
{
var CSTValue= parseFloat($('#txtEditCST').val());
AfterCST = <?php echo CST_ONBASICVALUE; ?>;
var Vatval = parseFloat(AfterCST).toFixed(2);
$('#txtEditAfterCST').val(Vatval);
RevenueChangeEditSgst();
}
else
{
$('#txtEditAfterCST').val("0.00");
}
calculateEditTotalValue();
}
}
}
function calculateGST(isEdit)
{
if(isEdit == '0')
{
if($('#MaterialCode').val() == "0")
{
alert('Please Select the Material Code');
$('#MaterialCode').focus();
return false;
}
else if($('#Rate').val() == '')
{
alert('Please Enter the Rate value');
$('#Rate').focus();
return false;
}
else
{
var basicValue = parseFloat($('#txtBasicValue').val());
if($('#txtGST').val() != "0" && $('#txtGST').val() != '')
{
var GSTValue = parseFloat($('#txtGST').val());
var AfterGST = 0.0;
AfterGST = <?php echo GSTTAX; ?>;
var GSTval = parseFloat(AfterGST).toFixed(2);
$('#txtAfterGST').val(GSTval);
}
else
{
$('#txtAfterGST').val("0.00");
}
}
calculateTotalValue();
}
else
{
if($('#EditMaterialCode').val() == "0")
{
alert('Please Select the Material Code');
$('#EditMaterialCode').focus();
return false;
}
else if($('#EditRate').val() == '')
{
alert('Please Enter the Rate value');
$('#EditRate').focus();
return false;
}
else
{
var basicValue = parseFloat($('#txtEditBasicValue').val());
if($('#txtEditGST').val() != "0" && $('#txtEditGST').val() != '')
{
var GSTValue = parseFloat($('#txtEditGST').val());
var AfterGST = 0.0;
AfterGST = <?php echo GSTTAX; ?>;
var GSTval = parseFloat(AfterGST).toFixed(2);
$('#txtEditAfterGST').val(GSTval);
}
else
{
$('#txtEditAfterGST').val("0.00");
}
}
calculateEditTotalValue();
}
}
function calculateOtherTaxes(isEdit)
{
if(isEdit == '0')
{
if($('#MaterialCode').val() == "0")
{
alert('Please Select the Material Code');
$('#MaterialCode').focus();
return false;
}
else if($('#Rate').val() == '')
{
alert('Please Enter the Rate value');
$('#Rate').focus();
return false;
}
else
{
var basicValue = parseFloat($('#txtBasicValue').val());
if($('#txtOtherTax').val() != "0" && $('#txtOtherTax').val() != '')
{
var OtherTaxValue = parseFloat($('#txtOtherTax').val());
var AfterOtherTaxes = 0.0;
AfterOtherTaxes = <?php echo OTHERTAX; ?>;
var Otherval = parseFloat(AfterOtherTaxes).toFixed(2);
$('#txtAfterOtherTax').val(Otherval);
}
else
{
$('#txtAfterOtherTax').val("0.00");
}
calculateTotalValue();
}
}
else
{
if($('#EditMaterialCode').val() == "0")
{
alert('Please Select the Material Code');
$('#EditMaterialCode').focus();
return false;
}
else if($('#EditRate').val() == '')
{
alert('Please Enter the Rate value');
$('#EditRate').focus();
return false;
}
else
{
var basicValue = parseFloat($('#txtEditBasicValue').val());
if($('#txtEditOtherTax').val() != "0" && $('#txtEditOtherTax').val() != '')
{
var OtherTaxValue = parseFloat($('#txtEditOtherTax').val());
var AfterOtherTaxes = 0.0;
AfterOtherTaxes = <?php echo OTHERTAX; ?>;
var Otherval = parseFloat(AfterOtherTaxes).toFixed(2);
$('#txtEditAfterOtherTax').val(Otherval);
}
else
{
$('#txtEditAfterOtherTax').val("0.00");
}
calculateEditTotalValue();
}
}
}
function calculateFreight(isEdit)
{
if(isEdit == '0')
{
if($('#MaterialCode').val() == "0")
{
alert('Please Select the Material Code');
$('#MaterialCode').focus();
return false;
}
else if($('#Rate').val() == '')
{
alert('Please Enter the Rate value');
$('#Rate').focus();
return false;
}
else
{
var basicValue = parseFloat($('#txtBasicValue').val());
var FreightType =$("#drpFreight").val();
if(FreightType == "0")
{
alert('Please select Freight Type');
$('#txtFreight').val('');
$("#drpFreight").focus();
}
else if( $('#txtFreight').val() != "0" && $('#txtFreight').val() != '')
{
var FreightValue = parseFloat($('#txtFreight').val());
var UOM = parseFloat($('#UOM').val());
var Quantity = parseFloat($('#Quantity').val());
//alert(FreightType);
var AfterFreight = 0.0;
if(FreightType == PercentageType)
{
if($(FreightCalculation != 0 && '#txtAfterDiscount').val() == '')
{
alert('Please Enter the Discount value');
$('#txtFreight').val('');
$('#DiscountType').focus();
return false;
}
else
{
var AfterDiscount =parseFloat($('#txtAfterDiscount').val());
AfterFreight = FreightCalculation == 0 ? <?php echo FREIGHT_PERCENTAGE;?> : <?php echo FREIGHT_PERCENTAGE_AFTER;?> ;
}
}
else if(FreightType == NilType)
{
AfterFreight = 0.0;
}
else if(FreightType == '<?php echo LUMPSUM;?>')
{
AfterFreight = <?php echo FREIGHT_LUMPSUM;?>;
}
else if(FreightType == '<?php echo PERUOM;?>')
{
AfterFreight = <?php echo FREIGHT_PERUOM;?>;
}
else if(FreightType == '<?php echo PERTRIP;?>')
{
if($('#NOOfTrips').val()==''){
alert('Please Enter No of Trip');
$("#NOOfTrips").focus();
$('#txtFreight').val(0)
AfterFreight=0;
$('#txtAfterFreight').val("0.00");
return false;
}
else{
var noOftrip = $("#NOOfTrips").val();
AfterFreight = <?php echo FREIGHT_PERTRIP;?>;
AfterFreight = parseFloat(AfterFreight * noOftrip).toFixed(2);
}
}
else {
AfterFreight = $("#txtFreight").val();
}
var AfterFreightval = parseFloat(AfterFreight).toFixed(2);
$('#txtAfterFreight').val(AfterFreightval);
//RevenueChangeSgst();
}
else
{
$('#txtAfterFreight').val("0.00");
}
}
calculateTotalValue();
}
else if(isEdit == '1')
{
if($('#EditMaterialCode').val() == "0")
{
// alert('Please Select the Material Code');
$('#EditMaterialCode').focus();
return false;
}
else if($('#EditRate').val() == '')
{
alert('Please Enter the Rate value');
$('#EditRate').focus();
return false;
}
else
{
var basicValue = parseFloat($('#txtEditBasicValue').val());
var FreightType =$("#drpEditFreight").val();
if(FreightType == "0")
{
alert('Please select Freight Type');
$('#txtEditFreight').val('');
$("#drpEditFreight").focus();
}
else if( $('#txtEditFreight').val() != "0" && $('#txtEditFreight').val() != '')
{
var FreightValue = parseFloat($('#txtEditFreight').val());
var UOM = parseFloat($('#EditUOM').val());
var Quantity = parseFloat($('#EditQuantity').val());
//alert(FreightType);
var AfterFreight = 0.0;
// if(FreightType == PercentageType)
// {
// AfterFreight =
// }
if(FreightType == PercentageType)
{
if($(FreightCalculation != 0 && '#txtEditAfterDiscount').val() == '')
{
alert('Please Enter the Discount value');
$('#txtEditFreight').val('');
$('#DiscountType').focus();
return false;
}
else
{
var AfterDiscount =parseFloat($('#txtEditAfterDiscount').val());
AfterFreight = FreightCalculation == 0 ? <?php echo FREIGHT_PERCENTAGE;?> : <?php echo FREIGHT_PERCENTAGE_AFTER;?> ;
}
}
else if(FreightType == NilType)
{
AfterFreight = 0.0;
}
else if(FreightType == '<?php echo LUMPSUM;?>')
{
AfterFreight = <?php echo FREIGHT_LUMPSUM;?>;
}
else if(FreightType == '<?php echo PERUOM;?>')
{
AfterFreight = <?php echo FREIGHT_PERUOM;?>;
}
else if(FreightType == '<?php echo PERTRIP;?>')
{
if($('#EditNOOfTrips').val()==''){
alert('Please Enter No of Trip');
$("#EditNOOfTrips").focus();
$('#txtEditFreight').val(0)
AfterFreight=0;
$('#txtEditAfterFreight').val("0.00");
return false;
}
else{
var noOftrip = $("#EditNOOfTrips").val();
AfterFreight = <?php echo FREIGHT_PERTRIP;?>;
AfterFreight = parseFloat(AfterFreight * noOftrip).toFixed(2);
}
}
else {
AfterFreight = $("#txtEditFreight").val();
}
var AfterFreightval = parseFloat(AfterFreight).toFixed(2);
$('#txtEditAfterFreight').val(AfterFreightval);
//RevenueChangeEditSgst();
}
else
{
$('#txtEditAfterFreight').val("0.00");
}
}
calculateEditTotalValue();
}else if(isEdit == '2')// for view model freight calculation
{
//alert("view Frieght");
if($('#ViewMaterialCode').val() == "0")
{
// alert('Please Select the Material Code');
$('#ViewMaterialCode').focus();
return false;
}
else if($('#ViewRate').val() == '')
{
alert('Please Enter the Rate value');
$('#ViewRate').focus();
return false;
}
else
{
var basicValue = parseFloat($('#txtViewBasicValue').val());
var FreightType =$("#drpViewFreight").val();
if(FreightType == "0")
{
alert('Please select Freight Type');
$('#txtViewFreight').val('');
$("#drpViewFreight").focus();
}
else if( $('#txtViewFreight').val() != "0" && $('#txtViewFreight').val() != '')
{
var FreightValue = parseFloat($('#txtViewFreight').val());
var UOM = parseFloat($('#ViewUOM').val());
var Quantity = parseFloat($('#ViewQuantity').val());
//alert(FreightType);
var AfterFreight = 0.0;
// if(FreightType == PercentageType)
// {
// AfterFreight = <?php echo FREIGHT_PERCENTAGE;?>;
// }
if(FreightType == PercentageType)
{
if($(FreightCalculation != 0 && '#txtViewAfterDiscount').val() == '')
{
alert('Please Enter the Discount value');
$('#txtViewFreight').val('');
$('#DiscountType').focus();
return false;
}
else
{
var AfterDiscount =parseFloat($('#txtViewAfterDiscount').val());
AfterFreight = FreightCalculation == 0 ? <?php echo FREIGHT_PERCENTAGE;?> : <?php echo FREIGHT_PERCENTAGE_AFTER;?> ;
}
}
else if(FreightType == NilType)
{
AfterFreight = 0.0;
$('#txtViewFreight').val("0.00");
}
else if(FreightType == '<?php echo LUMPSUM;?>')
{
AfterFreight = <?php echo FREIGHT_LUMPSUM;?>;
}
else if(FreightType == '<?php echo PERUOM;?>')
{
AfterFreight = <?php echo FREIGHT_PERUOM;?>;
}
else if(FreightType == '<?php echo PERTRIP;?>')
{
if($('#ViewNOOfTrips').val()==''){
alert('Please Enter No of Trip');
$("#ViewNOOfTrips").focus();
$('#txtViewFreight').val(0)
AfterFreight=0;
$('#txtViewAfterFreight').val("0.00");
return false;
}
else{
var noOftrip = $("#ViewNOOfTrips").val();
AfterFreight = <?php echo FREIGHT_PERTRIP;?>;
AfterFreight = parseFloat(AfterFreight * noOftrip).toFixed(2);
}
}
else {
AfterFreight = $("#txtViewFreight").val();
}
var AfterFreightval = parseFloat(AfterFreight).toFixed(2);
$('#txtViewAfterFreight').val(AfterFreightval);
//RevenueChangeviewSgst();
}
else
{
$('#txtViewAfterFreight').val("0.00");
}
//$('#AfterCgst').val(calculateCgstTax($('#txtBasicValue').val(),$('#Cgst').val(),$('#txtAfterDiscount').val() == '' ? '0.00' : $('#txtAfterDiscount').val(),$("#txtAfterPackaging").val()== '' ? "0.00" : $('#txtAfterPackaging').val(),$("#txtAfterFreight").val()== '' ? "0.00" : $('#txtAfterFreight').val()));
basicvalue = $('#txtViewBasicValue').val();
cgst= $('#ViewCGST').val();
sgst= $('#ViewSGST').val();
igst= $('#ViewIGST').val();
//alert(igst);
afterdiscount= $('#txtViewAfterDiscount').val();
//alert(afterdiscount);
packaging12= $('#txtViewAfterPackaging').val();
//alert( packaging12);
freight12= $('#txtViewAfterFreight').val();//ViewAfterCGST
//alert(freight12);
calculateCgstTax(basicvalue,cgst,afterdiscount,packaging12,freight12);
calculateSgstTax(basicvalue,sgst,afterdiscount,packaging12,freight12);
calculateIgstTax(basicvalue,igst,afterdiscount,packaging12,freight12)
}
calculateViewTotalValue();
}
}
/* Set the Packaging calculation option for calculating Packaging */
function SetPackagingOption()
{
PackagingCalculation = $("input:radio[name='optPackaging']:checked").val();
$('#packagingcalmodel').modal('hide');
calculatePackaging($('#isEdit').val());
}
/* Set the Freight calculation option for calculating Packaging */
function SetfreightOption()
{
FreightCalculation = $("input:radio[name='optfreight']:checked").val();
$('#freightcalmodel').modal('hide');
calculateFreight($('#isEdit').val());
}
/* Set the Packaging calculation option for calculating Packaging */
function SetExciseCalculation()
{
ExciseCalculation = $("input:radio[name='optExcise']:checked").val();
$('#ExciseDutyCalModel').modal('hide');
calculateExcise($('#isEdit').val());
}
/* Set the Packaging calculation option for calculating Packaging */
function SetVatorCST()
{
StateTaxCheck = $("input:radio[name='Range']:checked").val();
$('#txtPoRange').val(StateTaxCheck) ;
//alert('Radio clicke:'+StateTaxCheck);
if(StateTaxCheck == "0")
{
// style="display:none;"
$('#Vat').removeAttr("style");
$('#TotSCST').removeAttr("style");
$('#CST').attr("style","display:none;");
$('#TotICST').attr("style","display:none;");
$('#IGSTEditModel').attr("style","display:none;");
$('#SGSTEditModel').removeAttr("style");
$('#IGSTViewModel').attr("style","display:none;");
$('#SGSTViewModel').removeAttr("style");
$('#IGSTAddModel').attr("style","display:none;");
$('#SGSTAddModel').removeAttr("style");
$('#RevenueIgst').val(0);
$('#RevenueAfterIgst').val(0);
$('#txttaxcheck').val(0);
}
else
{
$('#EditSgst').val(0);
$('#EditAfterSgst').val(0);
$('#EditCgst').val(0);
$('#EditAfterCgst').val(0);
$('#CST').removeAttr("style");
$('#TotICST').removeAttr("style");
$('#Vat').attr("style","display:none;");
$('#TotSCST').attr("style","display:none;");
$('#IGSTEditModel').removeAttr("style");
$('#SGSTEditModel').attr("style","display:none;");
$('#IGSTViewModel').removeAttr("style");
$('#SGSTViewModel').attr("style","display:none;");
$('#IGSTAddModel').removeAttr("style");
$('#SGSTAddModel').attr("style","display:none;");
$('#RevenueCgst').val(0);
$('#RevenueAfterCgst').val(0);
$('#RevenueSgst').val(0);
$('#RevenueAfterIgst').val(0);
$('#txttaxcheck').val(1);
}
}
$(document).ready(function () {
$("#PaymentTerms").select2();
$('#Date').click(function () {
//for Date range selection
$('#Schedulediv').attr("style","display:none;");
$('#Deliverydtdiv').removeAttr("style");
});
$('#Schedule').click(function () {
//for schedule range selection
$('#Deliverydtdiv').attr("style","display:none;");
$('#Schedulediv').removeAttr("style");
});
SetVatorCST();
});
function SetVatCalculation()
{
VatCalculation = $("input:radio[name='optVat']:checked").val();
$('#VatCalModel').modal('hide');
calculateVat($('#isEdit').val());
}
function SetCSTCalculation()
{
CSTCalculation = $("input:radio[name='optCST']:checked").val();
$('#CSTCalModel').modal('hide');
calculateCST($('#isEdit').val());
}
function ExceedQuantityCheck()
{
// RequistQuantity
var EnterQuantity = $("#Quantity").val()== '' ? "0.00" : parseFloat($("#Quantity").val());
var ReqQuantity = parseFloat(RequistQuantity);
//if(EnterQuantity > ReqQuantity)
// {
// alert('Your exceeding the Quantity from the Requisition Quantity:'+ RequistQuantity +'.Please adjust the Quantity to proceed further.');
// //$('#Quantity').val(RequistQuantity);
// $('#Quantity').focus();
// return false;
// }
//else
// {
return true;
//}
}
function ExceedEditQuantityCheck()
{
// RequistQuantity
var EnterQuantity = $("#EditQuantity").val()== '' ? "0.00" : parseFloat($("#EditQuantity").val());
var ReqQuantity = parseFloat(RequistQuantity);
//if(EnterQuantity != ReqQuantity)
// {
// alert('Your exceeding the Quantity from the Requisition Quantity:'+ RequistQuantity +'.Please adjust the Quantity to proceed further.');
// $('#EditQuantity').focus();
// return false;
// }
//else
// {
return true;
// }
}
// To Reset the Tax calculation
function resetTaxField()
{
$("#ItemName").val('');
$("#UOM").val('');
$("#Quantity").val('');
$("#Rate").val('');
$("#DiscountType").val("0");
$("#txtDiscount").val('');
$('#txtAfterDiscount').val('');
$("#PackagingType").val("0")
$("#txtPackaging").val('');
$('#txtAfterPackaging').val('');
$("#txtExciseDuty").val('');
$('#txtAfterExciseDuty').val('');
$("#txtVat").val('');
$('#txtAfterVat').val('');
$("#txtCST").val('');
$('#txtAfterCST').val('');
$("#txtGST").val('');
$('#txtAfterGST').val('');
$("#txtOtherTax").val('');
$('#txtAfterOtherTax').val('');
$("#drpFreight").val("0")
$("#txtFreight").val('');
$('#txtAfterFreight').val('');
$('#txtInsurance').val('');
$('#txtTotalOrderValue').val('');
ExciseCalculation = '';
PackagingCalculation = '';
VatCalculation = '';
CSTCalculation = '';
}
function Editchange(){
//alert('hi');
//ExceedEditQuantityCheck();
if($('#EditQuantity').val() != '' && $('#EditRate').val() != '')
{
var txtQuantity = parseFloat( $('#EditQuantity').val());
var txtUnitPrice = parseFloat($('#EditRate').val());
var Tot = txtQuantity * txtUnitPrice
$('#txtEditBasicValue').val(parseFloat(Tot).toFixed(2));
if ($("#EditDiscountType").val()!=0) {
calculateDiscount(1);
}
if ($("#EditPackagingType").val()!=0) {
calculatePackaging(1);
}
if($("#drpEditFreight").val()!=0){
calculateFreight(1);
}
if($("#EditCgst").val()!=''){
$('#EditAfterCgst').val(calculateSgstTax($('#txtEditBasicValue').val(),$('#EditCgst').val(),$('#txtEditAfterDiscount').val() == '' ? '0.00' : $('#txtEditAfterDiscount').val(),$('#txtEditAfterPackaging').val() == '' ? '0.00' : $('#txtEditAfterPackaging').val(),$('#txtEditAfterFreight').val() == '' ? '0.00' : $('#txtEditAfterFreight').val()));
}
if($("#EditSgst").val()!=''){
$('#EditAfterSgst').val(calculateSgstTax($('#txtEditBasicValue').val(),$('#EditSgst').val(),$('#txtEditAfterDiscount').val() == '' ? '0.00' : $('#txtEditAfterDiscount').val(),$('#txtEditAfterPackaging').val() == '' ? '0.00' : $('#txtEditAfterPackaging').val(),$('#txtEditAfterPackaging').val() == '' ? '0.00' : $('#txtEditAfterFreight').val()));
}
if($("#EditIgst").val()!=''){
$('#EditAfterIgst').val(calculateIgstTax($('#txtEditBasicValue').val(),$('#EditIgst').val(),$('#txtEditAfterDiscount').val() == '' ? '0.00' : $('#txtEditAfterDiscount').val(),$('#txtEditAfterPackaging').val() == '' ? '0.00' : $('#txtEditAfterPackaging').val(),$('#txtEditAfterPackaging').val() == '' ? '0.00' : $('#txtEditAfterFreight').val()));
}
calculateEditTotalValue($('#isEdit').val());
}
}
function validateEditExceedLimit()
{
var avalbudAmt = parseFloat($('#EditAvlBudAmt').val());
var basicAmountRate = parseFloat($('#txtEditBasicValue').val());
var totalAmount = parseFloat($('#txtEditTotalOrderValue').val());
// if(basicAmountRate > avalbudAmt)// || totalAmount > avalbudAmt)
// {
// alert('Basic amount is exceeding the Budget Limit.Please adjust the product value.');
// $('#EditRate').focus();
// return false;
// }
// else
// {
return true;
//}
}
function calculateEditTotalValue()
{
var Packaging = $('#txtEditAfterPackaging').val() == '' ? '0.00' : $('#txtEditAfterPackaging').val();
var AfterCgst = $("#EditAfterCgst").val();
var AfterSgst = $("#EditAfterSgst").val();
var AfterIgst = $("#EditAfterIgst").val();
// alert(AfterIgst);
// alert(AfterSgst);
// alert(AfterCgst);
var Freight = $('#txtEditAfterFreight').val() == '' ? '0.00' : $('#txtEditAfterFreight').val();
var Insurance = $('#txtEditInsurance').val() == '' ? '0.00' : $('#txtEditInsurance').val();
var Discount = $('#txtEditAfterDiscount').val() == '' ? '0.00' : $('#txtEditAfterDiscount').val();
var BasicVal = $('#txtEditBasicValue').val() == '' ? '0.00' : $('#txtEditBasicValue').val();
var getrange= $("input:radio[name='Range']:checked").val();
if(getrange==1)
{
var totvalue = ( parseFloat(BasicVal) + parseFloat(Packaging)+ parseFloat(AfterCgst)+ parseFloat(AfterIgst) + parseFloat(Freight) + parseFloat(Insurance)) - parseFloat(Discount);
}
else
{
var totvalue = ( parseFloat(BasicVal) + parseFloat(Packaging)+ parseFloat(AfterCgst)+ parseFloat(AfterSgst) + parseFloat(Freight) + parseFloat(Insurance)) - parseFloat(Discount);
}
var tot = parseFloat(totvalue).toFixed(2);
$('#txtEditTotalOrderValue').val(tot);
//validateEditExceedLimit();
//ExceedEditQuantityCheck();
}
function calculateViewTotalValue()
{
var Packaging = $('#txtViewAfterPackaging').val() == '' ? '0.00' : $('#txtViewAfterPackaging').val();
var AfterCgst = $("#ViewAfterCGST").val();
var AfterSgst = $("#ViewAfterSGST").val();
var AfterIgst = $("#ViewAfterIGST").val();
// alert(AfterIgst);
// alert(AfterSgst);
// alert(AfterCgst);
var Freight = $('#txtViewAfterFreight').val() == '' ? '0.00' : $('#txtViewAfterFreight').val();
var Insurance = $('#txtViewInsurance').val() == '' ? '0.00' : $('#txtViewInsurance').val();
var Discount = $('#txtViewAfterDiscount').val() == '' ? '0.00' : $('#txtViewAfterDiscount').val();
var BasicVal = $('#txtViewBasicValue').val() == '' ? '0.00' : $('#txtViewBasicValue').val();
var getrange= $("input:radio[name='Range']:checked").val();
if (getrange==1)
{
var totvalue = ( parseFloat(BasicVal) + parseFloat(Packaging)+ parseFloat(AfterCgst)+ parseFloat(AfterIgst) + parseFloat(Freight) + parseFloat(Insurance)) - parseFloat(Discount);
}
else
{
var totvalue = ( parseFloat(BasicVal) + parseFloat(Packaging)+ parseFloat(AfterCgst)+parseFloat(AfterSgst)+ parseFloat(Freight) + parseFloat(Insurance)) - parseFloat(Discount);
}
var tot = parseFloat(totvalue).toFixed(2);
$('#txtViewTotalOrderValue').val(tot);
//validateEditExceedLimit();
//ExceedEditQuantityCheck();
}
function calculateEditTaxValue()
{
var Packaging = $('#txtEditAfterPackaging').val() == '' ? '0.00' : $('#txtEditAfterPackaging').val();
var AfterCgst = $("#EditAfterCgst").val();
var AfterSgst = $("#EditAfterSgst").val();
var AfterIgst = $("#EditAfterIgst").val();
var Freight = $('#txtEditAfterFreight').val() == '' ? '0.00' : $('#txtEditAfterFreight').val();
var Insurance = $('#txtEditInsurance').val() == '' ? '0.00' : $('#txtEditInsurance').val();
var Discount = $('#txtEditAfterDiscount').val() == '' ? '0.00' : $('#txtEditAfterDiscount').val();
var totvalue = parseFloat(AfterCgst)+ parseFloat(AfterSgst) + parseFloat(AfterIgst);
var tot = parseFloat(totvalue).toFixed(2);
//alert('tot:'+tot);
return tot;
}
</script>
<style>
.pagination {
margin :0px ! important;
}
.box-body {
padding:0px ! important;
}
.num {
text-align:right;
}
</style>
<div class="content-wrapper">
<?php
$attributes = array('class' => 'form-label-left CreatePO ','name' => 'CreatePO','id' => 'CreatePO');
echo form_open($this->config->base_url().'/purchaseorder/addPO/',$attributes); ?>
<section class="content">
<div style="border:2px solid #333">
<div id="content"></div>
<div>
<center><b><h2>Siddharth Industries - Edit Revenue Purchase Order - <?php echo $PONO;?></h2></b></center></div>
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<div class="col-md-3">
<div class="col-md-12" style="padding:0px;">
<label>Requistion No</label>
<?php
$options = array("0"=>'Selected Requisition Numbers');
if(!empty($ReqList))
{
foreach ($ReqList as $SID):
$options[$SID->ReqNo] = $SID->ReqNo ;
//$ReqType = $SID->ReqType;
endforeach;
}
echo form_multiselect('RequistionNo', $options,set_value('RequistionNo'),'id="RequistionNo"' ,'required="true"' , 'height="400px"' );
?>
</div>
<div class="col-md-12" style="padding:0px;">
<label>Purchase Order Date</label>
<div class="form-group">
<?php
$data = array('name' => 'PODate','value' => set_value('PODate',$PODate),'id'=>'PODate', 'class' => 'form-control num' ,'required' => 'true','onkeypress'=>'return false;');
echo form_input($data);
?> <input type="hidden" name="b4podate" id="b4podate" value="<?php echo $PODate;?>">
</div>
</div>
</div>
<div class="col-md-9">
<div class="row">
<div class="col-md-4">
<label>Select Supplier<span class="badge" style="color:red;text-align:right;background-color: #ecf0f5;">*</span></label>
<?php
$options = array("0"=>'Select Supplier');
//print_r( $options);
if(!empty($Suplist))
{
foreach ($Suplist as $SID):
$options[$SID->SupplierID] = $SID->SupplierID.' '.' - '.' '.$SID->SupplierName;
endforeach;
}
echo form_dropdown('drpSupplier', $options,set_value('drpSupplier',$SupId),'id="drpSupplier"' ,'required="true"' ,'class="form-control select2');
?> <input type="hidden" name="b4supplier" id="b4supplier" value="<?php echo $SupId;?>">
<input type="hidden" name="newsup" id="changeSup">
</div>
<div class="col-md-4">
<label>Purchase Order Type</label>
<div class="form-group">
<?php
$data = array('name' => 'POType','value' => set_value('POType',REVENUE),'id'=>'POType', 'class' => 'form-control' ,'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-2" style="padding:0px;">
<div id="div1" style="display:block;">
<b><u>Select Tax Range</u></b><br/>
<tr>
<td>
<?php echo form_label('Local', 'Local') . "&nbsp;&nbsp;". form_radio(array('name' => 'Range', 'value' => '0', 'checked' => ('0' == $CapitalRange) ? TRUE : FALSE, 'id' => 'Local','onchange'=>'SetVatorCST();')); ?>
</td>
<td>
<?php echo form_label('Inter state', 'Inter state') . "&nbsp;&nbsp;". form_radio(array('name' => 'Range', 'value' => '1', 'checked' => ('1' == $CapitalRange) ? TRUE : FALSE, 'id' => 'Inter_state','onchange'=>'SetVatorCST();')); ?>
</td>
</tr>
</div>
<div id="div2" style="display:none;">
</div>
<div id="div4" style="display:none;">
</div>
</div>
<div class="col-md-2" style="padding:0px;">
<b><u>Select Delivery By<span class="badge" style="color:red;text-align:right;background-color: #ecf0f5;">*</span></u></b><br/>
<tr>
<td>
<?php echo form_label('Date', 'Date') . "&nbsp;&nbsp;". form_radio(array('name' => 'DateRange', 'value' => '0', 'checked' => ('0' == $DeliverOption) ? TRUE : FALSE, 'id' => 'Date')); ?> </td>
<td>
<?php echo form_label('Schedule', 'Schedule') . form_radio(array('name' => 'DateRange', 'value' => '1', 'checked' => ('1' == $DeliverOption) ? TRUE : FALSE, 'id' => 'Schedule')); ?>
</td>
</tr>
</div>
</div>
<div class="row">
<div class="col-md-4">
<label>Supplier Address</label>
<div class="form-group">
<?php
$data = array('name' => 'SupAddress','value' => set_value('SupAddress',$Address),'id'=>'SupAddress', 'class' => 'form-control' ,'readonly' => 'true' ,'rows' => '3', 'cols' => '40');
echo Form_textarea($data);
?>
</div>
</div>
<div class="col-md-4">
<label>Delivery Address</label>
<div class="form-group">
<?php
$data = array('name' => 'DeliveryAddr','value' => set_value('DeliveryAddr',$DeliveryAddress),'id'=>'DeliveryAddr', 'class' => 'form-control' ,'required' => 'true' ,'rows' => '3', 'cols' => '40');
echo Form_textarea($data);
?> <input type="hidden" name="txtDeliveryAddress" id="txtDeliveryAddress" value="<?php echo $DeliveryAddress;?>">
</div>
</div>
<div class="col-md-4" id="Deliverydtdiv">
<label>Delivery Date<span class="badge" style="color:red;text-align:right;background-color: #ecf0f5;">*</span></label>
<div class="form-group">
<?php
$data = array('name' => 'Deliverydt','value' => set_value('Deliverydt',$Deliverydt),'id'=>'Deliverydt', 'class' => 'form-control num' ,'required' => 'true','onkeypress'=>'return false;');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-4" id="Schedulediv" style="display:none;">
<label >Schedule By<span class="badge" style="color:red;text-align:right;background-color: #ecf0f5;">*</span></label>
<?php
$data = array('name' => 'Scheduleby','value' => set_value('Scheduleby',$DeliverSchedule),'id'=>'Scheduleby', 'class' => 'form-control' ,'required' => 'true' ,'rows' => '3', 'cols' => '40', 'maxlength' => '110');
echo Form_textarea($data);
?>
</div>
</div>
</div>
<!--start new fields 1 sep-->
<div class="row">
<div class="col-md-12">
<div class="col-md-3">
<div class="col-md-12" style="padding: 0px;">
<label>Mode Of Shipment</label>
<div class="form-group">
<?php
$data = array('name' => 'editmodeofshipment','value' => set_value('editmodeofshipment',$modeofshipment),'id'=>'editmodeofshipment', 'class' => 'form-control');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="col-md-9" style="padding:0px;">
<div class="col-md-4" style="padding:0px;" >
<div class="col-md-12">
<label>Contact Reference</label>
<div class="form-group">
<?php
$data = array('name' => 'editsupplierreference','value' => set_value('editsupplierreference',$supplierref),'id'=>'editsupplierreference', 'class' => 'form-control', 'maxlength'=>'40');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="col-md-4" style="padding:0px;">
<div class="col-md-12">
<label>Supplier's Offer No</label>
<div class="form-group">
<?php
$data = array('name' => 'editsupplierofferno','value' => set_value('editsupplierofferno',$suppofferno),'id'=>'editsupplierofferno', 'class' => 'form-control');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="col-md-4" style="padding:0px;">
<div class="col-md-6" style="padding-right: 0px;">
<label>Our Reference(S)</label>
<div class="form-group">
<?php
$data = array('name' => 'editotherreference','value' => set_value('editotherreference',$otherref),'id'=>'editotherreference', 'class' => 'form-control');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-6">
<label>Fincap</label>
<div class="form-group">
<?php
$data = array('name' => 'editfincap','value' => set_value('editfincap',$fincap),'id'=>'editfincap', 'class' => 'form-control');
echo form_input($data);
?>
</div>
</div>
</div>
</div>
</div>
</div><!--End new fields 1 sep-->
<!--start new fields 1 sep-->
<div class="row">
<div class="col-md-12">
<div class="col-md-3">
<div class="col-md-6" style="padding: 0px;">
<label>Revenue Type Options</label>
<div class="form-group">
<?php
//$optionsWork = array("0"=>'Select Work Status');
if(!empty($PoTypeOptions))
{
foreach ($PoTypeOptions as $POpt):
if($revenuesubtype==$POpt->ConfigValue){
$optionsPO[$POpt->ConfigValue] = $POpt->ConfigValue;
}
endforeach;
foreach ($PoTypeOptions as $POpt1):
if($revenuesubtype!=$POpt1->ConfigValue){
$optionsPO[$POpt1->ConfigValue] = $POpt1->ConfigValue;
}
endforeach;
}
echo form_dropdown('PoTypeOptions', $optionsPO,set_value('PoTypeOptions'),'id="PoTypeOptions"' ,'required="true"' ,'class="form-control select2');
?>
</div>
</div>
<div class="col-md-6" style="padding-right: 0px;">
<label for="insurance">Insurance Options</label>
<?php
$optionsnew=array('1'=>'Yes','0'=>'No');
echo form_dropdown('insurancestatus', $optionsnew,set_value('insurancestatus'),'id="insurancestatus"' ,'required="true"' ,'class="form-control select2');
?>
</div>
</div>
<div class="col-md-9" style="padding:0px;">
<div class="col-md-4" id="insurancenodiv" style="display:block;">
<label>Insurance Details<span class="badge" style="color:red;text-align:right;background-color: #ecf0f5 ;">*</span></label>
<div class="form-group">
<?php
$data = array('name' => 'insuranceno','insuranceno' => set_value('insuranceno',$insurenceno),'id'=>'insuranceno', 'class' => 'form-control' ,'required' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-4">
<label>Payment Terms</label>
<?php
if(!empty($Payment))
{
foreach ($Payment as $pay):
$options6[$pay->PaymentID] = $pay->PaymentTerms;
endforeach;
}
echo form_dropdown('PaymentTerms', $options6,set_value('PaymentTerms',$Terms),'id="PaymentTerms"' ,'required="true"' ,'class="form-control select2');
?>
</div>
<div class="col-md-4" id="otheroptiondiv" style="display:none;">
<label>Description of Payable Terms<span class="badge" style="color:red;text-align:right;background-color: #ecf0f5 ;">*</span></label>
<div class="form-group">
<?php
$data = array('name' => 'Otherpayment','Otherpayment' => set_value('Otherpayment'),'id'=>'Otherpayment', 'class' => 'form-control' ,'required' => 'true');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="col-md-2" style="padding-right: 0px;">
<label for="BudgetType">Budget Type</label>
<select id='BudgetType' name='BudgetType'>
<?php if($BudgetType== 'CAPITAL')
{
$opt1='CAPITAL';
$opt2='REVENUE';
}
else
{
$opt1='REVENUE';
$opt2='CAPITAL';
} ?>
<option value=<?php echo $opt1;?>><?php echo $opt1;?></option>
<option value=<?php echo $opt2;?>><?php echo $opt2;?></option>
</select>
</div>
</div>
</div>
</div>
<!-- Modal for Packing Calculation -->
<div id="packagingcalmodel" class="modal fade" data-backdrop-limit="1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" >
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Packing Calculation On</h4>
</div>
<div class="modal-body">
<form>
<div class="radio">
<label><input type="radio" name="optPackaging" checked="checked" value='0' id="optPackaging"> Basic Amount</label>
</div>
<div class="radio">
<label><input type="radio" name="optPackaging" id="optPackaging" value='1' > After Discount Amount</label>
</div>
</form>
</div>
<div class="modal-footer">
<a class="btn btn-primary" ID="PackagingOption" onclick="SetPackagingOption();" style="margin-top: -24px;">&nbsp;&nbsp;<span class="bold">Ok</span></a>
<a class="btn btn-primary" data-dismiss="modal" style="margin-top: -24px;" value="Cancel">Cancel</a>
</div>
</div>
</div>
</div>
<div id="freightcalmodel" class="modal fade" data-backdrop-limit="1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" >
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Freight Calculation On</h4>
</div>
<div class="modal-body">
<form>
<div class="radio">
<label><input type="radio" name="optfreight" checked="checked" value='0' id="optfreight"> Basic Amount</label>
</div>
<div class="radio">
<label><input type="radio" name="optfreight" id="optfreight" value='1' > After Discount Amount</label>
</div>
</form>
</div>
<div class="modal-footer">
<a class="btn btn-primary" ID="freightOption" onclick="SetfreightOption();" style="margin-top: -24px;">&nbsp;&nbsp;<span class="bold">Ok</span></a>
<a class="btn btn-primary" data-dismiss="modal" style="margin-top: -24px;" value="Cancel">Cancel</a>
</div>
</div>
</div>
</div>
<div id="viewcalmodel" class="modal fade" data-backdrop-limit="1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" >
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Packing Calculation On</h4>
</div>
<div class="modal-body">
<form>
<div class="radio">
<label><input type="radio" name="optview" checked="checked" value='0' id="optview"> Basic Amount</label>
</div>
<div class="radio">
<label><input type="radio" name="optview" id="optview" value='1' > After Discount Amount</label>
</div>
</form>
</div>
<div class="modal-footer">
<a class="btn btn-primary" ID="PackagingOption" onclick="SetPackagingOption();" style="margin-top: -24px;">&nbsp;&nbsp;<span class="bold">Ok</span></a>
<a class="btn btn-primary" data-dismiss="modal" style="margin-top: -24px;" value="Cancel">Cancel</a>
</div>
</div>
</div>
</div>
</div>
<!-- Modal for Excise Duty Calculation-->
<div class="modal fade" id="ExciseDutyCalModel" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Excise Duty Calculation On</h4>
</div>
<div class="modal-body">
<form>
<div class="radio">
<label><input type="radio" name="optExcise" checked="checked" value="0" id="optExcise">From Basic Amount</label>
</div>
<div class="radio">
<label><input type="radio" name="optExcise" value="1" id="optExcise">Basic Amount - Discount Amount</label>
</div>
<div class="radio">
<label><input type="radio" name="optExcise" value="2" id="optExcise">(Basic Amount - Discount Amount ) + Packing Cost</label>
</div>
<div class="radio">
<label><input type="radio" name="optExcise" value="3" id="optExcise">Basic Amount + Packing Cost</label>
</div>
</form>
</div>
<div class="modal-footer">
<a class="btn btn-primary" ID="ExciseOption" onclick="SetExciseCalculation();" style="margin-top: -24px;">&nbsp;&nbsp;<span class="bold">Ok</span></a>
<a class="btn btn-primary" data-dismiss="modal" style="margin-top: -24px;" value="Cancel">Cancel</a>
</div>
</div>
</div>
</div>
<!-- Modal for Vat Calculation -->
<div class="modal fade" id="VatCalModel" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Vat Calculation On</h4>
</div>
<div class="modal-body">
<form>
<div class="radio">
<label><input type="radio" name="optVat" checked="checked" value="0" id="optVat">Basic Amount</label>
</div>
<div class="radio">
<label><input type="radio" name="optVat" value="1" id="optVat">Excise Duty</label>
</div>
</form>
</div>
<div class="modal-footer">
<a class="btn btn-primary" ID="VatOption" onclick="SetVatCalculation();" style="margin-top: -24px;">&nbsp;&nbsp;<span class="bold">Ok</span></a>
<a class="btn btn-primary" data-dismiss="modal" style="margin-top: -24px;" value="Cancel">Cancel</a>
</div>
</div>
</div>
</div>
<!-- Modal for CST Calculation -->
<div class="modal fade" id="CSTCalModel" role="dialog">
<div class="modal-dialog">
<!-- Modal for CST Calculation-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">CST Calculation On</h4>
</div>
<div class="modal-body">
<form>
<div class="radio">
<label><input type="radio" name="optCST" checked="checked" value="0" id="optCST">Basic Amount</label>
</div>
<div class="radio">
<label><input type="radio" name="optCST" value="1" id="optCST">Excise Duty</label>
</div>
</form>
</div>
<div class="modal-footer">
<a class="btn btn-primary" ID="CSTOption" onclick="SetCSTCalculation();" style="margin-top: -24px;">&nbsp;&nbsp;<span class="bold">Ok</span></a>
<a class="btn btn-primary" data-dismiss="modal" style="margin-top: -24px;" value="Cancel">Cancel</a>
</div>
</div>
</div>
</div>
<div class="container-fluid">
<div align="right">
<div align="right">
<?php
if($PONOStatus == PO_RELEASED)
{?>
<?php }
else if($PONOStatus==PO_DRAFT ||$PONOStatus==PO_CREATED || $PONOStatus==PO_APPROVED)
{?>
<a data-toggle="modal" ><button type="submit" onclick="myFunction();" class="btn btn-primary" id="abcd" >Select Line Item</button> </a>
<?php
}?>
</div>
<!-- Model for revenue po -->
<div id="REVENUE" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="overflow-y:scroll !important">
<div class="modal-dialog">
<!-- Modal content-->
<form>
<div class="modal-content" style="width:1070px;">
<div class="modal-header" style="background-color: #3c8dbc;color:#fff;">
<center><h4>Select Revenue Purchase Order Line Item </h4></center>
</div>
<div align="left">
<div>
<div class="col-md-12" >
<div class="col-md-3">
<label>Req No<span class="badge" style="color:red;text-align:right;background-color: #fff;">*</span></label>
<div >
<?php
$RL = array("0"=>'Select Req No');
if(!empty($RequistionDetails))
{
foreach ($RequistionDetails as $SID):
$RL[$SID->ReqNo] = $SID->ReqNo.' '.' - '.' '.$SID->DepartmentName;
endforeach;
}
echo form_dropdown('ReqNo', $RL,set_value('ReqNo'),'id="ReqNo"' ,'class="form-control"');
?>
</div>
</div>
<div class="col-md-3">
<label>Department Name</label>
<div class="form-group">
<?php
$data = array('name' => 'deptName','value' => set_value('deptName'),'id'=>'deptName', 'class' => 'form-control' ,'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-3">
<label>Cost Center Code</label>
<div class="form-group">
<?php
$data = array('name' => 'CostCenter','value' => set_value('CostCenter'),'id'=>'CostCenter', 'class' => 'form-control' ,'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-3">
<label>Avl Bud Amt <?php echo "($INRSYM)"?></label>
<div class="form-group">
<?php
$data = array('name' => 'AvlBudAmt','value' => set_value('AvlBudAmt'),'id'=>'AvlBudAmt', 'class' => 'form-control num' ,'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-2">
<label>Item Code<span class="badge" style="color:red;text-align:right;background-color: #fff;">*</span></label>
<div >
<?php
$options = array("0"=>'Item Code');
echo form_dropdown('MaterialCode', $options,set_value('MaterialCode'),'id="MaterialCode"' ,'class="form-control"');
?>
</div>
</div>
<div class="col-md-2">
<label>Item Name</label>
<div class="form-group">
<?php
$data = array('name' => 'ItemName','value' => set_value('ItemName'),'id'=>'ItemName', 'class' => 'form-control' ,'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-2">
<label>UOM</label>
<div class="form-group">
<?php
$data = array('name' => 'UOM','value' => set_value('UOM'),'id'=>'UOM', 'class' => 'form-control' ,'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-6" style="padding:0px;">
<div class="col-md-3">
<label>Quantity<span class="badge" style="color:red;text-align:right;background-color: #fff;">*</span></label>
<div class="form-group">
<?php
$data = array('name' => 'Quantity','value' => set_value('Quantity'),'id'=>'Quantity', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);','onchange'=>'change();');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-3">
<label><?php echo "Rate ($INRSYM)";?><span class="badge" style="color:red;text-align:right;background-color: #fff;">*</span></label>
<div class="form-group">
<?php
$data = array('name' => 'Rate','value' => set_value('Rate'),'id'=>'Rate', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);','onchange'=>'change();' );
echo form_input($data);
?>
</div>
</div>
<div class="col-md-3">
<label>Per</label> <?php
$data = array('name' => 'AddPer','value' => set_value('AddPer'),'id'=>'AddPer', 'class' => 'form-control');
echo form_input($data); ?>
</div>
<div class="col-md-3">
<label><?php echo "Basic Amt ($INRSYM)";?></label>
<div class="form-group">
<?php
$data = array('name' => 'txtBasicValue','value' => set_value('txtBasicValue'),'id'=>'txtBasicValue', 'class' => 'form-control num' ,'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
</div>
</div>
</div><br/>
<div class="col-md-12" style="padding:0px;">
<div class="col-md-12">
<div class="col-md-4">
<label>Discount Type </label>
<div>
<?php
$options = array("0"=>'Select Discount Type');
//print_r( $options);
if(!empty($TaxType))
{
foreach ($TaxType as $SID):
$options[$SID->ConfigValue] = $SID->ConfigValue;
endforeach;
}
echo form_dropdown('DiscountType', $options,set_value('DiscountType'),'id="DiscountType"' ,'class="form-control"');
?>
</div>
</div>
<div class="col-md-2">
<label>Discount Rate </label>
<div class="form-group">
<?php
$data = array('name' => 'txtDiscount','value' => set_value('txtDiscount'),'id'=>'txtDiscount', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);' ,'onchange'=>'change();calculateDiscount(0);');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-2">
<label>Discounted Amt <?php echo "($INRSYM)"?></label>
<div class="form-group">
<?php
$data = array('name' => 'txtAfterDiscount','value' => set_value('txtAfterDiscount'),'id'=>'txtAfterDiscount', 'class' => 'form-control num' ,'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-2" >
<label>CGST In %</label>
<div class="form-group">
<?php
$data = array('name' => 'Cgst','value' => set_value('Cgst',0),'id'=>'Cgst', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);' ,'onchange'=>'change();RevenueChangeSgst();');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-2" >
<label>CGST Amt <?php echo "($INRSYM)"?></label>
<div class="form-group">
<?php
$data = array('name' => 'AfterCgst','value' => set_value('AfterCgst',0),'id'=>'AfterCgst', 'class' => 'form-control num' ,'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="col-md-12" style="text-align:left;">
<div class="col-md-4">
<label>Packaging Type </label>
<div>
<?php
$options = array("0"=>'Select Packaging Type');
//print_r( $options);
if(!empty($TaxType))
{
foreach ($TaxType as $SID):
$options[$SID->ConfigValue] = $SID->ConfigValue;
endforeach;
}
echo form_dropdown('PackagingType', $options,set_value('PackagingType'),'id="PackagingType"' ,'class="form-control "');
?>
</div>
</div>
<div class="col-md-2">
<label>Packaging Rate </label>
<div class="form-group">
<?php
$data = array('name' => 'txtPackaging','value' => set_value('txtPackaging'),'id'=>'txtPackaging', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);','onchange'=>'change();');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-2">
<label>Packaging Amt <?php echo "($INRSYM)"?></label>
<div class="form-group">
<?php
$data = array('name' => 'txtAfterPackaging','value' => set_value('txtAfterPackaging'),'id'=>'txtAfterPackaging', 'class' => 'form-control num' ,'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div id="SGSTAddModel">
<div class="col-md-2">
<label>SGST In %</label>
<div class="form-group">
<?php
$data = array('name' => 'Sgst','value' => set_value('Sgst',0),'id'=>'Sgst', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);','onchange'=>'change();');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-2">
<label>SGST Amt <?php echo "($INRSYM)"?></label>
<div class="form-group">
<?php
$data = array('name' => 'AfterSgst','value' => set_value('AfterSgst',0),'id'=>'AfterSgst', 'class' => 'form-control num' ,'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
</div>
<div id="IGSTAddModel" style="display:none;">
<div class="col-md-2">
<label>IGST In %</label>
<div class="form-group">
<?php
$data = array('name' => 'Igst','value' => set_value('Igst',0),'id'=>'Igst', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);' ,'onchange'=>'change();');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-2">
<label>IGST Amt <?php echo "($INRSYM)"?></label>
<div class="form-group">
<?php
$data = array('name' => 'AfterIgst','value' => set_value('AfterIgst',0),'id'=>'AfterIgst', 'class' => 'form-control num' ,'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
</div>
</div>
<div class="col-md-12" >
<div class="col-md-2">
<label>Freight Type </label>
<div>
<?php
$options = array("0"=>'Select Freight Type');
//print_r( $options);
if(!empty($FreightType))
{
foreach ($FreightType as $SID):
$options[$SID->ConfigValue] = $SID->ConfigValue;
endforeach;
}
echo form_dropdown('drpFreight', $options,set_value('drpFreight'),'id="drpFreight"' ,'class="form-control "');
?>
</div>
</div>
<div class="col-md-2" id="TripsValue" style="display:none;">
<label>NO Of Trips</label>
<div class="form-group">
<?php
$data = array('name' => 'NOOfTrips','value' => set_value('NOOfTrips'),'id'=>'NOOfTrips', 'class' => 'form-control num','onchange'=>'calculateFreight(0);' );
echo form_input($data);
?>
</div>
</div>
<div class="col-md-2">
<label>Freight Rate </label>
<div class="form-group">
<?php
$data = array('name' => 'txtFreight','value' => set_value('txtFreight'),'id'=>'txtFreight', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);','onchange'=>'change();');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-2">
<label>Freight Amt <?php echo "($INRSYM)"?></label>
<div class="form-group">
<?php
$data = array('name' => 'txtAfterFreight','value' => set_value('txtAfterFreight'),'id'=>'txtAfterFreight', 'class' => 'form-control num' ,'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-4">
<label> Insurance <?php echo "($INRSYM)"?> (if Any)</label>
<div class="form-group">
<?php
$data = array('name' => 'txtInsurance','value' => set_value('txtInsurance'),'id'=>'txtInsurance', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);','onchange'=>'calculateTotalValue(0);');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="col-md-12" >
<div class="col-md-4 ">
<label><?php echo "Total Order Amt ($INRSYM)";?></label>
<div class="form-group">
<?php
$data = array('name' => 'txtTotalOrderValue','value' => set_value('txtTotalOrderValue'),'id'=>'txtTotalOrderValue', 'class' => 'form-control num' ,'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-12">
<label><?php echo "Revenue Description";?></label>
<div class="form-group">
<?php
$data = array('name' => 'Add_Service_Description','value' => set_value('Add_Service_Description'),'id'=>'Add_Service_Description', 'class' => 'form-control','rows'=>'2','cols'=>'100');
echo form_textarea($data);;
?>
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-3 col-md-offset-9"><br/>
<a class="btn btn-primary font AddRevenue" ID="AddRevenue">&nbsp;&nbsp;<span class="bold">Add Revenue</span></a> &nbsp;&nbsp;&nbsp;&nbsp;<a class="btn btn-primary" data-dismiss="modal" value="Cancel">Cancel</a>
</div>
</div>
</div>
<br/><br/>
<!-- footer for revenue po -->
<div class="modal-footer">
</div>
</div>
</div>
</form>
</div>
</div>
<br/>
<div id="EDITREVENUE" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="overflow-y:scroll !important">
<div class="modal-dialog">
<!-- Modal content-->
<form>
<div class="modal-content" style="width:1070px;">
<div class="modal-header" style="background-color: #3c8dbc;color:#fff;">
<center><h4>Edit Revenue Purchase Order Line Item </h4></center>
</div>
<div align="left">
<div>
<div class="col-md-12" >
<div class="col-md-3">
<label>Req No<span class="badge" style="color:red;text-align:right;background-color: #fff;">*</span></label>
<div >
<?php
$data = array('name' => 'EditReqNo','value' => set_value('EditReqNo'),'id'=>'EditReqNo', 'class' => 'form-control' ,'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-3">
<label>Department Name</label>
<div class="form-group">
<?php
$data = array('name' => 'EditdeptName','value' => set_value('EditdeptName'),'id'=>'EditdeptName', 'class' => 'form-control' ,'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-3">
<label>Cost Center Code</label>
<div class="form-group">
<?php
$data = array('name' => 'EditCostCenter','value' => set_value('EditCostCenter'),'id'=>'EditCostCenter', 'class' => 'form-control' ,'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-3">
<label>Avl Bud Amt <?php echo "($INRSYM)"?></label>
<div class="form-group">
<?php
$data = array('name' => 'EditAvlBudAmt','value' => set_value('EditAvlBudAmt'),'id'=>'EditAvlBudAmt', 'class' => 'form-control num' ,'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-2">
<label>Item Code<span class="badge" style="color:red;text-align:right;background-color: #fff;">*</span></label>
<div >
<?php
$options = array("0"=>'Item Code');
echo form_dropdown('EditMaterialCode', $options,set_value('EditMaterialCode'),'id="EditMaterialCode"' ,'class="form-control"');
?>
</div>
</div>
<div class="col-md-2">
<label>Item Name</label>
<div class="form-group">
<?php
$data = array('name' => 'EditItemName','value' => set_value('EditItemName'),'id'=>'EditItemName', 'class' => 'form-control' ,'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-2">
<label>UOM</label>
<div class="form-group">
<?php
$data = array('name' => 'EditUOM','value' => set_value('EditUOM'),'id'=>'EditUOM', 'class' => 'form-control' ,'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-6" style="padding: 0px;">
<div class="col-md-3">
<label>Quantity<span class="badge" style="color:red;text-align:right;background-color: #fff;">*</span></label>
<div class="form-group">
<?php
$data = array('name' => 'EditQuantity','value' => set_value('EditQuantity'),'id'=>'EditQuantity', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);','onchange'=>'Editchange();','style'=>'text-align:right;');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-3">
<label><?php echo "Rate ($INRSYM)";?><span class="badge" style="color:red;text-align:right;background-color: #fff;">*</span></label>
<div class="form-group">
<?php
$data = array('name' => 'EditRate','value' => set_value('EditRate'),'id'=>'EditRate', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);','onchange'=>'Editchange();','style'=>'text-align:right;' );
echo form_input($data);
?>
</div>
</div>
<div class="col-md-3">
<label>Per</label> <?php
$data = array('name' => 'EditPer','value' => set_value('EditPer'),'id'=>'EditPer', 'class' => 'form-control');
echo form_input($data); ?>
</div>
<div class="col-md-3">
<label><?php echo "Basic Amt ($INRSYM)";?></label>
<div class="form-group">
<?php
$data = array('name' => 'txtEditBasicValue','value' => set_value('txtEditBasicValue'),'id'=>'txtEditBasicValue', 'class' => 'form-control num' ,'readonly' => 'true','style'=>'text-align:right;');
echo form_input($data);
?>
</div>
</div>
</div>
</div>
</div><br/>
<div class="col-md-12">
<div class="col-md-4">
<label>Discount Type </label>
<div>
<?php
$options = array("0"=>'Select Discount Type');
//print_r( $options);
if(!empty($TaxType))
{
foreach ($TaxType as $SID):
$options[$SID->ConfigValue] = $SID->ConfigValue;
endforeach;
}
echo form_dropdown('EditDiscountType', $options,set_value('EditDiscountType'),'id="EditDiscountType"' ,'class="form-control"');
?>
</div>
</div>
<div class="col-md-2">
<label>Discount Rate </label>
<div class="form-group">
<?php
$data = array('name' => 'txtEditDiscount','value' => set_value('txtEditDiscount'),'id'=>'txtEditDiscount', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);' ,'onchange'=>'Editchange();calculateDiscount(1);','style'=>'text-align:right;');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-2">
<label>Discounted Amt <?php echo "($INRSYM)"?> </label>
<div class="form-group">
<?php
$data = array('name' => 'txtEditAfterDiscount','value' => set_value('txtEditAfterDiscount'),'id'=>'txtEditAfterDiscount', 'class' => 'form-control num' ,'readonly' => 'true','style'=>'text-align:right;');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-2" >
<label>CGST In %</label>
<div class="form-group">
<?php
$data = array('name' => 'EditCgst','value' => set_value('EditCgst',0),'id'=>'EditCgst', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);','onchange'=>'Editchange();RevenueChangeEditSgst();');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-2" >
<label>CGST Amt <?php echo "($INRSYM)"?></label>
<div class="form-group">
<?php
$data = array('name' => 'EditAfterCgst','value' => set_value('EditAfterCgst',0),'id'=>'EditAfterCgst', 'class' => 'form-control num' ,'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="col-md-12" style="text-align:left;">
<div class="col-md-4">
<label>Packaging Type </label>
<div>
<?php
$options = array("0"=>'Select Packaging Type');
//print_r( $options);
if(!empty($TaxType))
{
foreach ($TaxType as $SID):
$options[$SID->ConfigValue] = $SID->ConfigValue;
endforeach;
}
echo form_dropdown('EditPackagingType', $options,set_value('EditPackagingType'),'id="EditPackagingType"' ,'class="form-control "');
?>
</div>
</div>
<div class="col-md-2">
<label>Packaging Rate </label>
<div class="form-group">
<?php
$data = array('name' => 'txtEditPackaging','value' => set_value('txtEditPackaging'),'id'=>'txtEditPackaging', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);','onchange'=>'Editchange();','style'=>'text-align:right;');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-2">
<label>Packaging Amt <?php echo "($INRSYM)"?> </label>
<div class="form-group">
<?php
$data = array('name' => 'txtEditAfterPackaging','value' => set_value('txtEditAfterPackaging'),'id'=>'txtEditAfterPackaging', 'class' => 'form-control num' ,'readonly' => 'true','style'=>'text-align:right;');
echo form_input($data);
?>
</div>
</div>
<div id="SGSTEditModel">
<div class="col-md-2">
<label>SGST In %</label>
<div class="form-group">
<?php
$data = array('name' => 'EditSgst','value' => set_value('EditSgst',0),'id'=>'EditSgst', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);','onchange'=>' Editchange();');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-2">
<label>SGST Amt <?php echo "($INRSYM)"?></label>
<div class="form-group">
<?php
$data = array('name' => 'EditAfterSgst','value' => set_value('EditAfterSgst',0),'id'=>'EditAfterSgst', 'class' => 'form-control num' ,'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
</div>
<div id="IGSTEditModel" style="display:none;">
<div class="col-md-2">
<label>IGST In %</label>
<div class="form-group">
<?php
$data = array('name' => 'EditIgst','value' => set_value('EditIgst',0),'id'=>'EditIgst', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);','onchange'=>' Editchange();');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-2">
<label>IGST Amt <?php echo "($INRSYM)"?></label>
<div class="form-group">
<?php
$data = array('name' => 'EditAfterIgst','value' => set_value('EditAfterIgst',0),'id'=>'EditAfterIgst', 'class' => 'form-control num' ,'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-2">
<label>Freight Type </label>
<div>
<?php
$options = array("0"=>'Select Freight Type');
//print_r( $options);
if(!empty($FreightType))
{
foreach ($FreightType as $SID):
$options[$SID->ConfigValue] = $SID->ConfigValue;
endforeach;
}
echo form_dropdown('drpEditFreight', $options,set_value('drpEditFreight'),'id="drpEditFreight"' ,'class="form-control "');
?>
</div>
</div>
<div class="col-md-2" id="EditTripsValue" style="display:none;">
<label>NO Of Trips</label>
<div class="form-group">
<?php
$data = array('name' => 'EditNOOfTrips','value' => set_value('EditNOOfTrips'),'id'=>'EditNOOfTrips', 'class' => 'form-control num' ,'onchange'=>'calculateFreight(1);');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-2">
<label>Freight Rate </label>
<div class="form-group">
<?php
$data = array('name' => 'txtEditFreight','value' => set_value('txtEditFreight'),'id'=>'txtEditFreight', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);','onchange'=>'Editchange();','style'=>'text-align:right;');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-2">
<label>Freight Amt <?php echo "($INRSYM)"?></label>
<div class="form-group">
<?php
$data = array('name' => 'txtEditAfterFreight','value' => set_value('txtEditAfterFreight'),'id'=>'txtEditAfterFreight', 'class' => 'form-control num' ,'readonly' => 'true','style'=>'text-align:right;');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-4">
<label> Insurance Amt <?php echo "($INRSYM)"?> (if Any)</label>
<div class="form-group">
<?php
$data = array('name' => 'txtEditInsurance','value' => set_value('txtEditInsurance'),'id'=>'txtEditInsurance', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);','onchange'=>'calculateEditTotalValue(1);','style'=>'text-align:right;');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="col-md-12" >
<div class="col-md-4">
<label><?php echo "Total Order Amt ($INRSYM)";?></label>
<div class="form-group">
<?php
$data = array('name' => 'txtEditTotalOrderValue','value' => set_value('txtEditTotalOrderValue'),'id'=>'txtEditTotalOrderValue', 'class' => 'form-control num' ,'readonly' => 'true','style'=>'text-align:right;');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-12">
<label><?php echo "Revenue Description";?></label>
<div class="form-group">
<?php
$data = array('name' => 'Edit_Service_Description','value' => set_value('Edit_Service_Description'),'id'=>'Edit_Service_Description', 'class' => 'form-control','rows'=>'2','cols'=>'100');
echo form_textarea($data);;
?>
</div>
</div>
</div>
<div class="col-md-3 col-md-offset-9"><br/>
<a class="btn btn-primary EditRevenue" ID="EditRevenue">&nbsp;&nbsp;<span class="bold">Edit Revenue</span></a>&nbsp;&nbsp;&nbsp;&nbsp;<a class="btn btn-primary" data-dismiss="modal" value="Cancel">Cancel</a>
</div>
</div>
<br/><br/>
<!-- footer for revenue po -->
<div class="modal-footer">
</div>
</div>
</div>
</form>
</div>
</div>
</br>
<div id="VIEWREVENUE" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="overflow-y:scroll !important">
<div class="modal-dialog">
<!-- Modal content-->
<form>
<div class="modal-content" style="width:1070px;">
<div class="modal-header" style="background-color: #3c8dbc;color:#fff;">
<center><h4>View Revenue Purchase Order Line Item </h4></center>
</div>
<div align="left">
<div class="col-md-12" >
<div class="col-md-3">
<label>Req No<span class="badge" style="color:red;text-align:right;background-color: #fff;">*</span></label>
<div >
<?php
$data = array('name' => 'ViewReqNo','value' => set_value('ViewReqNo'),'id'=>'ViewReqNo', 'class' => 'form-control' ,'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-3">
<label>Department Name</label>
<div class="form-group">
<?php
$data = array('name' => 'ViewdeptName','value' => set_value('ViewdeptName'),'id'=>'ViewdeptName', 'class' => 'form-control' ,'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-3">
<label>Cost Center Code</label>
<div class="form-group">
<?php
$data = array('name' => 'ViewCostCenter','value' => set_value('ViewCostCenter'),'id'=>'ViewCostCenter', 'class' => 'form-control' ,'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-3">
<label>Avl Bud Amt <?php echo "($INRSYM)"?></label>
<div class="form-group">
<?php
$data = array('name' => 'ViewAvlBudAmt','value' => set_value('ViewAvlBudAmt'),'id'=>'ViewAvlBudAmt', 'class' => 'form-control num' ,'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-2">
<label>Item Code<span class="badge" style="color:red;text-align:right;background-color: #fff;">*</span></label>
<div>
<?php
$data = array('name' => 'ViewMaterialCode','value' => set_value('ViewMaterialCode'),'id'=>'ViewMaterialCode', 'class' => 'form-control num' ,'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-2">
<label>Item Name</label>
<div class="form-group">
<?php
$data = array('name' => 'ViewItemName','value' => set_value('ViewItemName'),'id'=>'ViewItemName', 'class' => 'form-control' ,'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-2">
<label>UOM</label>
<div class="form-group">
<?php
$data = array('name' => 'ViewUOM','value' => set_value('ViewUOM'),'id'=>'ViewUOM', 'class' => 'form-control' ,'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-6" style="padding:0px;">
<div class="col-md-3">
<label>Quantity<span class="badge" style="color:red;text-align:right;background-color: #fff;">*</span></label>
<div class="form-group">
<?php
$data = array('name' => 'ViewQuantity','value' => set_value('ViewQuantity'),'id'=>'ViewQuantity', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);','style'=>'text-align:right;','readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-3">
<label><?php echo "Rate ($INRSYM)";?><span class="badge" style="color:red;text-align:right;background-color: #fff;">*</span></label>
<div class="form-group">
<?php
$data = array('name' => 'ViewRate','value' => set_value('ViewRate'),'id'=>'ViewRate', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);','readonly' => 'true','style'=>'text-align:right;' );
echo form_input($data);
?>
</div>
</div>
<div class="col-md-3">
<label>Per</label> <?php
$data = array('name' => 'ViewPer','value' => set_value('ViewPer'),'id'=>'ViewPer', 'class' => 'form-control','readonly' => 'true');
echo form_input($data); ?>
</div>
<div class="col-md-3">
<label><?php echo "Basic Amt ($INRSYM)";?></label>
<div class="form-group">
<?php
$data = array('name' => 'txtViewBasicValue','value' => set_value('txtViewBasicValue'),'id'=>'txtViewBasicValue', 'class' => 'form-control num' ,'readonly' => 'true','style'=>'text-align:right;');
echo form_input($data);
?>
</div>
</div>
</div>
</div>
<div class="col-md-12" style="padding:0px;">
<div class="col-md-12">
<div class="col-md-4">
<label>Discount Type </label>
<div>
<?php
$data = array('name' => 'ViewDiscountType','value' => set_value('ViewDiscountType'),'id'=>'ViewDiscountType', 'class' => 'form-control num' ,'readonly' => 'true','style'=>'text-align:right;');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-2">
<label>Discount Rate </label>
<div class="form-group">
<?php
$data = array('name' => 'txtViewDiscount','value' => set_value('txtViewDiscount'),'id'=>'txtViewDiscount', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);' ,'style'=>'text-align:right;','readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-2">
<label><?php echo "Discounted Amt In ($INRSYM)";?></label>
<div class="form-group">
<?php
$data = array('name' => 'txtViewAfterDiscount','value' => set_value('txtViewAfterDiscount'),'id'=>'txtViewAfterDiscount', 'class' => 'form-control num' ,'readonly' => 'true','style'=>'text-align:right;','readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-2" >
<label>CGST In %</label>
<div class="form-group">
<?php
$data = array('name' => 'ViewCGST','value' => set_value('tViewCGST'),'id'=>'ViewCGST', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);','onchange'=>'calculateCST(0);','readonly' => 'true',);
echo form_input($data);
?>
</div>
</div>
<div class="col-md-2" >
<label>CGST Amt <?php echo "($INRSYM)"?></label>
<div class="form-group">
<?php
$data = array('name' => 'ViewAfterCGST','value' => set_value('ViewAfterCGST'),'id'=>'ViewAfterCGST', 'class' => 'form-control num' ,'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="col-md-12" style="text-align:left;">
<div class="col-md-4">
<label>Packaging Type </label>
<div>
<?php
$data = array('name' => 'ViewPackagingType','value' => set_value('ViewPackagingType'),'id'=>'ViewPackagingType', 'class' => 'form-control num' ,'readonly' => 'true','style'=>'text-align:right;');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-2">
<label>Packaging Rate </label>
<div class="form-group">
<?php
$data = array('name' => 'txtViewPackaging','value' => set_value('txtViewPackaging'),'id'=>'txtViewPackaging', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);','style'=>'text-align:right;','readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-2">
<label><?php echo "Packaging Amt ($INRSYM)";?> </label>
<div class="form-group">
<?php
$data = array('name' => 'txtViewAfterPackaging','value' => set_value('txtViewAfterPackaging'),'id'=>'txtViewAfterPackaging', 'class' => 'form-control num' ,'readonly' => 'true','style'=>'text-align:right;');
echo form_input($data);
?>
</div>
</div>
<div id="SGSTViewModel">
<div class="col-md-2">
<label>SGST In %</label>
<div class="form-group">
<?php
$data = array('name' => 'ViewSGST','value' => set_value('ViewSGST'),'id'=>'ViewSGST', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);','onchange'=>'calculateGST(0);','readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-2">
<label>SGST Amt <?php echo "($INRSYM)"?></label>
<div class="form-group">
<?php
$data = array('name' => 'ViewAfterSGST','value' => set_value('ViewAfterSGST'),'id'=>'ViewAfterSGST', 'class' => 'form-control num' ,'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
</div>
<div id="IGSTViewModel" style="display:none;">
<div class="col-md-2">
<label>IGST In %</label>
<div class="form-group">
<?php
$data = array('name' => 'ViewIGST','value' => set_value('tViewIGST'),'id'=>'ViewIGST', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);','onchange'=>' calculateGST(0);','readonly' => 'true',);
echo form_input($data);
?>
</div>
</div>
<div class="col-md-2">
<label>IGST Amt <?php echo "($INRSYM)"?></label>
<div class="form-group">
<?php
$data = array('name' => 'ViewAfterIGST','value' => set_value('ViewAfterIGST'),'id'=>'ViewAfterIGST', 'class' => 'form-control num' ,'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
</div>
</div>
<div class="col-md-12" >
<div class="col-md-2">
<label>Freight Type </label>
<div>
<?php
$options = array("0"=>'Select Freight Type');
//print_r( $options);
if(!empty($FreightType))
{
foreach ($FreightType as $SID):
$options[$SID->ConfigValue] = $SID->ConfigValue;
endforeach;
}
echo form_dropdown('drpViewFreight', $options,set_value('drpViewFreight'),'id="drpViewFreight"' ,'class="form-control "');
?>
</div>
</div>
<div class="col-md-2" id="ViewTripsValue" style="display:none;">
<label>NO Of Trips</label>
<div class="form-group">
<?php
$data = array('name' => 'ViewNOOfTrips','value' => set_value('ViewNOOfTrips'),'id'=>'ViewNOOfTrips', 'class' => 'form-control num','onchange'=>'calculateFreight(2);' );
echo form_input($data);
?>
</div>
</div>
<div class="col-md-2">
<label>Freight Rate </label>
<div class="form-group">
<?php
$data = array('name' => 'txtViewFreight','value' => set_value('txtViewFreight'),'id'=>'txtViewFreight', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);','style'=>'text-align:right;','onchange'=>'calculateFreight(2);');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-2">
<label><?php echo "Freight Amt ($INRSYM)";?> </label>
<div class="form-group">
<?php
$data = array('name' => 'txtViewAfterFreight','value' => set_value('txtViewAfterFreight'),'id'=>'txtViewAfterFreight', 'class' => 'form-control num' ,'readonly' => 'true','style'=>'text-align:right;');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-4">
<label> Insurance <?php echo "($INRSYM)"?> (if Any)</label>
<div class="form-group">
<?php
$data = array('name' => 'txtViewInsurance','value' => set_value('txtViewInsurance'),'id'=>'txtViewInsurance', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);','style'=>'text-align:right;','readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="col-md-12" >
<div class="col-md-4"> <label><?php echo "Total Order Amt ($INRSYM)";?></label>
<div class="form-group">
<?php
$data = array('name' => 'txtViewTotalOrderValue','value' => set_value('txtViewTotalOrderValue'),'id'=>'txtViewTotalOrderValue', 'class' => 'form-control num' ,'readonly' => 'true','style'=>'text-align:right;');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-12">
<label><?php echo "Revenue Description";?></label>
<div class="form-group">
<?php
$data = array('name' => 'View_Service_Description','value' => set_value('View_Service_Description'),'id'=>'View_Service_Description', 'class' => 'form-control','rows'=>'2','cols'=>'100','readonly'=>'true');
echo form_textarea($data);
?>
</div>
</div>
</div>
<div class="col-md-3 col-md-offset-9"><br/>
<a class="btn btn-primary ViewRevenue" ID="ViewRevenue">&nbsp;&nbsp;<span class="bold">Edit Revenue</span></a>&nbsp;&nbsp;&nbsp;&nbsp;<a class="btn btn-primary" data-dismiss="modal" value="Cancel">Cancel</a>
</div>
</div>
<!-- footer for revenue po -->
<div class="modal-footer">
</div>
</div>
</div>
</form>
</div>
</div>
<div class="box-body">
<table id="revenueTax" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;">
<thead style="background-color:#ddf">
<tr>
<th>SNo</th>
<th>Requisition No</th>
<th>Item Code</th>
<th>Item Description</th>
<th>Quantity</th>
<th>UOM</th>
<th>Rate <?php echo "($INRSYM)"?></th>
<th>Basic Amount <?php echo "($INRSYM)"?></th>
<th>Tax Amount <?php echo "($INRSYM)"?></th>
<th>Total Order Amount <?php echo "($INRSYM)"?></th>
<th>Actual Quantity</th>
<th>Received Quantity</th>
<th>Pending Quantity</th>
<th>Action</th>
</tr>
</thead>
<tbody id='RevenueAppend'>
<?php
if(!empty($POItem))
{
$index = 0;
foreach($POItem as $record)
{
$index = $index + 1;
?>
<tr id="<?php echo $index ; ?>">
<td align="left"><?php echo $index ; ?></td>
<td><?php echo $record->ReqNo ?></td>
<td><?php echo $record->MaterialCode ?></td>
<td><?php echo $record->MaterialName ?></td>
<td align="right"><?php echo $record->Quantity ?></td>
<td><?php echo $record->UOM ?></td>
<td align="right"><?php echo $record->Rate ?></td>
<td align="right"><?php echo number_format($record->BasicValue, 2, '.', ''); ?></td>
<td align="right"><?php echo $record->Taxamount ?></td>
<td align="right"><?php echo $record->TotalValue ?></td>
<td align="right"><?php echo $record->Quantity ?></td>
<td align="right"><?php echo $record->ReceivedQuantity ?></td>
<td align="right"><?php echo number_format($record->Quantity - $record->ReceivedQuantity, 2, '.', ''); ?></td>
<input type="hidden" name="<?php echo 'Reqnumber'.$index ?>" id="<?php echo 'Reqnumber'.$index ?>" value="<?php echo $record->ReqNo ; ?>" />
<input type="hidden" name="<?php echo 'departmentName'.$index ?>" id="<?php echo 'departmentName'.$index ?>" value="<?php echo $record->DepartmentName ; ?>" />
<input type="hidden" name="<?php echo 'AvilBudget'.$index ?>" id="<?php echo 'AvilBudget'.$index ?>" value="<?php echo $AvlAmount ; ?>" />
<input type="hidden" name="<?php echo 'LineItemNo'.$index ?>" id="<?php echo 'LineItemNo'.$index ?>" value="<?php echo $record->LineItemNo ; ?>" />
<input type="hidden" name="<?php echo 'costCode'.$index ?>" id="<?php echo 'costCode'.$index ?>" value="<?php echo $record->CostCenterCode ; ?>" />
<input type="hidden" name="<?php echo 'materialCode'.$index ?>" id="<?php echo 'materialCode'.$index ?>" value="<?php echo $record->MaterialCode ; ?>" />
<input type="hidden" name="<?php echo 'materialName'.$index ?>" id="<?php echo 'materialName'.$index ?>" value="<?php echo htmlentities($record->MaterialName);?>" />
<input type="hidden" name="<?php echo 'uom'.$index ?>" id="<?php echo 'uom'.$index ?>" value="<?php echo $record->UOM ; ?>" />
<input align="right" type="hidden" name="<?php echo 'quantity'.$index ?>" id="<?php echo 'quantity'.$index ?>" value="<?php echo $record->Quantity ; ?>" />
<input align="right" type="hidden" name="<?php echo 'b4qty'.$index ?>" id="<?php echo 'b4qty'.$index ?>" value="<?php echo $record->Quantity ; ?>" />
<input align="right" type="hidden" name="<?php echo 'itemRate'.$index ?>" id="<?php echo 'itemRate'.$index ?>" value="<?php echo $record->Rate ; ?>" />
<input align="right" type="hidden" name="<?php echo 'b4rate'.$index ?>" id="<?php echo 'b4rate'.$index ?>" value="<?php echo $record->Rate ; ?>" />
<input align="right" type="hidden" name="<?php echo 'per'.$index ?>" id="<?php echo 'per'.$index ?>" value="<?php echo $record->Per ; ?>" />
<input align="right" type="hidden" name="<?php echo 'service_description'.$index ?>" id="<?php echo 'service_description'.$index ?>" value="<?php echo $record->ServiceMaterialDescription ; ?>" />
<input align="right" type="hidden" name="<?php echo 'DisType'.$index ?>" id="<?php echo 'DisType'.$index ?>" value="<?php echo $record->DiscountType ; ?>" />
<input align="right" type="hidden" name="<?php echo 'DisVal'.$index ?>" id="<?php echo 'DisVal'.$index ?>" value="<?php echo $record->DiscountValue ; ?>" />
<input align="right" type="hidden" name="<?php echo 'AfterDisVal'.$index ?>" id="<?php echo 'AfterDisVal'.$index ?>" value="<?php echo $record->AfterDiscount ; ?>" />
<input align="right" type="hidden" name="<?php echo 'PackOption'.$index ?>" id="<?php echo 'PackOption'.$index ?>" value="<?php echo $record->PackagingCalulatedOn ; ?>" />
<input align="right" type="hidden" name="<?php echo 'PackType'.$index ?>" id="<?php echo 'PackType'.$index ?>" value="<?php echo $record->PackagingType ; ?>" />
<input align="right" type="hidden" name="<?php echo 'PackVal'.$index ?>" id="<?php echo 'PackVal'.$index ?>" value="<?php echo $record->PackagingValue ; ?>" />
<input align="right" type="hidden" name="<?php echo 'AfterPackVal'.$index ?>" id="<?php echo 'AfterPackVal'.$index ?>" value="<?php echo $record->AfterPackagingValue ; ?>" />
<input align="right" type="hidden" name="<?php echo 'RevenueCgst'.$index ?>" id="<?php echo 'RevenueCgst'.$index ?>" value="<?php echo $record->CGST ; ?>" />
<input align="right" type="hidden" name="<?php echo 'RevenueAfterCgst'.$index ?>" id="<?php echo 'RevenueAfterCgst'.$index ?>" value="<?php echo $record->AfterCGST ; ?>" />
<input align="right" type="hidden" name="<?php echo 'RevenueSgst'.$index ?>" id="<?php echo 'RevenueSgst'.$index ?>" value="<?php echo $record->SGST ; ?>" />
<input align="right" type="hidden" name="<?php echo 'RevenueAfterSgst'.$index ?>" id="<?php echo 'RevenueAfterSgst'.$index ?>" value="<?php echo $record->AfterSGST ; ?>" />
<input align="right" type="hidden" name="<?php echo 'RevenueIgst'.$index ?>" id="<?php echo 'RevenueIgst'.$index ?>" value="<?php echo $record->IGST ; ?>" />
<input align="right" type="hidden" name="<?php echo 'RevenueAfterIgst'.$index ?>" id="<?php echo 'RevenueAfterIgst'.$index ?>" value="<?php echo $record->AfterIGST ; ?>" />
<input align="right" type="hidden" name="<?php echo 'FreightType'.$index ?>" id="<?php echo 'FreightType'.$index ?>" value="<?php echo $record->FreightType ; ?>" />
<input align="right" type="hidden" name="<?php echo 'NoOfTrip'.$index ?>" id="<?php echo 'NoOfTrip'.$index ?>" value="<?php echo $record->NoOfTrip ; ?>" />
<input align="right" type="hidden" name="<?php echo 'FreightVal'.$index ?>" id="<?php echo 'FreightVal'.$index ?>" value="<?php echo $record->FreightValue ; ?>" />
<input align="right" type="hidden" name="<?php echo 'AfterFreightVal'.$index ?>" id="<?php echo 'AfterFreightVal'.$index ?>" value="<?php echo $record->AfterFreightValue ; ?>" />
<input align="right"type="hidden" name="<?php echo 'basicval'.$index ?>" id="<?php echo 'basicval'.$index ?>" value="<?php echo $record->BasicValue ; ?>"/>
<input align="right" type="hidden" name="<?php echo 'Insval'.$index ?>" id="<?php echo 'Insval'.$index ?>" value="<?php echo $record->Insurance ; ?>" />
<input align="right" type="hidden" name="<?php echo 'TotalOrderValue'.$index ?>" id="<?php echo 'TotalOrderValue'.$index ?>" value="<?php echo $record->TotalValue ; ?>" />
<?php
if($PONOStatus == PO_DRAFT || $PONOStatus == PO_CREATED|| $PONOStatus==REQITEM_Emergency_PO_CREATED || $PONOStatus==PO_APPROVED ||$PONOStatus== SPECIAL_PO)
{?>
<td> <a data-target='#EDITREVENUE' data-id="<?php echo $index ; ?>" data-userid="<?php echo $index ; ?>" data-toggle="modal" href="#EDITREVENUE"><i class="fa fa-pencil" data-toggle="tooltip" title="Click here to view/Edit the <?php echo $record->ReqNo ; ?> Requisition details"></i>&nbsp;&nbsp;&nbsp;</a> <a href='#' onclick = "DeleteRow(<?php echo $index ; ?>)" class="link" data-id="<?php echo $index ; ?>" data-userid="<?php echo $index ; ?>" id="Del" ><span class="glyphicon glyphicon-trash"></span></a>
<?php
} else {?>
<td> <a data-target='#VIEWREVENUE' data-id="<?php echo $index ; ?>" data-userid="<?php echo $index ; ?>" data-toggle="modal" href="#VIEWREVENUE"><i class="fa fa-eye" data-toggle="tooltip" title="Click here to view the <?php echo $record->ReqNo ; ?> Requisition details"></i>&nbsp;&nbsp;&nbsp;</a> </td>
<?php
}?>
</tr>
<?php
$totBasicAmt = $totBasicAmt + $record->BasicValue;
$totDiscountAmt = $totDiscountAmt + $record->AfterDiscount;
$totPackagingAmt = $totPackagingAmt + $record->AfterPackagingValue;
$totCgst = $totCgst + $record->AfterCGST;
$totSgst = $totSgst + $record->AfterSGST;
$totIgst = $totIgst + $record->AfterIGST;
$totFreightAmt = $totFreightAmt + $record->AfterFreightValue;
$totInsuranceAmt = $totInsuranceAmt + $record->Insurance;
$totOrderSummaryAmt = $totOrderSummaryAmt +$record->TotalValue;
}
?>
<?php
}
?>
</tbody>
</table>
</div>
<!-- /.box-body -->
<div class="row" style="border:1px solid;">
<div class="col-md-12">
<div class="col-md-3">
<label >Basic Amount <?php echo "($INRSYM)"?></label>
<?php
$data = array('name' => 'txtTotBasicAmount','value' => set_value('txtTotBasicAmount',number_format($totBasicAmt, 2, '.', '')),'id'=>'txtTotBasicAmount', 'class' => 'form-control' ,'readonly' => 'true','style'=>'text-align:right;');
echo form_input($data);
?>
</div>
<div class="col-md-3">
<label >Total Discount Amount <?php echo "($INRSYM)"?></label>
<?php
$data = array('name' => 'txtTotalDiscount','value' => set_value('txtTotalDiscount',number_format($totDiscountAmt, 2, '.', '')),'id'=>'txtTotalDiscount', 'class' => 'form-control' ,'readonly' => 'true','style'=>'text-align:right;');
echo form_input($data);
?>
</div>
<div class="col-md-3" id="TotSCST">
<label >Total SGST Amount <?php echo "($INRSYM)"?></label>
<?php
$data = array('name' => 'txtTotalSGST','value' => set_value('txtTotalSGST',number_format($totSgst, 2, '.', '')),'id'=>'txtTotalSGST', 'class' => 'form-control' ,'readonly' => 'true','style'=>'text-align:right;');
echo form_input($data);
?>
</div>
<div class="col-md-3" id="TotICST" style="display:none;">
<label >Total IGST Amount <?php echo "($INRSYM)"?> </label>
<?php
$data = array('name' => 'txtTotalIGST','value' => set_value('txtTotalIGST',number_format($totIgst, 2, '.', '')),'id'=>'txtTotalIGST', 'class' => 'form-control' ,'readonly' => 'true','style'=>'text-align:right;');
echo form_input($data);
?>
</div>
<div class="col-md-3">
<label >Total CGST Amount <?php echo "($INRSYM)"?> </label>
<?php
$data = array('name' => 'txtTotalCGST','value' => set_value('txtTotalCGST',number_format($totCgst, 2, '.', '')),'id'=>'txtTotalCGST', 'class' => 'form-control' ,'readonly' => 'true','style'=>'text-align:right;');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-12">
<div class="col-md-3">
<label >Total Packaging Amount <?php echo "($INRSYM)"?></label>
<?php
$data = array('name' => 'txtTotalPackaing','value' => set_value('txtTotalPackaing',number_format($totPackagingAmt, 2, '.', '')),'id'=>'txtTotalPackaing', 'class' => 'form-control' ,'readonly' => 'true','style'=>'text-align:right;');
echo form_input($data);
?>
</div>
<div class="col-md-3">
<label >Total Insurance Amount <?php echo "($INRSYM)"?></label>
<?php
$data = array('name' => 'txtTotalInsurance','value' => set_value('txtTotalInsurance',number_format($totInsuranceAmt, 2, '.', '')),'id'=>'txtTotalInsurance', 'class' => 'form-control' ,'readonly' => 'true','style'=>'text-align:right;');
echo form_input($data);
?>
</div>
<div class="col-md-3">
<label >Total Freight Amount <?php echo "($INRSYM)"?></label>
<?php
$data = array('name' => 'txtTotalFreight','value' => set_value('txtTotalFreight',number_format($totFreightAmt, 2, '.', '')),'id'=>'txtTotalFreight', 'class' => 'form-control' ,'readonly' => 'true','style'=>'text-align:right;');
echo form_input($data);
?>
</div>
<div class="col-md-3">
<label>Total Order Amount <?php echo "($INRSYM)"?></label>
<?php
$data = array('name' => 'txtTotalOrderValueSummary','value' => set_value('txtTotalOrderValueSummary',number_format($totOrderSummaryAmt, 2, '.', '')),'id'=>'txtTotalOrderValueSummary', 'class' => 'form-control' ,'readonly' => 'true','style'=>'text-align:right;');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-12">
<div class="col-md-12">
<label>Special Instructions </label> <?php
$data = array('name' => 'txtSpcialInstruction','value' => set_value('txtSpcialInstruction',$ServiceDescription),'id'=>'txtSpcialInstruction', 'class' => 'form-control' );
echo form_textarea($data);
?>
<input type="hidden" name="SpcialInstruction" id="SpcialInstruction" value="">
</div>
</div>
<div class="col-md-12" id="splpodiv">
<div class="col-md-12"><label>Special po Table List</label>
<table id="table2" class="table table-hover table-bordered" style="background-color:#fff;font-size:12px;" >
<thead style="background-color:#ddf">
<tr>
<th>Bill No </th>
<!-- <th>Materials</th> -->
<th>Delivery Challan No</th>
<th>Delivery Challan Date</th>
<th>Vehicle No</th>
<th>Courier No</th>
<!-- <th>Quantity</th> -->
<th>File</th>
<th>Action</th>
</tr>
</thead>
<tbody id="spl">
<?php
if(!empty($getdata))
{
foreach($getdata as $gd)
{
?>
<tr>
<td><?php echo $gd->BillNo ?></td>
<!-- <td><?php echo $gd->MaterialCode ?> - <?php echo $gd->MaterialName ?></td> -->
<td><?php echo $gd->DeliveryChellanOrInvoiceNo?></td>
<td><?php $date = new DateTime($gd->DeliveryChellanDate);
echo $date->format('d-m-Y'); ?></td>
<td><?php echo $gd->VehicleNo?></td>
<td><?php echo $gd->CourierNo?></td>
<td><?php echo (!empty($gd->FilePath))?$gd->FilePath:"No File"; ?></td>
<td><a data-target='#EditRevenueSplPOModel' data-toggle="modal" href="#EditRevenueSplPOModel"><i class="fa fa-pencil" data-toggle="tooltip" title="Click here to Edit the Revenue SplPO details"></i></a>
<?php if(!empty($gd->FilePath)) { ?>
<a target="_blank" href="<?php echo base_url().'uploads/BillFiles/'?><?php echo $gd->FilePath ?>"><i class="fa fa-download" ></i></a>
<?php } ?>
</td>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div>
</div>
<!--################################################################## -->
<?php if(!empty($update)){?>
<div class="col-md-12" id="editpodiv">
<div class="col-md-12"><label>Editable POScreen</label>
<table id="edittable" class="table table-hover table-bordered" style="background-color:#fff;font-size:12px;" >
<thead style="background-color:#ddf">
<tr>
<th>Sno</th>
<th>PONO</th>
<!-- <th>Material</th> -->
<!-- <th>Date</th> -->
<th>LineItemNo</th>
<th>Entity</th>
<th>OldValue</th>
<th>NewValue</th>
<th>UpdatedBy</th>
<th>UpdateOn</th>
</tr>
</thead>
<tbody>
<?php
if(!empty($getlogpodtl))
{
//print_r($getlogpodtl); die;
$inde = 0;
foreach($getlogpodtl as $oldpo)
{
$inde = $inde+1;
?>
<tr id="<?php echo $inde ; ?>">
<td><?php echo $inde; ?></td>
<td><?php echo $oldpo->PONO ?></td>
<!--
<?php if($oldpo->logDate !='-'){
$logdate = date('d-m-Y',strtotime($oldpo->logDate));
}else{
$logdate = '-';
}?>
<td><?=$logdate;?></td> -->
<td><?php echo $oldpo->LineItemNos;?></td>
<td><?php echo $oldpo->entity?></td>
<?php if($oldpo->entity =='PO DateChanged'){
$oldValue = date('d-m-Y',strtotime($oldpo->oldValue));
}else{
$oldValue = $oldpo->oldValue;
}?>
<td><?php echo $oldValue.'-'.$oldpo->SupplierName;?></td>
<?php if($oldpo->entity =='PO DateChanged'){
$newValue = date('d-m-Y',strtotime($oldpo->newValue));
}else{
$newValue = $oldpo->newValue;
}?>
<td><?php echo $newValue ?></td>
<td><?php echo $oldpo->FirstName?></td>
<td><?php $date = new DateTime($oldpo->UpdatedOn);
echo $date->format('d-m-Y'); ?></td>
</tr>
<?php
}
}
?>
</tbody>
<?php } else {}?>
</table>
</div>
</div>
<!-- Revenue Special PO Modal Starts Here -->
<div id="EditRevenueSplPOModel" class="modal fade" data-backdrop-limit="1" role="dialog" aria-labelledby="myModalLabel" >
<div class="modal-dialog">
<?php $date = new DateTime($getdata[0]->DeliveryChellanDate);
$date = $date->format('d-m-Y'); ?>
<div class="modal-content" style="width:950px;">
<div class="modal-header">
<h4 class="modal-title">Update <?php echo $getdata[0]->BillNo ?> Bill Details</h4>
</div>
<form class="tagForm" id="tag-form" method="post" enctype="multipart/form-data" >
<div class="modal-body" style="padding:0px;">
<div class="col-md-12">
<div class="col-md-4 pad"><strong>Delivery Challan /Inv No</strong>
<input type="text" name="ChallanInvNo" id="ChallanInvNo" maxlength="12" class="form-control" value="<?php echo $getdata[0]->DeliveryChellanOrInvoiceNo ?>" readonly onkeypress="return isNumberKey(event)">
</div>
<div class="col-md-4 pad"><strong>Delivery Challan /Inv Date</strong>
<?php
$data = array('name' => 'Date1','value' => set_value('Date1',$date),'id'=>'Date1', 'class' => 'form-control num' ,'readonly' => 'true');
echo form_input($data);?>
</div>
</div>
<div class="col-md-12">
<div class="col-md-4 pad"><strong>Vehicle No</strong>
<input type="text" name="VehicleNo" id="VehicleNo" maxlength="13" class="form-control" value="<?php echo $getdata[0]->VehicleNo; ?>" readonly>
</div>
<div class="col-md-4 pad"><strong>Courier No</strong>
<input type="text" name="CourierNo" id="CourierNo" maxlength="12" class="form-control" value="<?php echo $getdata[0]->CourierNo; ?>" readonly>
</div>
<!-- <div class="col-md-4" id="QualityChecked"><strong>Is Quality Check Required</strong>
<div class="radio">
<label><input type="radio" name="Quality" checked="checked" value='0' id="Quality">Yes</label>
</div>
<div class="radio">
<label><input type="radio" name="Quality" id="Quality" value='1' >No</label>
</div>
</div> -->
</div>
<!--
<div class="col-md-12">
<div class="col-md-5">
<?php if($getdata[0]->FilePath != '') { ?>
<label for="oldimagename">Old file Name :</label><?php echo $getdata[0]->FilePath; ?> <br/><?php } ?>
<input type = "file" size = "20" input accept=".docx,.pdf,.doc.JPG,.PNG,.jpg" id="imag" name="images" />
<label for="images">Select file <br/><small>(only .pdf,.excel,.doc,.png,.jpg)</small></label>
</div>
</div> -->
<div class="col-md-12">
<div class="col-md-5">
<?php if($getdata[0]->FilePath != '') { ?>
<label for="oldimagename">Old file Name :</label><?php echo $getdata[0]->FilePath; ?> <br/><?php } ?>
<input type = "file" size = "20" input accept=".docx,.pdf,.doc.JPG,.PNG,.jpg" id="imag" name="images" onChange="filecheck();"/>
<label for="images">Select file <br/><small>(only .pdf,.excel,.doc,.png,.jpg)</small></label>
</div>
</div>
<input type="hidden" name="hideoldfile" id="hideoldfile" value="<?php echo $getdata[0]->FilePath; ?>" class="form-control" readonly>
<input type="hidden" name="hidebillno" id="hidebillno" value="<?php echo $getdata[0]->BillNo ?>" class="form-control" readonly>
</div><!-- /.modal body -->
<div class="modal-footer">
<div class="col-md-12 text-right">
<div class="col-md-4 col-md-offset-8">
<a class="btn btn-primary" onclick="splpoupdate()" >&nbsp;&nbsp;<span class="bold">Update</span>
<!-- <input id="tag-form-submit" type="submit" class="btn btn-primary bold" value="Update"> --></a>
<!-- <a class="btn btn-primary ok" ID="ExciseOption12" onclick="splpoupdate()" ><span class="bold">Update</span></a> -->
<a class="btn btn-primary" data-dismiss="modal" onclick="SetExciseCalculationCancel();" value="Cancel">Cancel</a>
</div>
</div>
</div><!-- /.modal footer -->
</form>
</div><!-- /.modal content -->
</div><!-- /.modal dialog -->
</div><!-- /#filemodal -->
<!-- Revenue Special PO Modal Ends Here -->
<div class="row" style="padding: 2% 0%">
<div class="col-md-3 col-md-offset-9"><br/>
<input type="hidden" name="txtPoRange" id="txtPoRange" />
<input type="hidden" name="isEdit" id="isEdit" value="0" />
<input type="hidden" name="txtStatus" id="txtStatus" />
<input type="hidden" name="txtRowCount" id="txtRowCount" value="<?php echo $index;?>">
<input type="hidden" name="txtDeletedRow" id="txtDeletedRow" />
<input type="hidden" name="txtPONO" id="txtPONO" value="<?php echo $PONO; ?>"/>
<input type="hidden" name="txttaxcheck" id="txttaxcheck" value=""/>
<input type="hidden" name="Budget" id="Budget" value="<?php echo $BudgetType; ?>" />
<?php if($PONOStatus == PO_DRAFT || $PONOStatus == PO_CREATED || $PONOStatus == REQITEM_Emergency_PO_CREATED ) {
if($PONOStatus == PO_DRAFT || $PONOStatus == PO_CREATED ){?>
<a class="btn btn-primary Save" ID="Save" onclick="Save(0)" >&nbsp;&nbsp;<span class="bold">Save</span></a> <?php }?>
<a class="btn btn-primary Save" ID="Submit" onclick="Save(1)" >&nbsp;&nbsp;<span class="bold">Submit</span></a>
<a class="btn btn-primary Save" ID="Cancel" href="<?php echo base_url().'purchaseorderListing'; ?>">&nbsp;&nbsp;<span class="bold">Cancel</span></a>
<?php }
else if($PONOStatus == SPECIAL_PO) {?>
<a class="btn btn-primary" ID="Viewsave" onclick="Save(2)">&nbsp;&nbsp;<span class="bold">Submit</span></a>
<!-- <a class="btn btn-primary" ID="OK" href="<?php echo base_url().'purchaseorderListing'; ?>">&nbsp;&nbsp;<span class="bold">OK</span></a> --> <?php }
else {?>
<!-- <a class="btn btn-primary" ID="Viewsave" onclick="Save(2)">&nbsp;&nbsp;<span class="bold">Submit</span></a> -->
<a class="btn btn-primary" ID="OK" href="<?php echo base_url().'purchaseorderListing'; ?>">&nbsp;&nbsp;<span class="bold">OK</span></a> <?php } ?>
</div><br/>
</div>
<label>Request On : </label><?php echo $Reqon;?><br/>
<?php if($RequesterName!='' || $RequesterName!=null){ ?>
<label>Request By : </label><?php echo $RequesterName;?><br/>
<?php
} ?>
<label>Status : </label><?php echo $StatusName;?>
</div>
</div>
</div>
</div> </section></div>
<script type="text/html" id="RevenueList">
<tr id="<%=index%>">
<td align="left"><%=index%></td>
<td align="left"><%=ReqNo%></td>
<td align="left"><%=MaterialCode%></td>
<td align="left"><%=MaterialName%></td>
<td align="right"><%=Quantity%></td>
<td align="left"><%=UOM%></td>
<td align="right"><%=Rate%></td>
<td align="right"><%=BasicAmount%></td>
<td align="right"><%=Taxvalue%></td>
<td align="right"><%=TotalValue%></td>
<td align="right"><%=ActualQuantity%></td>
<td align="right"><%=ReceivedQuantity%></td>
<td align="right"><%=PendingQuantity%></td>
<td>
<a data-target='#EDITREVENUE' data-id="<%=index%>" data-userid="<%=index%>" data-toggle="modal" href="#EDITREVENUE"><i class="fa fa-pencil" data-toggle="tooltip" title="Click here to view/Edit the <%=ReqNo%> Requisition details"></i>&nbsp;&nbsp;&nbsp;</a> <a href='#' onclick = "DeleteRow(<%=index%>)" class="link" data-id="<%=index%>" data-userid="<%=index%>" id="Del" ><span class="glyphicon glyphicon-trash"></span></a>
</td>
</tr>
</div>
</section></div></script>
<script>
var index = <?php echo $index; ?>;
var userid = '';
var taxcheck=0;
$("#BudgetType").change(function(){
var aa = $("#BudgetType option:selected").text();
$('#Budget').val(aa);
});
$("#REVENUE").on("shown.bs.modal", function(e) {
$('#isEdit').val(0);
});
$('.AddRevenue').click(function(){
tinyMCE.triggerSave();
if(validateRevenueTax() && ExceedQuantityCheck())
{
var temp = parseInt(index)+1;
var Reqnumber = $('#ReqNo').val();
var departmentName = $('#deptName').val();
var AvilBudget = $('#AvlBudAmt').val();
var costCode = $('#CostCenter').val();
var materialCode =$('#MaterialCode').val();
var materialName = $("#ItemName").val();
var uom = $("#UOM").val();
var quantity = parseFloat($("#Quantity").val()).toFixed(2);
var itemRate = parseFloat($("#Rate").val()).toFixed(2);
var PER = $("#AddPer").val();
//alert(PER);
if(PER == '')
{
PER = $("#UOM").val();
}
var DisType = $("#DiscountType").val();
var DisVal = $("#txtDiscount").val();
var AfterDisVal = $("#txtAfterDiscount").val();
var PackOption = PackagingCalculation ;
var PackType = $("#PackagingType").val();
var PackVal = $("#txtPackaging").val();
var AfterPackVal = $("#txtAfterPackaging").val();
var Cgst = $("#Cgst").val();
var AfterCgst = $("#AfterCgst").val();
var Sgst = $("#Sgst").val();
var AfterSgst = $("#AfterSgst").val();
var Igst = $("#Igst").val();
var AfterIgst = $("#AfterIgst").val();
var FreightType = $("#drpFreight").val();
var FreightVal = $("#txtFreight").val();
var AfterFreightVal = $("#txtAfterFreight").val();
var NoOfTrip = $("#NOOfTrips").val();
var basicval = $("#txtBasicValue").val();
var Insval = $("#txtInsurance").val();
var TotalOrderValue = $("#txtTotalOrderValue").val();
var service_description = $("#Add_Service_Description").val();
//alert(service_description);
var TotalTaxValue = calculateTaxValue();
// $('#ReqNo').val(Reqnumber).remove();
// $('#ReqNo option[value='+Reqnumber+']').remove();
$('#MaterialCode option[value='+materialCode+']').remove();
SelectedMaterialCode[CollIndex] = materialCode;
CollIndex = CollIndex + 1;
SelectedMaterialList.Mat.push({
"materialCode" : materialCode,
"ReqNo" : Reqnumber,
});
index = parseInt(index)+1;
var template = jQuery("#RevenueList").html();
$('#RevenueAppend').append(_.template(template,{index:temp,ReqNo:Reqnumber,MaterialCode:materialCode,MaterialName:materialName,Quantity:quantity,UOM:uom,Rate:itemRate,AddPer:PER,Add_Service_Description:service_description,BasicAmount:basicval,Taxvalue:TotalTaxValue,TotalValue:TotalOrderValue,ActualQuantity:quantity,ReceivedQuantity:0,PendingQuantity:quantity}));
var theForm = $(".CreatePO");
addHidden(theForm,"Reqnumber"+temp,Reqnumber );
addHidden(theForm,"departmentName"+temp,departmentName );
addHidden(theForm,"AvilBudget"+temp,AvilBudget );
addHidden(theForm,"costCode"+temp,costCode );
addHidden(theForm,"materialCode"+temp,materialCode );
addHidden(theForm,"materialName"+temp,materialName );
addHidden(theForm,"uom"+temp,uom);
addHidden(theForm,"quantity"+temp,quantity);
addHidden(theForm,"itemRate"+temp,itemRate);
addHidden(theForm,"DisType"+temp,DisType);
addHidden(theForm,"DisVal"+temp,DisVal);
addHidden(theForm,"AfterDisVal"+temp,AfterDisVal);
addHidden(theForm,"PackOption"+temp,PackOption);
addHidden(theForm,"PackType"+temp,PackType);
addHidden(theForm,"PackVal"+temp,PackVal);
addHidden(theForm,"AfterPackVal"+temp,AfterPackVal);
addHidden(theForm,"FreightType"+temp,FreightType);
addHidden(theForm,"FreightVal"+temp,FreightVal);
addHidden(theForm,"AfterFreightVal"+temp,AfterFreightVal);
addHidden(theForm,"NoOfTrip"+temp,NoOfTrip);
addHidden(theForm,"basicval"+temp,basicval);
addHidden(theForm,"Insval"+temp,Insval);
addHidden(theForm,"TotalOrderValue"+temp,TotalOrderValue);
addHidden(theForm,"RevenueCgst"+temp,Cgst);
addHidden(theForm,"RevenueAfterCgst"+temp,AfterCgst);
addHidden(theForm,"RevenueSgst"+temp,Sgst);
addHidden(theForm,"RevenueAfterSgst"+temp,AfterSgst);
addHidden(theForm,"RevenueIgst"+temp,Igst);
addHidden(theForm,"RevenueAfterIgst"+temp,AfterIgst);
addHidden(theForm,"LineItemNo"+temp,'');
addHidden(theForm,"per"+temp,PER);
addHidden(theForm,"service_description"+temp,service_description);
$('#txtRowCount').val(temp);
// $('#REVENUE').modal('hide');
populateValueMainFormForRevenue();
clearRevenueModalFields();
}
});
$('.EditRevenue').click(function(){
tinyMCE.triggerSave();
if(validateEditRevenueTax() && validateEditExceedLimit() && ExceedEditQuantityCheck())
{
//alert('inside Add');
var CostCode = $("#EditCostCenter").val();
var AvilBudget = $('#EditAvlBudAmt').val();
var editMaterialCode = $("#EditMaterialCode").val();
var editDescription = $("#EditItemName").val();
var editUOM = $('#EditUOM').val();
var editQuantity = $('#EditQuantity').val();
var itemRate = $("#EditRate").val();
var per = $("#EditPer").val();
if(per == '')
{
per = $('#EditUOM').val();
}
var DisType = $("#EditDiscountType").val();
var DisVal = $("#txtEditDiscount").val();
var AfterDisVal = $("#txtEditAfterDiscount").val();
var PackOption = PackagingCalculation ;
var PackType = $("#EditPackagingType").val();
var PackVal = $("#txtEditPackaging").val();
var AfterPackVal = $("#txtEditAfterPackaging").val();
var Cgst = $("#EditCgst").val();
var AfterCgst = $("#EditAfterCgst").val();
var Sgst = $("#EditSgst").val();
var AfterSgst = $("#EditAfterSgst").val();
var Igst = $("#EditIgst").val();
var AfterIgst = $("#EditAfterIgst").val();
// console.log("cgst"+Cgst);
// console.log("after cgst"+AfterCgst);
// console.log('sgst'+Sgst);
// console.log("After Sgst"+AfterSgst);
var FreightType = $("#drpEditFreight").val();
var FreightVal = $("#txtEditFreight").val();
var AfterFreightVal = $("#txtEditAfterFreight").val();
var NoOfTrip = $("#EditNOOfTrips").val();
var basicval = $("#txtEditBasicValue").val();
var Insval = $("#txtEditInsurance").val();
var TotalOrderValue = $("#txtEditTotalOrderValue").val();
var Service_Description=$("#Edit_Service_Description").val();
var TotalTaxValue = calculateEditTaxValue();
var tr= document.getElementById(userid);
var cellval = tr.cells;
cellval[2].innerHTML = editMaterialCode;
cellval[3].innerHTML = editDescription;
cellval[4].innerHTML = editQuantity;
cellval[5].innerHTML =editUOM;
cellval[6].innerHTML =itemRate;
cellval[7].innerHTML =basicval;
cellval[8].innerHTML =TotalTaxValue;
cellval[9].innerHTML =TotalOrderValue;
$('#materialCode'+userid).val(editMaterialCode);
$('#materialName'+userid).val(editDescription);
$('#uom'+userid).val(editUOM);
$('#per'+userid).val(per);
$('#quantity'+userid).val(editQuantity);
$('#itemRate'+userid).val(itemRate);
$('#DisType'+userid).val(DisType);
$('#DisVal'+userid).val(DisVal);
$('#AfterDisVal'+userid).val(AfterDisVal);
$('#PackOption'+userid).val(PackOption);
$('#PackType'+userid).val(PackType);
$('#PackVal'+userid).val(PackVal);
$('#AfterPackVal'+userid).val(AfterPackVal);
$('#RevenueCgst'+userid).val(Cgst);
var taxvaluecheck = $('#txttaxcheck').val();
if(taxvaluecheck == 1)
{
$('#RevenueAfterSgst'+userid).val(0);
$('#RevenueSgst'+userid).val(0);
}
$('#RevenueAfterCgst'+userid).val(AfterCgst);
//$('#RevenueAfterSgst'+userid).val(AfterSgst);
//$('#RevenueSgst'+userid).val(Sgst);
$('#RevenueIgst'+userid).val(Igst);
$('#RevenueAfterIgst'+userid).val(AfterIgst);
$('#FreightType'+userid).val(FreightType);
$('#FreightVal'+userid).val(FreightVal);
$('#AfterFreightVal'+userid).val(AfterFreightVal);
$('#NoOfTrip'+userid).val(NoOfTrip);
$('#basicval'+userid).val(basicval);
$('#Insval'+userid).val(Insval);
$('#AvilBudget'+userid).val(AvilBudget);
$('#costCode'+userid).val(CostCode);
$('#TotalOrderValue'+userid).val(TotalOrderValue);
$('#service_description'+userid).val(Service_Description);
populateValueMainFormForEditRevenueTax();
}
});
$('.ViewRevenue').click(function(){
//alert("Working");
var FreightType = $("#drpViewFreight").val();
var FreightVal = $("#txtViewFreight").val();
var AfterFreightVal = $("#txtViewAfterFreight").val();
var NoOfTrip = $("#ViewNOOfTrips").val();
var Cgst = $("#ViewAfterCGST").val();
//alert(Cgst);
var Sgst = $("#ViewAfterSGST").val();
var Igst = $("#ViewAfterIGST").val();
// alert(Igst);
if(FreightType != 'PER TRIP'){
NoOfTrip=0;
}
var TotalOrderValue = $("#txtViewTotalOrderValue").val();
//alert(FreightType+'-'+FreightVal+'-'+AfterFreightVal+'-'+NoOfTrip+'-'+TotalOrderValue);
var tr= document.getElementById(userid);
var cellval = tr.cells;
cellval[9].innerHTML =TotalOrderValue;
$('#FreightType'+userid).val(FreightType);
$('#FreightVal'+userid).val(FreightVal);
$('#AfterFreightVal'+userid).val(AfterFreightVal);
$('#NoOfTrip'+userid).val(NoOfTrip);
$('#RevenueAfterCgst'+userid).val(Cgst);
$('#RevenueAfterSgst'+userid).val(Sgst);
$('#RevenueAfterIgst'+userid).val(Igst);
$('#TotalOrderValue'+userid).val(TotalOrderValue);
populateValueMainFormForEditRevenueTax();
// }
});
function addHidden(theForm, key, value) {
// Create a hidden input element, and append it to the form:
var input = document.createElement('input');
input.type = 'hidden';
input.name = key;'name-as-seen-at-the-server';
input.id = key;'name-as-seen-at-the-server';
input.value = value;
theForm.append(input);
}
function populateValueMainFormForRevenue()
{
var Packaging = $('#txtAfterPackaging').val() == '' ? '0.00' : $('#txtAfterPackaging').val();
var Cgst = $('#AfterCgst').val() == '' ? '0.00' : $("#AfterCgst").val();
var Sgst = $('#AfterSgst').val() == '' ? '0.00' : $("#AfterSgst").val();
var Igst = $('#AfterIgst').val() == '' ? '0.00' : $("#AfterIgst").val();
var Freight = $('#txtAfterFreight').val() == '' ? '0.00' : $('#txtAfterFreight').val();
var Insurance = $('#txtInsurance').val() == '' ? '0.00' : $('#txtInsurance').val();
var Discount = $('#txtAfterDiscount').val() == '' ? '0.00' : $('#txtAfterDiscount').val();
var BasicVal = $('#txtBasicValue').val() == '' ? '0.00' : $('#txtBasicValue').val();
var TotalVal = $('#txtTotalOrderValue').val() == '' ? '0.00' : $('#txtTotalOrderValue').val();
var TotalOrderValueSummary = $('#txtTotalOrderValueSummary').val() == '' ? '0.00' : $('#txtTotalOrderValueSummary').val();
var totBasicAmt = $('#txtTotBasicAmount').val() == '' ? '0.00' : $('#txtTotBasicAmount').val();
var totDiscountAmt = $('#txtTotalDiscount').val() == '' ? '0.00' : $('#txtTotalDiscount').val();
var totPackagingAmt = $('#txtTotalPackaing').val() == '' ? '0.00' : $('#txtTotalPackaing').val();
var txtTotalCGST = $('#txtTotalCGST').val() == '' ? '0.00' : $('#txtTotalCGST').val();
var txtTotalSGST = $('#txtTotalSGST').val() == '' ? '0.00' : $('#txtTotalSGST').val();
var txtTotalIGST = $('#txtTotalIGST').val() == '' ? '0.00' : $('#txtTotalIGST').val();
var totFreightAmt = $('#txtTotalFreight').val() == '' ? '0.00' : $('#txtTotalFreight').val();
var totInsuranceAmt = $('#totInsuranceAmt').val() == '' ? '0.00' : $('#totInsuranceAmt').val();
var totOrderSummaryAmt = $('#txtTotalOrderValueSummary').val() == '' ? '0.00' : $('#txtTotalOrderValueSummary').val();
$('#txtTotBasicAmount').val((parseFloat(totBasicAmt) + parseFloat(BasicVal)).toFixed(2) );
$('#txtTotalDiscount').val((parseFloat(totDiscountAmt) + parseFloat(Discount)).toFixed(2) );
$('#txtTotalPackaing').val((parseFloat(totPackagingAmt) + parseFloat(Packaging)).toFixed(2) );
$('#txtTotalCGST').val((parseFloat(txtTotalCGST) + parseFloat(Cgst)).toFixed(2) );
$('#txtTotalSGST').val((parseFloat(txtTotalSGST) + parseFloat(Sgst)).toFixed(2) );
$('#txtTotalIGST').val((parseFloat(txtTotalIGST) + parseFloat(Igst)).toFixed(2) );
$('#txtTotalFreight').val((parseFloat(totFreightAmt) + parseFloat(Freight)).toFixed(2) );
$('#totInsuranceAmt').val((parseFloat(totInsuranceAmt) + parseFloat(Insurance)).toFixed(2) );
$('#txtTotalOrderValueSummary').val((parseFloat(totOrderSummaryAmt) + parseFloat(TotalVal)).toFixed(2) );
}
function populateValueMainFormForEditRevenueTax()
{
var rows = document.getElementById('revenueTax').rows.length;
//alert(rows);
var editrow = parseFloat(rows)-1;
//alert(editrow);
var totBasicAmt = 0;
var totDiscountAmt = 0;
var totPackagingAmt = 0;
var totCgst = 0;
var totSgst = 0;
var totIgst = 0;
var totFreightAmt = 0;
var totInsuranceAmt = 0;
var totOrderSummaryAmt = 0;
var i = 0;
do {
i += 1;
alert(i);
var tr= document.getElementById(i);
//alert(tr);
if(tr != null)
{
cells = tr.getElementsByTagName('td');
var rowid = cells[0].innerHTML;
// alert(rowid);
var Packaging = $('#AfterPackVal'+rowid).val() == '' ? '0.00' : $('#AfterPackVal'+rowid).val();
var Cgst = $('#RevenueAfterCgst'+rowid).val() == '' ? '0.00' : $('#RevenueAfterCgst'+rowid).val();
var Sgst = $('#RevenueAfterSgst'+rowid).val() == '' ? '0.00' : $('#RevenueAfterSgst'+rowid).val();
var Igst = $('#RevenueAfterIgst'+rowid).val() == '' ? '0.00' : $('#RevenueAfterIgst'+rowid).val();
var Freight = $('#AfterFreightVal'+rowid).val() == '' ? '0.00' : $('#AfterFreightVal'+rowid).val();
var Insurance = $('#Insval'+rowid).val() == '' ? '0.00' : $('#Insval'+rowid).val();
var Discount =$('#AfterDisVal'+rowid).val() == '' ? '0.00' : $('#AfterDisVal'+rowid).val();
var BasicVal = $('#basicval'+rowid).val() == '' ? '0.00' : $('#basicval'+rowid).val();
var TotalVal =$('#TotalOrderValue'+rowid).val() == '' ? '0.00' : $('#TotalOrderValue'+rowid).val();
//alert(TotalVal);
totBasicAmt = parseFloat(totBasicAmt ) + parseFloat(BasicVal);
totDiscountAmt = parseFloat(totDiscountAmt ) + parseFloat(Discount);
totPackagingAmt = parseFloat(totPackagingAmt) + parseFloat(Packaging);
totCgst = parseFloat(totCgst ) + parseFloat(Cgst);
totSgst = parseFloat(totSgst ) + parseFloat(Sgst);
totIgst = parseFloat(totIgst ) + parseFloat(Igst);
totFreightAmt = parseFloat(totFreightAmt ) + parseFloat(Freight);
totInsuranceAmt = parseFloat(totInsuranceAmt ) + parseFloat(Insurance);
totOrderSummaryAmt = parseFloat(totOrderSummaryAmt ) + parseFloat(TotalVal);
}
} while (i < editrow);
$('#txtTotBasicAmount').val(parseFloat(totBasicAmt).toFixed(2) );
$('#txtTotalDiscount').val(parseFloat(totDiscountAmt).toFixed(2) );
$('#txtTotalPackaing').val(parseFloat(totPackagingAmt).toFixed(2) );
$('#txtTotalCGST').val(parseFloat(totCgst).toFixed(2) );
$('#txtTotalSGST').val(parseFloat(totSgst).toFixed(2) );
$('#txtTotalIGST').val(parseFloat(totIgst).toFixed(2) );
$('#txtTotalFreight').val(parseFloat(totFreightAmt).toFixed(2) );
$('#txtTotalInsurance').val(parseFloat(totInsuranceAmt).toFixed(2) );
$('#txtTotalOrderValueSummary').val(parseFloat(totOrderSummaryAmt).toFixed(2) );
}
function clearRevenueModalFields()
{
// To reset the Modal controls
$('#ReqNo').val('0');
$('#deptName').val('');
$('#CostCenter').val("0");
$('#AvlBudAmt').val('');
$('#MaterialCode').val("0") ;
$("#ItemName").val('');
$('#UOM').val('');
$('#AddPer').val('');
$('#Quantity').val('');
$("#Rate").val('');
$("#DiscountType").val('0');
$("#txtDiscount").val('');
$("#txtAfterDiscount").val('');
$("#PackagingType").val('0');
$("#txtPackaging").val('');
$("#txtAfterPackaging").val('');
$("input:radio[name='optPackaging'][value='0']").prop('checked', 'checked');
$("input:radio[name='optExcise'][value='0']").prop('checked', 'checked');
$("input:radio[name='optVat'][value='0']").prop('checked', 'checked');
$("input:radio[name='optCST'][value='0']").prop('checked', 'checked');
$("#Cgst").val('0');
$("#Sgst").val('0');
$("#Igst").val('0');
$("#AfterCgst").val('0');
$("#AfterSgst").val('0');
$("#AfterIgst").val('0');
$("#drpFreight").val('0');
$("#txtFreight").val('');
$("#txtAfterFreight").val('');
$("#NOOfTrips").val('');
$("#txtBasicValue").val('');
$("#txtInsurance").val('');
$("#txtTotalOrderValue").val('');
tinyMCE.activeEditor.setContent('');
}
function validateEditRevenueTax()
{
if($('#EditCostCenter').val() == "0")
{
alert('Please select the Cost center');
$('#EditCostCenter').focus();
return false;
}
else if($('#EditMaterialCode').val() == "0")
{
alert('Please select the Material Code');
$('#EditMaterialCode').focus();
return false;
}
else if($('#EditQuantity').val() == '')
{
alert('Please Enter the Quantity value');
$('#EditQuantity').focus();
return false;
}
else if($('#EditRate').val() == '')
{
alert('Please Enter the Rate of the Item');
$('#EditRate').focus();
return false;
}
else
{
return true;
}
}
function calculateCgstTax(varBasicValue,Cgst,discount,pack,freight)
{
//alert("Working");
var discount1 = discount;
//alert('dis'+discount1);
var basicValue1 = parseFloat(varBasicValue-discount1);
//alert('basicValue1'+basicValue1);
var packaging = parseFloat(pack);
//alert('packaging'+packaging);
var freight1 = parseFloat(freight);
//alert('freight1'+freight1);
var packfreight =parseFloat(packaging)+parseFloat(freight1);
//alert('packfreight'+packfreight);
var basicValue =parseFloat(basicValue1+packfreight)
var Cgst = parseFloat(Cgst);
//alert(basicValue+'-'+Cgst);
var ServiceTaxValue = 0.0;
ServiceTaxValue = <?php echo SERVICETAX_CGST; ?>;//((Cgst/100) * basicValue)
var TAXval = parseFloat(ServiceTaxValue).toFixed(2);
//alert('FInal' + TAXval);
$('#ViewAfterCGST').val(TAXval);
$('#ViewAfterSGST').val(TAXval);
return TAXval;
}
function calculateSgstTax(varBasicValue,Sgst,discount,pack,freight)
{
var discount1 = discount;
var basicValue1 = parseFloat(varBasicValue-discount1);
var packaging = parseFloat(pack);
//alert('f'+packaging);
var freight1 = parseFloat(freight);
var packfreight =parseFloat(packaging)+parseFloat(freight1);
var basicValue =parseFloat(basicValue1+packfreight)
var Sgst = parseFloat(Sgst);
var ServiceTaxValue = 0.0;
ServiceTaxValue = <?php echo SERVICETAX_SGST; ?>;
var TAXval = parseFloat(ServiceTaxValue).toFixed(2);
return TAXval;// $('#AfterServiceTax').val(TAXval);
}
function calculateIgstTax(varBasicValue,Igst,discount,pack1,freight1)
{
var discount = discount;
var packaging=parseFloat(pack1);
var freight=parseFloat(freight1);
var packfreight=parseFloat(packaging)+parseFloat(freight);
var basicValue1 = parseFloat(varBasicValue-discount);
var basicValue =parseFloat(basicValue1+packfreight)
//alert(basicValue);
var Igst = parseFloat(Igst);
//alert(Igst);
var ServiceTaxValue = 0.0;
ServiceTaxValue = <?php echo SERVICETAX_IGST; ?>;
var TAXval = parseFloat(ServiceTaxValue).toFixed(2);
$('#ViewAfterIGST').val(TAXval);
return TAXval;// $('#AfterServiceTax').val(TAXval);
}
</script>
<script>
function validateBudgetExceedLimit()
{
var rows = document.getElementById('revenueTax').rows.length;
var ReqType = '<?php echo REVENUE ?>';
for (i = 1; i < rows; i++) {
var costcode = $('#costCode'+i).val();
var basicAmountRate = parseFloat($('#basicval'+i).val());
var totalAmount = parseFloat($('#TotalOrderValue'+i).val());
var avalbudAmt = '';
$.ajax({
data:{id:costcode},
type:"POST",
url:"<?php echo base_url() ?>servicepurchaseorder/AvilBudgetAmount?ReqType="+ReqType,
success:function(data) {
if(data)
{
//alert(data);
avalbudAmt = parseFloat(data);
// if(basicAmountRate > avalbudAmt || totalAmount > avalbudAmt)
// {
// alert('Basic amount is exceeding the Budget Limit.Please adjust the product value.');
// $('#Rate').focus();
// return false;
// }
// else
// {
return true;
//}
}
}
});
}
}
function DeleteRow(rowid)
{
var id = [];
var DelRows = $('#txtDeletedRow').val();
//alertMaterialListrowid);
var tr = document.getElementById(rowid);
// var cellval = tr.cells;
var MaterialCode = $('#materialCode'+rowid).val();
var LineItemNo =$('#LineItemNo'+rowid).val();
var ReqNo =$('#Reqnumber'+rowid).val();
var POType ='<?php echo REVENUE ?>';
id[0]= LineItemNo;
id[1]= ReqNo;
id[2]= MaterialCode;
id[3]= POType;
var answer = confirm(" Do you want to delete the Item from the List?")
if (answer)
{
populateValueMainFormForDeleteItem(rowid);
tr.parentNode.removeChild(tr);
var removeItem = $('#materialCode'+rowid).val();
SelectedMaterialCode.splice( SelectedMaterialCode.indexOf('removeItem'), 1 );
$.each(SelectedMaterialList.Mat, function(i, el){
if (this.materialCode == removeItem){//Type = '';
SelectedMaterialList.Mat.splice(i, 1);
}
});
var x = <?php echo json_encode($POItem, JSON_PRETTY_PRINT) ?>;
var result = '0';
$.each(x, function(idx, obj) {
if(obj.LineItemNo === LineItemNo)
{
result = '1';
return false;
}
});
if(result == '0')
{
var DelRows = $('#txtDeletedRow').val();
//tr.parentNode.removeChild(tr);
if(DelRows != '')
{
DelRows = DelRows + ":" + rowid;
}
else
{
DelRows= "0" + ":" + rowid;
}
$('#txtDeletedRow').val(DelRows);
}
// To delete the value from Tables
else if(result == '1')
{
var DelRows = $('#txtDeletedRow').val();
//tr.parentNode.removeChild(tr);
if(DelRows != '')
{
DelRows = DelRows + ":" + rowid;
}
else
{
DelRows= "0" + ":" + rowid;
}
$('#txtDeletedRow').val(DelRows);
$.ajax({
data:{id:id},
type:"POST",
url:"<?php echo base_url() ?>purchaseorder/DeletePODetails",
success:function(data) {
if(data)
{
$('#content').loader('hide');
alert(data);
}
else
{
alert("Error");
}
}});
}
//populateValueMainFormForDeleteItem(rowid);
}
}
function populateValueMainFormForDeleteItem(rowid)
{
var totBasicAmt = $('#txtTotBasicAmount').val();
var totDiscountAmt = $('#txtTotalDiscount').val();
var totPackagingAmt = $('#txtTotalPackaing').val();
var totCgst = $('#txtTotalCGST').val();
var totSgst = $('#txtTotalSGST').val();
var totIgst = $('#txtTotalIGST').val();
var totFreightAmt = $('#txtTotalFreight').val();
var totInsuranceAmt = $('#totInsuranceAmt').val();
var totOrderSummaryAmt = $('#txtTotalOrderValueSummary').val();
var Packaging = $('#AfterPackVal'+rowid).val() == '' ? '0.00' : $('#AfterPackVal'+rowid).val();
var Freight = $('#AfterFreightVal'+rowid).val() == '' ? '0.00' : $('#AfterFreightVal'+rowid).val();
var Insurance = $('#Insval'+rowid).val() == '' ? '0.00' : $('#Insval'+rowid).val();
var Discount =$('#AfterDisVal'+rowid).val() == '' ? '0.00' : $('#AfterDisVal'+rowid).val();
var BasicVal = $('#basicval'+rowid).val() == '' ? '0.00' : $('#basicval'+rowid).val();
var TotalVal =$('#TotalOrderValue'+rowid).val() == '' ? '0.00' : $('#TotalOrderValue'+rowid).val();
//alert(TotalVal);
var Cgst = $('#RevenueAfterCgst'+rowid).val() == '' ? '0.00' : $('#RevenueAfterCgst'+rowid).val();
var Sgst =$('#RevenueAfterSgst'+rowid).val() == '' ? '0.00' : $('#RevenueAfterSgst'+rowid).val();
var Igst = $('#RevenueAfterIgst'+rowid).val() == '' ? '0.00' : $('#RevenueAfterIgst'+rowid).val();
totBasicAmt = parseFloat(totBasicAmt ) - parseFloat(BasicVal);
totDiscountAmt = parseFloat(totDiscountAmt ) - parseFloat(Discount);
totPackagingAmt = parseFloat(totPackagingAmt) - parseFloat(Packaging);
totFreightAmt = parseFloat(totFreightAmt ) - parseFloat(Freight);
totInsuranceAmt = parseFloat(totInsuranceAmt ) - parseFloat(Insurance);
totOrderSummaryAmt = parseFloat(totOrderSummaryAmt ) - parseFloat(TotalVal);
totCgst = parseFloat(totCgst ) - parseFloat(Cgst);
totSgst = parseFloat(totSgst ) - parseFloat(Sgst);
totIgst = parseFloat(totIgst ) - parseFloat(Igst);
$('#txtTotBasicAmount').val((parseFloat(totBasicAmt)).toFixed(2) );
$('#txtTotalDiscount').val((parseFloat(totDiscountAmt)).toFixed(2) );
$('#txtTotalPackaing').val((parseFloat(totPackagingAmt)).toFixed(2) );
$('#txtTotalCGST').val((parseFloat(totCgst)).toFixed(2) );
$('#txtTotalSGST').val((parseFloat(totSgst)).toFixed(2) );
$('#txtTotalIGST').val((parseFloat(totIgst)).toFixed(2) );
$('#txtTotalFreight').val((parseFloat(totFreightAmt)).toFixed(2) );
$('#totInsuranceAmt').val((parseFloat(totInsuranceAmt)).toFixed(2) );
$('#txtTotalOrderValueSummary').val((parseFloat(totOrderSummaryAmt)).toFixed(2) );
}
function Save(status)
{
if(status == '0')
{
stat = '<?php echo PO_DRAFT; ?>';
}
else if(status == '1')
{
stat = '<?php echo PO_CREATED; ?>';
}
else
{
stat = '<?php echo $PONOStatus;?>';
}
var deladd = $('#DeliveryAddr').val();
$('#txtStatus').val(stat);
tinyMCE.triggerSave();
var splinstr = $('#txtSpcialInstruction').val();
$('#SpcialInstruction').val(splinstr);
$('#txtDeliveryAddress').val(deladd);
var AvlBudAmt = '<?php echo number_format($AvlAmount+$totBasicAmt-$totDiscountAmt, 2, '.', '') ?>';
var txtTotalbasicamount = $('#txtTotBasicAmount').val();
var totaldiscount = $('#txtTotalDiscount').val();
//alert(txtTotalbasicamount+'-'+totaldiscount);
//alert(txtTotalbasicamount-totaldiscount);
if(validate())
{
if(document.getElementById('revenueTax').rows.length < 2)
{
alert('Please Select Line item to Create PO');
$('#Deliverydt').focus();
return false;
}
//else if(validateBudgetExceedLimit())
//{
// return false;
//}
// else if(parseInt(AvlBudAmt) < (parseInt(txtTotalbasicamount)- parseInt(totaldiscount))){
// alert('Total Order Amount is exceeding the Budget Limit.Please adjust the product value.');
// return false;
// }
else if($('#Otherpayment').val()=='' && $('#PaymentTerms').val()=='PT08'){
alert('Please Enter Payable Terms Description');
$('#Otherpayment').focus();
return false;
}
else if($('#insurancestatus').val() == 1 && $('#insuranceno').val() == ''){
alert('Please Enter Insurance No..!');
$('#insurance').focus();
return false;
}
else
{
$('#content').loader('show');
$.ajax({
data:$('.CreatePO').serialize(),
type:"POST",
url:"<?php echo base_url() ?>purchaseorder/EditRevenuePurchaseOrder",
success:function(data) {
if(data)
{
$('#content').loader('hide');
alert(data);
$('#txtRowCount').val('');
$('#txtDeletedRow').val('');
$('#txtStatus').val('');
$('#SpcialInstruction').val('');
$('#txtDeliveryAddress').val('')
window.location ="purchaseorderListing";
}
else
{
$('#content').loader('hide');
alert("Error");
}
}
});
}
}
}
// this function is used to clear data changing schedule option
$('#Scheduleby').change(function(){
$("#Deliverydt").datepicker({
minDate : 'now',
dateFormat: 'mm/dd/yy',changeMonth: true, changeYear: true
}); //,yearRange: '0:+10's
});
$('#Deliverydt').change(function(){
$('#Scheduleby').val('');
});
$(function () {
$('#revenueTax').DataTable({
"paging": false,
"lengthChange": false,
"searching": false,
//"ordering": true,
// "info": true,
"autoWidth": false
});
});
function RevenueChangeSgst(){
var getTypeOfTax= $("input:radio[name='Range']:checked").val();
if(getTypeOfTax==0){
$('#Sgst').val($('#Cgst').val());
change();
}
}
function RevenueChangeEditSgst(){
var getEditTypeOfTax= $("input:radio[name='Range']:checked").val();
if(getEditTypeOfTax==0){
$('#EditSgst').val($('#EditCgst').val());
Editchange();
}
}
function RevenueChangeviewSgst(){
var getTypeOfTax= $("input:radio[name='Range']:checked").val();
if(getTypeOfTax==0){
$('#ViewSGST').val($('#ViewCGST').val());
change();
}
}
function change(){
ExceedQuantityCheck();
if($('#Quantity').val() != '' && $('#Rate').val() != '')
{
var txtQuantity = parseFloat( $('#Quantity').val());
var txtUnitPrice = parseFloat($('#Rate').val());
var Tot = txtQuantity * txtUnitPrice
$('#txtBasicValue').val(parseFloat(Tot).toFixed(2));
if ($("#DiscountType").val()!=0) {
calculateDiscount(0);
}
if ($("#PackagingType").val()!=0) {
calculatePackaging(0);
}
if($("#drpFreight").val()!=0){
calculateFreight(0);
}
if($("#Cgst").val()!=''){
$('#AfterCgst').val(calculateCgstTax($('#txtBasicValue').val(),$('#Cgst').val(),$('#txtAfterDiscount').val() == '' ? '0.00' : $('#txtAfterDiscount').val(),$("#txtAfterPackaging").val()== '' ? "0.00" : $('#txtAfterPackaging').val(),$("#txtAfterFreight").val()== '' ? "0.00" : $('#txtAfterFreight').val()));
}
if($("#Sgst").val()!=''){
$('#AfterSgst').val(calculateSgstTax($('#txtBasicValue').val(),$('#Sgst').val(),$('#txtAfterDiscount').val() == '' ? '0.00' : $('#txtAfterDiscount').val(),$("#txtAfterPackaging").val()== '' ? "0.00" : $('#txtAfterPackaging').val(),$("#txtAfterFreight").val()== '' ? "0.00" : $('#txtAfterFreight').val()));
}
if($("#Igst").val()!=''){
$('#AfterIgst').val(calculateIgstTax($('#txtBasicValue').val(),$('#Igst').val(),$('#txtAfterDiscount').val() == '' ? '0.00' : $('#txtAfterDiscount').val(),$("#txtAfterPackaging").val()== '' ? "0.00" : $('#txtAfterPackaging').val(),$("#txtAfterFreight").val()== '' ? "0.00" : $('#txtAfterFreight').val()));
}
calculateTotalValue();
}
}
function calculateTotalValue()
{
var Packaging = $('#txtAfterPackaging').val() == '' ? '0.00' : $('#txtAfterPackaging').val();
var Cgst = $('#AfterCgst').val() == '' ? '0.00' : $('#AfterCgst').val();
var Sgst = $('#AfterSgst').val() == '' ? '0.00' : $('#AfterSgst').val();
var Igst = $('#AfterIgst').val() == '' ? '0.00' : $('#AfterIgst').val();
var Freight = $('#txtAfterFreight').val() == '' ? '0.00' : $('#txtAfterFreight').val();
var Insurance = $('#txtInsurance').val() == '' ? '0.00' : $('#txtInsurance').val();
var Discount = $('#txtAfterDiscount').val() == '' ? '0.00' : $('#txtAfterDiscount').val();
var BasicVal = $('#txtBasicValue').val() == '' ? '0.00' : $('#txtBasicValue').val();
var totvalue = ( parseFloat(BasicVal) + parseFloat(Packaging)+ parseFloat(Cgst) + parseFloat(Sgst)+ parseFloat(Igst) + parseFloat(Freight) + parseFloat(Insurance)) - parseFloat(Discount);
var tot = parseFloat(totvalue).toFixed(2);
$('#txtTotalOrderValue').val(tot);
//validateExceedLimit();
// ExceedQuantityCheck();
}
function calculateTaxValue()
{
var Packaging = $('#txtAfterPackaging').val() == '' ? '0.00' : $('#txtAfterPackaging').val();
var AfterCgst = $("#AfterCgst").val();
var AfterSgst = $("#AfterSgst").val();
var AfterIgst = $("#AfterIgst").val();
var Freight = $('#txtAfterFreight').val() == '' ? '0.00' : $('#txtAfterFreight').val();
var Insurance = $('#txtInsurance').val() == '' ? '0.00' : $('#txtInsurance').val();
var Discount = $('#txtAfterDiscount').val() == '' ? '0.00' : $('#txtAfterDiscount').val();
var totvalue = parseFloat(AfterCgst)+ parseFloat(AfterSgst) + parseFloat(AfterIgst) ;
var tot = parseFloat(totvalue).toFixed(2);
//alert('tot:'+tot);
return tot;
}
//If others is the payment terms to display mandatory field
$("#PaymentTerms").change(function() {
if ($('#PaymentTerms').val().trim()=='PT08')
{
$('#otheroptiondiv').show();
}
else {
$('#otheroptiondiv').hide();
$('#Otherpayment').val('');
}
});
$('#ReqNo').change(function() {
var id = $('#ReqNo').val();
$("#deptName").val('');
$("#CostCenter").val('');
$("#MaterialCode").empty();
$("#ItemName").val('');
$("#UOM").val('');
$("#Quantity").val('');
$("#ItemName").val('');
$("#Rate").val('');
$("#txtBasicValue").val('');
$("#AvlBudAmt").val('');
resetTaxField();
if(id != '0')
{
var y = <?php echo json_encode($RequistionDetails, JSON_PRETTY_PRINT) ?>;
var Material = <?php echo json_encode($MaterialList, JSON_PRETTY_PRINT) ?>;
var AvlBudAmt = '<?php echo $AvlAmount?>';
AvlBudAmt = '<?php echo number_format($AvlAmount+$totBasicAmt-$totDiscountAmt, 2, '.', '') ?>';
// For Binding DepartmentName
$.each(y, function(idx, obj) {
if(obj.ReqNo === id)
{
$("#deptName").val(obj.DepartmentName);
$("#CostCenter").val(obj.CostCenterCode);
}
});
$("#AvlBudAmt").val(AvlBudAmt);
// For Binding Material list center for the selected Requistion Number
$("#MaterialCode").append( $('<option></option>').val("0").html("Select Material Code") );
var isAdded = "0";
for(i=0;i<Material.length;i++)
{
$.each(Material[i], function(idx, obj) {
if(obj.ReqNo === id )
{
$.each(SelectedMaterialList.Mat, function(idx1, el){
if (id == el.ReqNo )
{
if(el.materialCode == obj.MaterialCode)
{
isAdded = "1";
return false;
}
else
{
isAdded = "0";
}
}
});
if(isAdded == "0")
{
$("#MaterialCode").append( $('<option></option>').val(obj.MaterialCode).html(obj.MaterialCode + "-" + obj.MaterialName));
}
}
});
}
}
else
{
alert('Please select the Requisition Number');
return false;
}
id = '';
});
$("#EDITREVENUE").on("shown.bs.modal", function(e) {
var AvlBudAmt = '<?php echo $AvlAmount?>';
AvlBudAmt = '<?php echo number_format($AvlAmount+$totBasicAmt-$totDiscountAmt, 2, '.', '') ?>';
userid = $(e.relatedTarget).data('userid');
$('#isEdit').val(1);
//alert(userid);
var tr= document.getElementById(userid);
var cellval = tr.cells;
var id= $('#Reqnumber'+userid).val();
$('#EditReqNo').val($('#Reqnumber'+userid).val());
$('#EditdeptName').val($('#departmentName'+userid).val());
$("#EditCostCenter").val($('#costCode'+userid).val());
$('#EditAvlBudAmt').val(AvlBudAmt);
//
$('#EditItemName').val($('#materialName'+userid).val());
$('#EditUOM').val($('#uom'+userid).val());
$('#EditQuantity').val($('#quantity'+userid).val());
tinyMCE.get('Edit_Service_Description').setContent($('#service_description'+userid).val());
$('#EditRate').val($('#itemRate'+userid).val());
var per=$('#per'+userid).val()
if(per == ''){
$('#EditPer').val($('#uom'+userid).val());
}else{
$('#EditPer').val($('#per'+userid).val());
}
$('#txtEditBasicValue').val(cellval[7].innerHTML);
RequistQuantity = $('#quantity'+userid).val();
$('#txtEditDiscount').val($('#DisVal'+userid).val());
$('#txtEditAfterDiscount').val($('#AfterDisVal'+userid).val());
$('#txtEditPackaging').val($('#PackVal'+userid).val());
$('#txtEditAfterPackaging').val($('#AfterPackVal'+userid).val());
$('#txtEditFreight').val($('#FreightVal'+userid).val());
$('#txtEditAfterFreight').val($('#AfterFreightVal'+userid).val());
var FreightType =$('#FreightType'+userid).val();
$('#EditNOOfTrips').val($('#NoOfTrip'+userid).val());
if (FreightType == "PER TRIP"){
$('#EditTripsValue').show();
}
else{
$('#EditTripsValue').hide();
}
$('#txtEditInsurance').val($('#Insval'+userid).val());
$('#txtEditTotalOrderValue').val($('#TotalOrderValue'+userid).val());
var x = $("input:radio[name='Range']:checked").val();
$('#EditAfterCgst').val($('#RevenueAfterCgst'+userid).val());
$('#EditAfterSgst').val($('#RevenueAfterSgst'+userid).val());
$('#EditAfterIgst').val($('#RevenueAfterIgst'+userid).val());
$('#EditCgst').val($('#RevenueCgst'+userid).val());
$('#EditSgst').val($('#RevenueSgst'+userid).val());
$('#EditIgst').val($('#RevenueIgst'+userid).val());
$("#EditMaterialCode").empty();
var Material = <?php echo json_encode($MaterialList, JSON_PRETTY_PRINT) ?>;
// For Binding Material list center for the selected Requistion Number
$("#EditMaterialCode").append( $('<option></option>').val($('#materialCode'+userid).val()).html($('#materialCode'+userid).val() + "-" + $('#materialName'+userid).val() ) );
var isAdded = "0";
for(i=0;i<Material.length;i++)
{
$.each(Material[i], function(idx, obj) {
if(obj.ReqNo === id )
{
$.each(SelectedMaterialList.Mat, function(idx1, el){
if (id == el.ReqNo )
{
if(el.materialCode == obj.MaterialCode)
{
isAdded = "1";
return false;
}
else
{
isAdded = "0";
}
}
});
if(isAdded == "0")
{
$("#EditMaterialCode").append( $('<option></option>').val(obj.MaterialCode).html(obj.MaterialCode + "-" + obj.MaterialName));
}
}
});
}
$("#EditDiscountType").val($('#DisType'+userid).val());
$("#drpEditFreight").val($('#FreightType'+userid).val());
$("#EditPackagingType").val($('#PackType'+userid).val())
$("input:radio[name='optPackaging'][value='"+$('#PackOption'+userid).val()+"']").prop('checked', 'checked');
$("input:radio[name='optExcise'][value='"+$('#ExciseOption'+userid).val()+"']").prop('checked', 'checked');
$("input:radio[name='optVat'][value='"+$('#VatOption'+userid).val()+"']").prop('checked', 'checked');
$("input:radio[name='optCST'][value='"+$('#CSTOption'+userid).val()+"']").prop('checked', 'checked');
});
$("#VIEWREVENUE").on("shown.bs.modal", function(e) {
var AvlBudAmt = '<?php echo $AvlAmount?>';
AvlBudAmt = '<?php echo number_format($AvlAmount+$totBasicAmt-$totDiscountAmt, 2, '.', '') ?>';
userid = $(e.relatedTarget).data('userid');
$('#isEdit').val(1);
//alert(userid);
var tr= document.getElementById(userid);
var cellval = tr.cells;
var id= $('#Reqnumber'+userid).val();
$('#ViewReqNo').val($('#Reqnumber'+userid).val());
$('#ViewdeptName').val($('#departmentName'+userid).val());
$("#ViewCostCenter").val($('#costCode'+userid).val());
$('#ViewAvlBudAmt').val(AvlBudAmt);
//
$('#ViewItemName').val($('#materialName'+userid).val());
$('#ViewUOM').val($('#uom'+userid).val());
$('#ViewQuantity').val($('#quantity'+userid).val());
$('#ViewRate').val($('#itemRate'+userid).val());
$('#ViewPer').val($('#per'+userid).val());
$('#txtViewBasicValue').val(cellval[7].innerHTML);
RequistQuantity = $('#quantity'+userid).val();
$('#txtViewDiscount').val($('#DisVal'+userid).val());
$('#txtViewAfterDiscount').val($('#AfterDisVal'+userid).val());
tinyMCE.get('View_Service_Description').setContent($('#service_description'+userid).val());
$('#txtViewPackaging').val($('#PackVal'+userid).val());
$('#txtViewAfterPackaging').val($('#AfterPackVal'+userid).val());
$('#txtViewFreight').val($('#FreightVal'+userid).val());
$('#txtViewAfterFreight').val($('#AfterFreightVal'+userid).val());
$('#txtViewInsurance').val($('#Insval'+userid).val());
var FreightType =$('#FreightType'+userid).val();
$('#ViewNOOfTrips').val($('#NoOfTrip'+userid).val());
if (FreightType == "PER TRIP"){
$('#ViewTripsValue').show();
}
else{
$('#ViewTripsValue').hide();
}
$('#txtViewTotalOrderValue').val($('#TotalOrderValue'+userid).val());
$('#ViewAfterCGST').val($('#RevenueAfterCgst'+userid).val());
$('#ViewAfterSGST').val($('#RevenueAfterSgst'+userid).val());
$('#ViewAfterIGST').val($('#RevenueAfterIgst'+userid).val());
$('#ViewCGST').val($('#RevenueCgst'+userid).val());
$('#ViewSGST').val($('#RevenueSgst'+userid).val());
$('#ViewIGST').val($('#RevenueIgst'+userid).val());
$("#ViewMaterialCode").empty();
var Material = <?php echo json_encode($MaterialList, JSON_PRETTY_PRINT) ?>;
// For Binding Material list center for the selected Requistion Number
$("#ViewMaterialCode").val($('#materialCode'+userid).val());
$("#ViewDiscountType").val($('#DisType'+userid).val());
$("#drpViewFreight").val($('#FreightType'+userid).val());
$("#ViewPackagingType").val($('#PackType'+userid).val())
$("input:radio[name='optPackaging'][value='"+$('#PackOption'+userid).val()+"']").prop('checked', 'checked');
$("input:radio[name='optExcise'][value='"+$('#ExciseOption'+userid).val()+"']").prop('checked', 'checked');
$("input:radio[name='optVat'][value='"+$('#VatOption'+userid).val()+"']").prop('checked', 'checked');
$("input:radio[name='optCST'][value='"+$('#CSTOption'+userid).val()+"']").prop('checked', 'checked');
});
</script>
<script>
$('#insurancestatus').change(function(){
var ans=$("#insurancestatus").val();
//alert(ans);
if(ans == 0){
$("#insurancenodiv").hide();
//$("#insuranceno").val("");
}
else {
$("#insurancenodiv").show();
$("#insuranceno").val("Yes");
}
});
function splpoupdate(){
var formData = new FormData();
var file = $("#imag").prop('files')[0];
var param1 = $('#hidebillno').val();
var param2 = $('#hideoldfile').val();
var filename = $("#imag").val();
filename = filename.split('\\');
formData.append('file',file);
formData.append('param1',param1);
formData.append('param2',param2);
$('.content').loader('show');
$.ajax({
data:formData,
type:"POST",
url:"<?php echo base_url() ?>purchaseorder/uploadfile",
cache : false,
contentType : false,
processData : false,
success:function(data) {
if(data){
alert(data);
$('.content').loader('hide');
$('#spl').find('td').eq(5).text(filename[2]);
$('#EditRevenueSplPOModel').modal('hide');
}
}
});
}
function filecheck()
{
var sizef = document.getElementById('imag').files[0].size;
var file = $('#imag').val();
if(file!='' && sizef < 2100000)
{ // alert('Your file added successfully');
}
else
{
alert('Sorry Your File is Large To 2MB');
$('#imag').val('');
}
}
</script>