4254 lines
144 KiB
PHP
Executable File
4254 lines
144 KiB
PHP
Executable File
<style>
|
||
.edit-container {
|
||
display: inline-flex;
|
||
align-items: center;
|
||
gap: 10px;
|
||
}
|
||
|
||
.edit-input-field {
|
||
padding: 2px;
|
||
font-size: 14px;
|
||
border: 1px solid #ccc;
|
||
border-radius: 4px;
|
||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
||
width: 150px;
|
||
}
|
||
|
||
.edit-input-field:focus {
|
||
outline: none;
|
||
border-color: #007bff;
|
||
box-shadow: 0 0 5px rgba(0, 123, 255, 0.5);
|
||
}
|
||
|
||
.save-btn, .cancel-btn {
|
||
border: none;
|
||
background: none;
|
||
cursor: pointer;
|
||
font-size: 16px;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
width: 30px;
|
||
height: 30px;
|
||
border-radius: 50%;
|
||
transition: background-color 0.3s ease;
|
||
}
|
||
|
||
.save-btn {
|
||
color: #28a745;
|
||
background-color: #e8f5e9;
|
||
}
|
||
|
||
.save-btn:hover {
|
||
background-color: #c3e6cb;
|
||
}
|
||
|
||
.cancel-btn {
|
||
color: #dc3545;
|
||
background-color: #f8d7da;
|
||
}
|
||
|
||
.cancel-btn:hover {
|
||
background-color: #f5c6cb;
|
||
}
|
||
</style>
|
||
<script>
|
||
$(document).ready(function() {
|
||
$(document).on('click', '.editable-field', function (e) {
|
||
e.preventDefault();
|
||
const $link = $(this);
|
||
const value = $link.text().trim();
|
||
|
||
// Hide the <a> tag and show the edit container
|
||
$link.hide();
|
||
const $editContainer = $link.siblings('.edit-container');
|
||
$editContainer.find('.edit-input-field').val(value);
|
||
$editContainer.show();
|
||
});
|
||
|
||
// Handle click on the tick (save) button
|
||
$(document).on('click', '.save-btn', function (e) {
|
||
e.preventDefault();
|
||
const $btn = $(this);
|
||
const $editContainer = $btn.closest('.edit-container');
|
||
const $input = $editContainer.find('.edit-input-field');
|
||
const value = $input.val().trim();
|
||
const $link = $editContainer.siblings('.editable-field');
|
||
const LineItemNoteForAuditor = $link.data('notes');
|
||
const id = $link.data('id');
|
||
$("#LineItemNoteForAuditor" + id).val(value); // to update the hidden fields
|
||
$link.text(value).show(); // to update table cell
|
||
$editContainer.hide();
|
||
});
|
||
|
||
// Handle click on the close (cancel) button
|
||
$(document).on('click', '.cancel-btn', function (e) {
|
||
e.preventDefault();
|
||
const $btn = $(this);
|
||
const $editContainer = $btn.closest('.edit-container');
|
||
const $link = $editContainer.siblings('.editable-field');
|
||
|
||
// Hide the edit container and show the <a> tag
|
||
$editContainer.hide();
|
||
$link.show();
|
||
});
|
||
|
||
// When the second modal is about to be shown
|
||
$('#freightcalmodel').on('show.bs.modal', function() {
|
||
// Set a higher z-index for the second modal to appear on top
|
||
$('#freightcalmodel').css('z-index', 1060); // Set the z-index for the second modal
|
||
// Ensure the second modal backdrop appears above the first one
|
||
setTimeout(function() {
|
||
$('.modal-backdrop').last().css('z-index', 1055);
|
||
}, 0);
|
||
});
|
||
|
||
// Reset z-index when the second modal is hidden (optional)
|
||
$('#freightcalmodel').on('hidden.bs.modal', function() {
|
||
$('#freightcalmodel').css('z-index', ''); // Reset to default
|
||
});
|
||
|
||
$('#packagingcalmodel').on('show.bs.modal', function() {
|
||
// Set a higher z-index for the second modal to appear on top
|
||
$('#packagingcalmodel').css('z-index', 1060); // Set the z-index for the second modal
|
||
// Ensure the second modal backdrop appears above the first one
|
||
setTimeout(function() {
|
||
$('.modal-backdrop').last().css('z-index', 1055);
|
||
}, 0);
|
||
});
|
||
|
||
// Reset z-index when the second modal is hidden (optional)
|
||
$('#packagingcalmodel').on('hidden.bs.modal', function() {
|
||
$('#packagingcalmodel').css('z-index', ''); // Reset to default
|
||
});
|
||
});
|
||
</script>
|
||
<?php $ReqType = '';
|
||
$CompanyAddress = '';
|
||
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
|
||
$CurrentDate = $dt->format('d-m-Y');
|
||
$MaxPoDate = '';
|
||
$AvlAmount = 0;
|
||
$Value = "₹";
|
||
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;
|
||
}
|
||
}
|
||
//echo "$INRSYM";
|
||
?>
|
||
|
||
|
||
|
||
<style>
|
||
.modal { overflow: auto !important; }
|
||
</style>
|
||
|
||
<!-- Rich text -->
|
||
<script src="<?php echo base_url() ?>public/assets/tinymce/js/tinymce/tinymce.min.js"></script>
|
||
<script src="<?php echo base_url(); ?>public/assets/js/CreatePOValidation.js" type="text/javascript"></script>
|
||
<script type="text/javascript">
|
||
tinymce.init({
|
||
selector: "textarea#txtSpcialInstruction",
|
||
menubar: false,
|
||
statusbar: false,
|
||
toolbar: false
|
||
});
|
||
tinymce.init({
|
||
selector: "textarea#Service_Description",
|
||
menubar: false,
|
||
statusbar: false,
|
||
toolbar: false
|
||
});
|
||
tinymce.init({
|
||
selector: "textarea#Edit_Service_Description",
|
||
menubar: false,
|
||
statusbar: false,
|
||
toolbar: false
|
||
});
|
||
</script>
|
||
|
||
<script>
|
||
$(document).ready(function() {
|
||
$("#PaymentTerms").select2();
|
||
|
||
|
||
clearTotalItemValues();
|
||
if ($("#insurance").val() == 1) {
|
||
|
||
$("#InsuranceNumberdiv").show();
|
||
$("#InsuranceNumber").val('Yes');
|
||
|
||
}
|
||
});
|
||
|
||
|
||
function openModal() {
|
||
if (vaildateBeforeOpenModal()) {
|
||
$('#REVENUE').modal('show');
|
||
}
|
||
}
|
||
|
||
function vaildateBeforeOpenModal() {
|
||
var radioValue = parseInt($("input[name='DateRange']:checked").val());
|
||
var scheduleBy = $('#Scheduleby').val();
|
||
|
||
if ($('#drpSupplier').val() == "0") {
|
||
alert('Please Select the Supplier details');
|
||
$('#drpSupplier').focus();
|
||
return false;
|
||
}else if ($('#PODate').val().trim() == '') {
|
||
alert('Please Enter the Purchase Order date');
|
||
$('#PODate').focus();
|
||
return false;
|
||
}else if ($('#DeliveryAddr').val().trim() == '') {
|
||
alert('Please Enter the Delivery Address');
|
||
$('#DeliveryAddr').focus();
|
||
return false;
|
||
}else if (radioValue === 0 && $('#Deliverydt').val() == '') {
|
||
alert('Please Select the Delivery Date');
|
||
$('#Deliverydt').focus();
|
||
return false;
|
||
}
|
||
else if ( radioValue == 1 && (scheduleBy.trim() == '' || scheduleBy == false))
|
||
{
|
||
alert('Please Enter the Schedule By');
|
||
$('#Scheduleby').focus();
|
||
return false;
|
||
|
||
}
|
||
else if ($('#PoTypeOptions').val() == "0") {
|
||
alert('Please Select Revenue Type');
|
||
$('#PoTypeOptions').focus();
|
||
return false;
|
||
}else if ($('#Otherpayment').val() == '' && $('#PaymentTerms').val() == 'PT08') {
|
||
alert('Please Enter Payable Terms Description');
|
||
$('#Otherpayment').focus();
|
||
return false;
|
||
}else if ($('#BudgetType').val() == "0") {
|
||
alert('Please Select Budget Type');
|
||
$('#BudgetType').focus();
|
||
return false;
|
||
} else {
|
||
return true;
|
||
}
|
||
|
||
}
|
||
|
||
var NilType = '<?php echo NILTYPE; ?>';
|
||
var PercentageType = '<?php echo PERCENTAGE; ?>';
|
||
var POMaxDate = '<?php echo $MaxPoDate; ?>';
|
||
var PackagingCalculation = '';
|
||
var ExciseCalculation = '';
|
||
var StateTaxCheck = '';
|
||
var VatCalculation = '';
|
||
var CSTCalculation = '';
|
||
var RequistQuantity = '';
|
||
var IsEdit = '0';
|
||
var d = new Date(POMaxDate);
|
||
var SelectedMaterialCode = [];
|
||
var SelectedMaterialList = {
|
||
Mat: []
|
||
};
|
||
var CollIndex = 0;
|
||
|
||
|
||
$(function() {
|
||
|
||
|
||
$('#PoTypeOptions').change(function() {
|
||
var potypeval = $('#PoTypeOptions').val();
|
||
var poopt = <?php echo json_encode($PoTypeOptions, JSON_PRETTY_PRINT) ?>;
|
||
var config = poopt[0].ConfigValue;
|
||
var Payment = <?php echo json_encode($Payment, JSON_PRETTY_PRINT) ?>;
|
||
var default1 = Payment[4].PaymentTerms;
|
||
|
||
if (potypeval == config) {
|
||
$('#PaymentTerms').empty();
|
||
$.each(Payment, function(idx, obj) {
|
||
if (obj.PaymentID == 'PT05') {
|
||
$("#PaymentTerms").append($('<option></option>').val(obj.PaymentID).html(obj.PaymentTerms));
|
||
}
|
||
});
|
||
|
||
$.each(Payment, function(idx, obj) {
|
||
if (obj.PaymentID == 'PT05') {
|
||
|
||
} else {
|
||
$("#PaymentTerms").append($('<option></option>').val(obj.PaymentID).html(obj.PaymentTerms));
|
||
}
|
||
|
||
});
|
||
}
|
||
$("#PaymentTerms").trigger('change');
|
||
});
|
||
|
||
$('#drpSupplier').change(function() {
|
||
|
||
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) {
|
||
if (obj.MSME) {
|
||
$("#SupAddress").val("MSME : " + obj.MSME + "\n" + obj.Address);
|
||
} else {
|
||
$("#SupAddress").val(obj.Address);
|
||
}
|
||
PaymentID = obj.PaymentID;
|
||
}
|
||
});
|
||
if (PaymentID != 'PT08') {
|
||
$('#otheroptiondiv').hide();
|
||
$('#Otherpayment').prop('required', false);
|
||
$('#Otherpayment').val('');
|
||
} else if (PaymentID == 'PT08') {
|
||
$('#otheroptiondiv').show();
|
||
$('#Otherpayment').prop('required', true);
|
||
}
|
||
$.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;
|
||
}
|
||
});
|
||
|
||
$('#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 ?>';
|
||
|
||
// For Binding DepartmentName
|
||
$.each(y, function(idx, obj) {
|
||
if (obj.ReqNo === id) {
|
||
$("#deptName").val(obj.DepartmentName);
|
||
$("#CostCenter").val(obj.CostCenterCode);
|
||
}
|
||
});
|
||
$("#AvlBudAmt").val(parseFloat(AvlBudAmt).toFixed(2));
|
||
|
||
|
||
// 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 = '';
|
||
|
||
});
|
||
|
||
$('#MaterialCode').change(function() {
|
||
// alert("**");
|
||
var id = $('#MaterialCode').val();
|
||
var drpSupplier = $('#drpSupplier').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);
|
||
$("#Rate").val(obj.material_rate);
|
||
RequistQuantity = obj.Quantity;
|
||
if(obj.material_rate != 0){
|
||
change();
|
||
}
|
||
}
|
||
});
|
||
}
|
||
|
||
$.ajax({
|
||
url: "<?php echo base_url() ?>VerifyWithSupplierForPendingPO",
|
||
type: 'POST',
|
||
data: {
|
||
supplierid: drpSupplier,
|
||
materialcode: id
|
||
},
|
||
success: function(response) {
|
||
if (response) alert(response);
|
||
}
|
||
});
|
||
} 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);
|
||
$("#EditRate").val(obj.material_rate);
|
||
RequistQuantity = obj.Quantity;
|
||
}
|
||
});
|
||
}
|
||
$.ajax({
|
||
url: "<?php echo base_url() ?>VerifyWithSupplierForPendingPO",
|
||
type: 'POST',
|
||
data: {
|
||
supplierid: drpSupplier,
|
||
materialcode: id
|
||
},
|
||
success: function(response) {
|
||
if (response) alert(response);
|
||
}
|
||
});
|
||
} else {
|
||
alert('Please select the MaterialCode');
|
||
return false;
|
||
}
|
||
|
||
});
|
||
|
||
/* Revenue Tax calcualation */
|
||
$('#DiscountType').change(function() {
|
||
if ($('#Rate').val() != '' && $('#MaterialCode').val() != "0") {
|
||
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('');
|
||
}
|
||
} else {
|
||
alert('Please Select MaterialCode and Rate Field Value');
|
||
$('#PackagingType').val("0");
|
||
$('#Rate').focus();
|
||
}
|
||
change();
|
||
});
|
||
|
||
|
||
$('#EditDiscountType').change(function() {
|
||
if ($('#EditRate').val() != '' && $('#EditMaterialCode').val() != "0") {
|
||
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('');
|
||
}
|
||
} else {
|
||
alert('Please Select MaterialCode and Rate Field Value');
|
||
$('#EditDiscountType').val("0");
|
||
$('#EditRate').focus();
|
||
}
|
||
Editchange();
|
||
});
|
||
var edit = '';
|
||
$('#PackagingType').change(function() {
|
||
if ($('#Rate').val() != '' && $('#MaterialCode').val() != "0") {
|
||
|
||
$('#txtPackaging').val('');
|
||
$('#txtAfterPackaging').val('');
|
||
selValue = $("#PackagingType").val();
|
||
if (selValue == PercentageType) {
|
||
var PackagingCalculation = '';
|
||
// $('#REVENUE').modal('hide');
|
||
edit = 'PackingCalculationOn';
|
||
$('#packagingcalmodel').modal('show');
|
||
$('#txtPackaging').removeAttr('readonly', 'true');
|
||
} else {
|
||
if (selValue == NilType) {
|
||
|
||
$('#txtPackaging').attr('readonly', 'true');
|
||
$('#txtPackaging').val('0.00');
|
||
$('#txtAfterPackaging').val("0.00");
|
||
change();
|
||
|
||
} else {
|
||
$('#txtPackaging').removeAttr('readonly', 'true');
|
||
}
|
||
}
|
||
} else {
|
||
alert('Please Select MaterialCode and Rate Field Value');
|
||
$('#PackagingType').val("0");
|
||
$('#Rate').focus();
|
||
}
|
||
calculatePackaging(0);
|
||
});
|
||
$('#packagingcalmodel').on('hidden.bs.modal', function() {
|
||
// Reopen the first modal when the second modal is closed
|
||
if (edit == 'PackingCalculationOn') {
|
||
$('#REVENUE').modal('show');
|
||
} else if (edit == 'EditPackingCalculationOn') {
|
||
$('#EDITREVENUE').modal('show');
|
||
}
|
||
});
|
||
|
||
$('#EditPackagingType').change(function() {
|
||
$('#txtEditPackaging').val('');
|
||
$('#txtEditAfterPackaging').val('');
|
||
selValue = $("#EditPackagingType").val();
|
||
if (selValue == PercentageType) {
|
||
var PackagingCalculation = '';
|
||
// $('#EDITREVENUE').modal('hide');
|
||
edit = 'EditPackingCalculationOn';
|
||
$('#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);
|
||
});
|
||
|
||
//for freight type//
|
||
// $('#drpFreight').change(function() {
|
||
// if($('#Rate').val() != '' && $('#MaterialCode').val() != "0" )
|
||
// {
|
||
// alert();
|
||
// $('#txtFreight').val('');
|
||
// $('#txtAfterFreight').val('');
|
||
// selValue = $("#drpFreight").val() ;
|
||
// if(selValue == PercentageType)
|
||
// {
|
||
// var PackagingCalculation = '';
|
||
// $('#freightcalmodel').modal('show');
|
||
// //$('#freightcalmodel').modal('blur');
|
||
// $('#txtFreight').removeAttr( 'readonly','true' );
|
||
// }
|
||
// else
|
||
// {
|
||
// if (selValue == NilType)
|
||
// {
|
||
// $('#txtFreight').attr('readonly', 'true');
|
||
// $('#txtFreight').val('0.00');
|
||
// }
|
||
// else
|
||
// {
|
||
// $('#txtFreight').removeAttr( 'readonly','true' );
|
||
// }
|
||
// }
|
||
// }
|
||
// else
|
||
// {
|
||
// alert('Please Select MaterialCode and Rate Field Value');
|
||
// $('#drpFreight').val("0");
|
||
// $('#Rate').focus();
|
||
// }
|
||
// calculateFreight(0);
|
||
//});
|
||
|
||
//for edit freight type//
|
||
// $('#drpEditFreight').change(function() {
|
||
// $('#txtEditFreight').val('');
|
||
// $('#txtEditAfterFreight').val('');
|
||
// selValue = $("#drpEditFreight").val() ;
|
||
// if(selValue == PercentageType)
|
||
// {
|
||
// var PackagingCalculation = '';
|
||
// // $('#freight').modal('show');
|
||
// $('#freightcalmodel').modal('show');
|
||
// $('#txtEditFreight').removeAttr( 'readonly','true' );
|
||
// }
|
||
// else
|
||
// {
|
||
// if (selValue == NilType)
|
||
// {
|
||
// $('#txtEditFreight').attr('readonly', 'true');
|
||
// $('#txtEditFreight').val('0.00');
|
||
// }
|
||
// else
|
||
// {
|
||
// $('#txtEditFreight').removeAttr( 'readonly','true' );
|
||
// }
|
||
// }
|
||
// //calculatePackaging(1);
|
||
// });
|
||
|
||
$('#txtExciseDuty').change(function() {
|
||
if ($('#Rate').val() != '' && $('#MaterialCode').val() != "0") {
|
||
$('#ExciseDutyCalModel').modal('show');
|
||
}
|
||
});
|
||
$('#txtEditExciseDuty').change(function() {
|
||
if ($('#EditRate').val() != '' && $('#EditMaterialCode').val() != "0") {
|
||
$('#ExciseDutyCalModel').modal('show');
|
||
}
|
||
});
|
||
$('#txtVat').change(function() {
|
||
if ($('#Rate').val() != '' && $('#MaterialCode').val() != "0") {
|
||
//$('#VatCalModel').modal('show');
|
||
}
|
||
});
|
||
$('#txtEditVat').change(function() {
|
||
if ($('#EditRate').val() != '' && $('#EditMaterialCode').val() != "0") {
|
||
//$('#VatCalModel').modal('show');
|
||
}
|
||
});
|
||
|
||
$('#txtCST').change(function() {
|
||
if ($('#Rate').val() != '' && $('#MaterialCode').val() != "0") {
|
||
//$('#CSTCalModel').modal('show');
|
||
}
|
||
});
|
||
$('#txtEditCST').change(function() {
|
||
if ($('#EditRate').val() != '' && $('#EditMaterialCode').val() != "0") {
|
||
//$('#CSTCalModel').modal('show');
|
||
}
|
||
});
|
||
var freight = '';
|
||
$('#drpFreight').change(function() {
|
||
var FreightType = $("#drpFreight").val();
|
||
|
||
if (FreightType == "PER TRIP") {
|
||
$('#TripsValue').show();
|
||
|
||
} else {
|
||
$('#TripsValue').hide();
|
||
|
||
}
|
||
if ($('#Rate').val() != '' && $('#MaterialCode').val() != "0") {
|
||
selValue = $("#drpFreight").val();
|
||
$('#txtFreight').val('');
|
||
$('#txtAfterFreight').val('');
|
||
if (selValue == PercentageType) {
|
||
var freightCalculation = '';
|
||
// $('#REVENUE').modal('hide');
|
||
freight = 'FreightCalculationOn';
|
||
$('#freightcalmodel').modal('show');
|
||
//$('#freightcalmodel').modal('blur');
|
||
$('#txtFreight').removeAttr('readonly', 'true');
|
||
} else if (selValue == NilType) {
|
||
$('#txtFreight').attr('readonly', 'true');
|
||
$('#txtFreight').val('0.00');
|
||
$('#txtAfterFreight').val('0.00');
|
||
change();
|
||
} else {
|
||
$('#txtFreight').removeAttr('readonly', 'true');
|
||
}
|
||
} else {
|
||
alert('Please Select MaterialCode and Rate Field Value');
|
||
$('#drpFreight').val("0");
|
||
$('#Rate').focus();
|
||
}
|
||
calculateFreight(0);
|
||
|
||
});
|
||
|
||
$('#freightcalmodel').on('hidden.bs.modal', function() {
|
||
// Reopen the first modal when the second modal is closed
|
||
if (freight == 'FreightCalculationOn') {
|
||
$('#REVENUE').modal('show');
|
||
} else if (freight == 'EditFreightCalculationOn') {
|
||
$('#EDITREVENUE').modal('show');
|
||
}
|
||
});
|
||
|
||
$('#drpEditFreight').change(function() {
|
||
var FreightType = $("#drpEditFreight").val();
|
||
|
||
if (FreightType == "PER TRIP") {
|
||
$('#EditTripsValue').show();
|
||
|
||
} else {
|
||
$('#EditTripsValue').hide();
|
||
|
||
}
|
||
if ($('#EditRate').val() != '' && $('#EditMaterialCode').val() != "0") {
|
||
selValue = $("#drpEditFreight").val();
|
||
$('#txtEditFreight').val('');
|
||
$('#txtEditAfterFreight').val('');
|
||
if (selValue == PercentageType) {
|
||
var FreightCalculation = '';
|
||
// $('#freight').modal('show');
|
||
freight = 'EditFreightCalculationOn';
|
||
// $('#EDITREVENUE').modal('hide');
|
||
$('#freightcalmodel').modal('show');
|
||
$('#txtEditFreight').removeAttr('readonly', 'true');
|
||
//Editchange();
|
||
} else if (selValue == NilType) {
|
||
|
||
$('#txtEditFreight').attr('readonly', 'true');
|
||
$('#txtEditFreight').val('0.00');
|
||
Editchange();
|
||
} else {
|
||
$('#txtEditFreight').removeAttr('readonly', 'true');
|
||
$('#txtEditFreight').val('');
|
||
}
|
||
} else {
|
||
alert('Please Select MaterialCode and Rate Field Value');
|
||
$('#drpEditFreight').val("0");
|
||
$('#EditRate').focus();
|
||
}
|
||
calculateFreight(1);
|
||
});
|
||
});
|
||
|
||
/*
|
||
* To calcuate the Discount */
|
||
function calculateDiscount(isEdit) {
|
||
if (isEdit == '0') {
|
||
if ($('#MaterialCode').val() == "0") {
|
||
alert('Please Select the Material Code');
|
||
$('#MaterialCode').focus();
|
||
$('#txtDiscount').val('');
|
||
return false;
|
||
} else if ($('#Rate').val() == '') {
|
||
alert('Please Enter the Rate value');
|
||
$('#Rate').focus();
|
||
$('#txtDiscount').val('');
|
||
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");
|
||
}
|
||
}
|
||
// change();
|
||
calculateTotalValue();
|
||
} else {
|
||
if ($('#EditMaterialCode').val() == "0") {
|
||
alert('Please Select the Material Code');
|
||
$('#EditMaterialCode').focus();
|
||
$('#txtEditDiscount').val('');
|
||
return false;
|
||
} else if ($('#EditRate').val() == '') {
|
||
alert('Please Enter the Rate value');
|
||
$('#EditRate').focus();
|
||
$('#txtEditDiscount').val('');
|
||
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");
|
||
}
|
||
}
|
||
// Editchange();
|
||
calculateEditTotalValue();
|
||
}
|
||
}
|
||
/*
|
||
* To calcuate the Packaging */
|
||
function calculatePackaging(isEdit) {
|
||
// alert(PackagingCalculation);
|
||
if (isEdit == '0') {
|
||
if ($('#MaterialCode').val() == "0") {
|
||
alert('Please Select the Material Code');
|
||
$('#MaterialCode').focus();
|
||
$('#txtPackaging').val('');
|
||
return false;
|
||
} else if ($('#Rate').val() == '') {
|
||
alert('Please Enter the Rate value');
|
||
$('#Rate').focus();
|
||
$('#txtPackaging').val('');
|
||
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();
|
||
//calculateCgstTax();
|
||
|
||
} else {
|
||
$('#txtAfterPackaging').val("0.00");
|
||
}
|
||
}
|
||
|
||
calculateTotalValue();
|
||
} else {
|
||
if ($('#EditMaterialCode').val() == "0") {
|
||
alert('Please Select the Material Code');
|
||
$('#EditMaterialCode').focus();
|
||
$('#txtEditPackaging').val('');
|
||
return false;
|
||
} else if ($('#EditRate').val() == '') {
|
||
alert('Please Enter the Rate value');
|
||
$('#EditRate').focus();
|
||
$('#txtEditPackaging').val('');
|
||
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 {
|
||
var AfterPackaging = parseFloat($('#txtAfterPackaging').val());
|
||
AfterExciseDuty = <?php echo EXCISE_ONBASIC_PACKAGING; ?>;
|
||
|
||
}
|
||
}
|
||
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();
|
||
$('#txtVat').val('');
|
||
return false;
|
||
} else if ($('#Rate').val() == '') {
|
||
alert('Please Enter the Rate value');
|
||
$('#Rate').focus();
|
||
$('#txtVat').val('');
|
||
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 discountValue = parseFloat($('#txtAfterDiscount').val());
|
||
var packageValue = parseFloat($('#txtAfterPackaging').val());
|
||
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() != '') {
|
||
var ExciseDuty = parseFloat($('#txtAfterExciseDuty').val());
|
||
|
||
var discountValue = parseFloat($('#txtAfterDiscount').val());
|
||
var packageValue = parseFloat($('#txtAfterPackaging').val());
|
||
vatValue = parseFloat($('#txtVat').val());
|
||
AfterVat = <?php echo VAT_ONEXICSEVALUE; ?>;
|
||
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();
|
||
$('#txtEditVat').val('');
|
||
return false;
|
||
} else if ($('#EditRate').val() == '') {
|
||
alert('Please Enter the Rate value');
|
||
$('#EditRate').focus();
|
||
$('#txtEditVat').val('');
|
||
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();
|
||
$('#txtCST').val('');
|
||
return false;
|
||
} else if ($('#Rate').val() == '') {
|
||
alert('Please Enter the Rate value');
|
||
$('#Rate').focus();
|
||
$('#txtCST').val('');
|
||
return false;
|
||
} else {
|
||
var basicValue = parseFloat($('#txtBasicValue').val());
|
||
var discountValue = parseFloat($('#txtAfterDiscount').val());
|
||
var packageValue = parseFloat($('#txtAfterPackaging').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_ONEXICSEVALUE; ?>;
|
||
var Vatval = parseFloat(AfterCST).toFixed(2);
|
||
|
||
$('#txtAfterCST').val(Vatval);
|
||
}
|
||
} else if (CSTCalculation == 0 && $('#txtCST').val() != '') {
|
||
var ExciseDuty = parseFloat($('#txtAfterExciseDuty').val());
|
||
var CSTValue = parseFloat($('#txtCST').val());
|
||
AfterCST = <?php echo CST_ONEXICSEVALUE; ?>;
|
||
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();
|
||
$('#txtEditCST').val('');
|
||
return false;
|
||
} else if ($('#EditRate').val() == '') {
|
||
alert('Please Enter the Rate value');
|
||
$('#EditRate').focus();
|
||
$('#txtEditCST').val('');
|
||
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);
|
||
} else {
|
||
$('#txtEditAfterCST').val("0.00");
|
||
}
|
||
|
||
calculateEditTotalValue();
|
||
}
|
||
|
||
}
|
||
}
|
||
|
||
function calculateGST(isEdit) {
|
||
if (isEdit == '0') {
|
||
if ($('#MaterialCode').val() == "0") {
|
||
alert('Please Select the Material Code');
|
||
$('#MaterialCode').focus();
|
||
$('#txtGST').val('');
|
||
return false;
|
||
} else if ($('#Rate').val() == '') {
|
||
alert('Please Enter the Rate value');
|
||
$('#Rate').focus();
|
||
$('#txtGST').val('');
|
||
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();
|
||
$('#txtEditGST').val('');
|
||
return false;
|
||
} else if ($('#EditRate').val() == '') {
|
||
alert('Please Enter the Rate value');
|
||
$('#EditRate').focus();
|
||
$('#txtEditGST').val('');
|
||
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();
|
||
$('#txtOtherTax').val('');
|
||
return false;
|
||
} else if ($('#Rate').val() == '') {
|
||
alert('Please Enter the Rate value');
|
||
$('#Rate').focus();
|
||
$('#txtOtherTax').val('');
|
||
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();
|
||
$('#txtEditOtherTax').val('');
|
||
return false;
|
||
} else if ($('#EditRate').val() == '') {
|
||
alert('Please Enter the Rate value');
|
||
$('#EditRate').focus();
|
||
$('#txtEditOtherTax').val('');
|
||
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();
|
||
$('#txtFreight').val('');
|
||
return false;
|
||
} else if ($('#Rate').val() == '') {
|
||
alert('Please Enter the Rate value');
|
||
$('#Rate').focus();
|
||
$('#txtFreight').val('');
|
||
return false;
|
||
} else {
|
||
var basicValue = parseFloat($('#txtBasicValue').val());
|
||
var FreightType = $("#drpFreight").val();
|
||
if (FreightType == "0") {
|
||
alert('Please select Freight Type');
|
||
$('#txtFreight').val('');
|
||
$("#drpFreight").focus();
|
||
// calculateCgstTax();
|
||
} 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) {
|
||
//AfterFreight = <?php echo FREIGHT_PERCENTAGE; ?>;
|
||
if ($(freightCalculation != 0 && '#txtAfterDiscount').val() == '') {
|
||
//alert(freightCalculation);
|
||
alert('Please Enter the Discount value');
|
||
$('#txtFreight').val('');
|
||
$('#DiscountType').focus();
|
||
return false;
|
||
} else {
|
||
var AfterDiscount = parseFloat($('#txtAfterDiscount').val());
|
||
//alert(AfterDiscount);
|
||
//AfterFreight = <?php echo FREIGHT_PERCENTAGE; ?>;
|
||
if (freightCalculation == 0) {
|
||
//alert('before value');
|
||
AfterFreight = <?php echo FREIGHT_PERCENTAGE; ?>;
|
||
} else {
|
||
AfterFreight = <?php echo FREIGHT_PERCENTAGE_AFTER; ?>;
|
||
}
|
||
|
||
}
|
||
}
|
||
// // AfterPackaging = PackagingCalculation == 0 ? <?php echo PACKAGING_PERCENTAGE_BYBASICVALUE; ?> : <?php echo PACKAGING_PERCENTAGE_BYDISCOUNTVALUE; ?> ;
|
||
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);
|
||
|
||
} else {
|
||
$('#txtAfterFreight').val("0.00");
|
||
}
|
||
|
||
}
|
||
calculateTotalValue();
|
||
} else {
|
||
//alert('1');
|
||
if ($('#EditMaterialCode').val() == "0") {
|
||
alert('Please Select the Material Code');
|
||
$('#EditMaterialCode').focus();
|
||
$('#txtEditFreight').val('');
|
||
return false;
|
||
} else if ($('#EditRate').val() == '') {
|
||
alert('Please Enter the Rate value');
|
||
$('#EditRate').focus();
|
||
$('#txtEditFreight').val('');
|
||
return false;
|
||
} else {
|
||
var basicValue = parseFloat($('#txtEditBasicValue').val());
|
||
var FreightType = $("#drpEditFreight").val();
|
||
//alert(FreightType);
|
||
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 = <?php echo FREIGHT_PERCENTAGE; ?>;
|
||
// }
|
||
if (FreightType == PercentageType) {
|
||
//AfterFreight = <?php echo FREIGHT_PERCENTAGE; ?>;
|
||
if ($(freightCalculation != 0 && '#txtEditAfterDiscount').val() == '') {
|
||
//alert(freightCalculation);
|
||
alert('Please Enter the Discount value');
|
||
$('#txtEditFreight').val('');
|
||
$('#EditDiscountType').focus();
|
||
return false;
|
||
} else {
|
||
var AfterDiscount = parseFloat($('#txtEditAfterDiscount').val());
|
||
//alert(AfterDiscount);
|
||
//AfterFreight = <?php echo FREIGHT_PERCENTAGE; ?>;
|
||
if (freightCalculation == 0) {
|
||
//alert('before value');
|
||
AfterFreight = <?php echo FREIGHT_PERCENTAGE; ?>;
|
||
} else {
|
||
AfterFreight = <?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();
|
||
|
||
}
|
||
}
|
||
|
||
/* Set the Packaging calculation option for calculating Packaging */
|
||
function SetPackagingOption() {
|
||
PackagingCalculation = $("input:radio[name='optPackaging']:checked").val();
|
||
$('#packagingcalmodel').modal('hide');
|
||
calculatePackaging($('#isEdit').val());
|
||
}
|
||
|
||
function SetfreightOption() {
|
||
freightCalculation = $("input:radio[name='optFreight']:checked").val();
|
||
$('#freightcalmodel').modal('hide');
|
||
//var freig=$("#drpFreight").val();
|
||
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;");
|
||
$('#cgstContainerEdit').attr("style", "");
|
||
$('#cgstContainerView').attr("style", "");
|
||
$('#cgstContainerAdd').attr("style","");
|
||
$('#IGSTEditModel').attr("style", "display:none;");
|
||
$('#SGSTEditModel').removeAttr("style");
|
||
|
||
$('#IGSTAddModel').attr("style", "display:none;");
|
||
$('#SGSTAddModel').removeAttr("style");
|
||
} else {
|
||
$('#CST').removeAttr("style");
|
||
$('#TotICST').removeAttr("style");
|
||
$('#Vat').attr("style", "display:none;");
|
||
$('#TotSCST').attr("style", "display:none;");
|
||
$('#cgstContainerEdit').attr("style", "display:none");
|
||
$('#cgstContainerView').attr("style", "display:none");
|
||
$('#cgstContainerAdd').attr("style","display:none");
|
||
$('#IGSTEditModel').removeAttr("style");
|
||
$('#SGSTEditModel').attr("style", "display:none;");
|
||
$('#IGSTAddModel').removeAttr("style");
|
||
$('#SGSTAddModel').attr("style", "display:none;");
|
||
}
|
||
}
|
||
|
||
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 = '';
|
||
}
|
||
//edit function:
|
||
function Editchange() {
|
||
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(calculateCgstTax($('#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(), $('#txtEditAfterFreight').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(), $('#txtEditAfterFreight').val() == '' ? '0.00' : $('#txtEditAfterFreight').val()));
|
||
}
|
||
calculateEditTotalValue($('#isEdit').val());
|
||
|
||
}
|
||
|
||
}
|
||
|
||
function validateEditExceedLimit() {
|
||
//alert(" Edit Budget Check");
|
||
var avalbudAmt = parseFloat($('#EditAvlBudAmt').val());
|
||
var basicAmountRate = parseFloat($('#txtEditBasicValue').val());
|
||
//alert(basicAmountRate);
|
||
// 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();
|
||
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 totvalue = (parseFloat(BasicVal) + parseFloat(Packaging) + parseFloat(AfterCgst) + parseFloat(AfterSgst) + parseFloat(AfterIgst) + parseFloat(Freight) + parseFloat(Insurance)) - parseFloat(Discount);
|
||
|
||
var tot = parseFloat(totvalue).toFixed(2);
|
||
|
||
$('#txtEditTotalOrderValue').val(tot);
|
||
// validateEditExceedLimit();
|
||
}
|
||
|
||
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(AfterSgst) + parseFloat(AfterIgst) + parseFloat(AfterCgst);
|
||
|
||
var tot = parseFloat(totvalue).toFixed(2);
|
||
//alert('tot:'+tot);
|
||
return tot;
|
||
}
|
||
|
||
$(document).ready(function() {
|
||
$('#Date').click(function() {
|
||
//for Date range selection
|
||
$('#Schedulediv').hide();
|
||
$('#Deliverydtdiv').show();
|
||
});
|
||
$('#Schedule').click(function() {
|
||
//for schedule range selection
|
||
$('#Deliverydtdiv').hide();
|
||
$('#Schedulediv').show();
|
||
});
|
||
});
|
||
</script>
|
||
<style>
|
||
.pagination {
|
||
margin: 0px ! important;
|
||
}
|
||
|
||
.box-body {
|
||
padding: 0px ! important;
|
||
}
|
||
|
||
.num {
|
||
text-align: right;
|
||
}
|
||
|
||
.header-container {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
padding: 25px;
|
||
}
|
||
|
||
.header-container h2 {
|
||
flex: 1;
|
||
text-align: center;
|
||
margin: 0;
|
||
}
|
||
|
||
.btn-container .btn {
|
||
margin-left: 10px;
|
||
}
|
||
|
||
.centered {
|
||
display: flex;
|
||
/* justify-content: center; */
|
||
align-items: center;
|
||
height: 10vh;
|
||
}
|
||
|
||
.centered label,
|
||
.centered input {
|
||
margin: 0 5px;
|
||
}
|
||
|
||
.mandatory {
|
||
color: red;
|
||
text-align: right;
|
||
background-color: white;
|
||
}
|
||
</style>
|
||
<div class="content-page">
|
||
<div class="content">
|
||
<!-- Start Content-->
|
||
<div class="container-fluid">
|
||
<!-- start page title -->
|
||
<div class="row">
|
||
<div class="col-12">
|
||
<div class="page-title-box page-title-box-alt">
|
||
<h4><?= "Revenue Purchase Order"; ?></h4>
|
||
<a href="<?php echo base_url() ?>CreatePO" class="btn btn-secondary" id="back" value="Back">Back</a>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<!-- end page title -->
|
||
<!-- Form row -->
|
||
<div class="row">
|
||
<div class="col-12">
|
||
<div class="card">
|
||
<div class="card-body">
|
||
<?php
|
||
$attributes = array('class' => 'form-label-left CreatePO ', 'name' => 'CreatePO', 'id' => 'CreatePO', 'enctype' => 'multipart/form-data');
|
||
echo form_open(base_url() . '/purchaseorder/addPO/', $attributes); ?>
|
||
|
||
|
||
|
||
<div class="form-row">
|
||
<div class="form-group col-md-3">
|
||
<label>Requistion No</label>
|
||
<?php
|
||
$options = array("0" => 'Selected Requisition Numbers');
|
||
if (!empty($ReqList)) {
|
||
foreach ($ReqList as $SID) :
|
||
$options[$SID->ReqNo] = $SID->ReqNo . "-" . $SID->ReqBy;
|
||
$ReqType = $SID->ReqType;
|
||
endforeach;
|
||
}
|
||
echo form_multiselect('RequistionNo', $options, set_value('RequistionNo', array()), 'id="RequistionNo"', 'required="true"', 'height="400px"');
|
||
?>
|
||
</div>
|
||
<div class="form-group col-md-3">
|
||
<label>Purchase Order Type</label>
|
||
<div>
|
||
<?php
|
||
$data = array('name' => 'POType', 'value' => set_value('POType', $ReqType), 'id' => 'POType', 'class' => 'form-control', 'readonly' => 'true');
|
||
echo form_input($data);
|
||
?>
|
||
</div>
|
||
</div>
|
||
<div class="form-group col-md-3">
|
||
<label>Select Supplier<span class="badge mandatory">*</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'), 'id="drpSupplier" required="true" class="form-control select2"');
|
||
|
||
?>
|
||
</div>
|
||
<div class="form-group col-md-3">
|
||
<label>Supplier Address</label>
|
||
<div>
|
||
<?php
|
||
$data = array('name' => 'SupAddress', 'value' => set_value('SupAddress'), 'id' => 'SupAddress', 'class' => 'form-control', 'readonly' => 'true', 'rows' => '3', 'cols' => '40');
|
||
echo Form_textarea($data);
|
||
?>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-row">
|
||
<div class="form-group col-md-3">
|
||
<div id="div1" style="display:block;">
|
||
<b><u>Select Tax Range</u></b><br/>
|
||
<div class="centered">
|
||
<?php
|
||
echo form_label('Local', 'Local') . " " . form_radio(array(
|
||
"name" => "Range",
|
||
"id" => "Local",
|
||
"value" => "0",
|
||
'checked' => 'checked',
|
||
'onchange' => 'SetVatorCST();'
|
||
));
|
||
?>
|
||
<?php
|
||
echo form_label('Inter state', 'Inter_state') . " " . form_radio(array(
|
||
"name" => "Range",
|
||
"id" => "Inter_state",
|
||
"value" => "1",
|
||
'onchange' => 'SetVatorCST();'
|
||
));
|
||
?>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="form-group col-md-3">
|
||
<b><u>Select Delivery By<span class="badge mandatory">*</span></u></b><br />
|
||
<div class="centered">
|
||
<?php echo form_label('Date', 'Date') . " " . form_radio(array("name" => "DateRange", "id" => "Date", "value" => "0", "checked" => "checked")); ?>
|
||
<?php echo form_label('Schedule', 'Schedule') . " " . form_radio(array("name" => "DateRange", "id" => "Schedule", "value" => "1")); ?>
|
||
</div>
|
||
</div>
|
||
<div class="form-group col-md-3" id="Deliverydtdiv">
|
||
<label>Delivery Date<span class="badge mandatory">*</span></label>
|
||
<input class="form-control num" data-provide="datepicker" data-date-format="dd-mm-yyyy" data-date-autoclose="true" id="Deliverydt" name="Deliverydt" data-date-start-date="<?= date('d-m-Y'); ?>" required autocomplete="off" value="<?= date('d-m-Y'); ?>">
|
||
|
||
<!-- <div>
|
||
<?php
|
||
// $data = array('name' => 'Deliverydt', 'value' => set_value('Deliverydt', $CurrentDate), 'id' => 'Deliverydt', 'class' => 'form-control num', 'required' => 'true', 'onkeypress' => 'return false;');
|
||
// echo form_input($data);
|
||
?>
|
||
</div> -->
|
||
</div>
|
||
<div class="form-group col-md-3" id="Schedulediv" style="display:none;">
|
||
<label>Schedule By<span class="badge mandatory">*</span></label>
|
||
<?php
|
||
$data = array('name' => 'Scheduleby', 'value' => set_value('Scheduleby'), 'id' => 'Scheduleby', 'class' => 'form-control', 'required' => 'true', 'rows' => '3', 'cols' => '40', 'maxlength' => '110');
|
||
echo Form_textarea($data);
|
||
?>
|
||
</div>
|
||
<div class="form-group col-md-3">
|
||
<label>Delivery Address</label>
|
||
<div>
|
||
<?php
|
||
$data = array('name' => 'DeliveryAddr', 'value' => set_value('DeliveryAddr', $CompanyAddress), 'id' => 'DeliveryAddr', 'class' => 'form-control', 'required' => 'true', 'rows' => '3', 'cols' => '40');
|
||
echo Form_textarea($data);
|
||
?>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-row">
|
||
<div class="form-group col-md-3">
|
||
<label>Purchase Order Date</label>
|
||
<input class="form-control num" data-provide="datepicker" data-date-format="dd-mm-yyyy" data-date-autoclose="true" id="PODate" name="PODate" data-date-start-date="<?= date('d-m-Y'); ?>" required autocomplete="off" value="<?= date('d-m-Y'); ?>">
|
||
|
||
<!-- <div>
|
||
<?php
|
||
// $data = array('name' => 'PODate', 'value' => set_value('PODate', $CurrentDate), 'id' => 'PODate', 'class' => 'form-control num', 'required' => 'true', 'onkeypress' => 'return false;');
|
||
// echo form_input($data);
|
||
?>
|
||
</div> -->
|
||
</div>
|
||
<div class="form-group col-md-3">
|
||
<label>Mode Of Shipment</label>
|
||
<div>
|
||
|
||
<?php
|
||
$data = array('name' => 'addmodeofshipment', 'value' => set_value('addmodeofshipment'), 'id' => 'addmodeofshipment', 'class' => 'form-control');
|
||
echo form_input($data);
|
||
?>
|
||
</div>
|
||
|
||
</div>
|
||
<div class="form-group col-md-3">
|
||
<label>Contact Reference</label>
|
||
<div>
|
||
|
||
<?php
|
||
$data = array('name' => 'addsupplierreference', 'value' => set_value('addsupplierreference'), 'id' => 'addsupplierreference', 'class' => 'form-control', 'maxlength' => '40');
|
||
echo form_input($data);
|
||
?>
|
||
</div>
|
||
</div>
|
||
<div class="form-group col-md-3">
|
||
<label>Supplier's Offer No</label>
|
||
<div>
|
||
|
||
<?php
|
||
$data = array('name' => 'addsupplierofferno', 'value' => set_value('addsupplierofferno'), 'id' => 'addsupplierofferno', 'class' => 'form-control');
|
||
echo form_input($data);
|
||
?>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-row">
|
||
<div class="form-group col-md-3">
|
||
<label>Our Reference(S)</label>
|
||
<div>
|
||
|
||
<?php
|
||
$data = array('name' => 'addotherreference', 'value' => set_value('addotherreference'), 'id' => 'addotherreference', 'class' => 'form-control');
|
||
echo form_input($data);
|
||
?>
|
||
</div>
|
||
</div>
|
||
<div class="form-group col-md-3">
|
||
<label>Revenue Type Options<span class="text-danger">*</span></label>
|
||
<div>
|
||
|
||
<?php
|
||
|
||
$optionsPO = array("0" => 'Select');
|
||
|
||
|
||
if (!empty($PoTypeOptions)) {
|
||
foreach ($PoTypeOptions as $POpt) :
|
||
|
||
|
||
$optionsPO[$POpt->ConfigValue] = $POpt->ConfigValue;
|
||
|
||
endforeach;
|
||
}
|
||
|
||
echo form_dropdown('PoTypeOptions', $optionsPO, set_value('PoTypeOptions'), 'id="PoTypeOptions" required="true" class="form-control select2"');
|
||
|
||
|
||
?>
|
||
</div>
|
||
</div>
|
||
<div class="form-group col-md-3">
|
||
<label for="payablefrom">Payable Terms<span class="text-danger">*</span></label>
|
||
<?php
|
||
if (!empty($Payment)) {
|
||
$options6 = array("0" => 'Select Payment Terms ');
|
||
foreach ($Payment as $pay) :
|
||
$options6[$pay->PaymentID] = $pay->PaymentTerms;
|
||
endforeach;
|
||
}
|
||
echo form_dropdown('PaymentTerms', $options6, set_value('PaymentTerms'), 'id="PaymentTerms" required="true" class="form-control select2"');
|
||
?>
|
||
</div>
|
||
<div class="form-group col-md-3" id="otheroptiondiv" style="display:none;">
|
||
<label>Description of Payable Terms<span class="text-danger">*</span></label>
|
||
<div>
|
||
<?php
|
||
$data = array('name' => 'Otherpayment', 'Otherpayment' => set_value('Otherpayment'), 'id' => 'Otherpayment', 'class' => 'form-control');
|
||
echo form_input($data);
|
||
?>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-row">
|
||
<div class="form-group col-md-3">
|
||
<label for="insurance">Insurance Options</label>
|
||
<div>
|
||
<?php
|
||
$optionsnew = array('1' => 'Yes', '0' => 'No');
|
||
echo form_dropdown('insurance', $optionsnew, set_value('insurance'), 'id="insurance" required="true" class="form-control select2"');
|
||
?>
|
||
</div>
|
||
</div>
|
||
<div class="form-group col-md-3" id="InsuranceNumberdiv" style="display:block;">
|
||
<label>Insurance No / Insurance Details<span class="badge mandatory">*</span></label>
|
||
<div>
|
||
<?php
|
||
$data = array('name' => 'InsuranceNumber', 'InsuranceNumber' => set_value('InsuranceNumber'), 'id' => 'InsuranceNumber', 'class' => 'form-control', 'required' => 'true');
|
||
echo form_input($data);
|
||
?>
|
||
</div>
|
||
</div>
|
||
<div class="form-group col-md-3">
|
||
<label for="BudgetType">Budget Type<span class="badge mandatory">*</span></label>
|
||
<?php
|
||
|
||
|
||
$optionsnew = array('0' => 'Select', '1' => 'REVENUE', '2' => 'CAPITAL');
|
||
echo form_dropdown('BudgetType', $optionsnew, set_value('BudgetType'), 'id="BudgetType" required="true" class="form-control select2"');
|
||
|
||
?>
|
||
</div>
|
||
<div class="form-group col-md-3">
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-row">
|
||
<div class="form-group col-md-12 text-right">
|
||
<!-- <input type="checkbox" id="IsOpenOrder" name="IsOpenOrder" value="1"> IS THIS OPEN ORDER FORMAT -->
|
||
<a data-toggle="modal"><button type="submit" onclick="openModal();" class="btn btn-success" id="abcd">Select Line Item</button> </a>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Table -->
|
||
<div class="form-row">
|
||
<div class="table-responsive" style="padding-bottom: 30px;">
|
||
<table id="revenueTax" class="table nowrap table-bordered table-hover mb-0" style="font-size:12px;">
|
||
<thead>
|
||
<tr>
|
||
<th style="white-space: nowrap !important;">SNo</th>
|
||
<th style="white-space: nowrap !important; text-align:left !important">Requisition No</th>
|
||
<th style="white-space: nowrap !important;">Item Code</th>
|
||
<th style="white-space: nowrap !important;">Item Description</th>
|
||
<th style="white-space: nowrap !important;">Line Item Specs</th>
|
||
<th style="white-space: nowrap !important; text-align:right !important">Quantity</th>
|
||
<th style="white-space: nowrap !important;">UOM</th>
|
||
<th style="white-space: nowrap !important; text-align:right !important">Rate<?php echo "($INRSYM)" ?></th>
|
||
<th style="white-space: nowrap !important; text-align:right !important">Basic Amount<?php echo "($INRSYM)" ?></th>
|
||
<th style="white-space: nowrap !important; text-align:right !important">Tax Amount<?php echo "($INRSYM)" ?></th>
|
||
<th style="white-space: nowrap !important; text-align:right !important">Total Order Amount<?php echo "($INRSYM)" ?></th>
|
||
<th>Action</th>
|
||
</tr>
|
||
</thead>
|
||
|
||
<tbody id='RevenueAppend'></tbody>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
<!-- /.table -->
|
||
|
||
<div class="form-row">
|
||
<div class="form-group col-md-3">
|
||
<label>Basic Amount <?php echo "($INRSYM)" ?></label>
|
||
<?php
|
||
$data = array('name' => 'txtTotBasicAmount', 'value' => set_value('txtTotBasicAmount'), 'id' => 'txtTotBasicAmount', 'class' => 'form-control', 'readonly' => 'true', 'style' => 'text-align:right;');
|
||
echo form_input($data);
|
||
?>
|
||
|
||
</div>
|
||
<div class="form-group col-md-3">
|
||
<label>Total Discount Amount <?php echo "($INRSYM)" ?> </label>
|
||
|
||
<?php
|
||
$data = array('name' => 'txtTotalDiscount', 'value' => set_value('txtTotalDiscount'), 'id' => 'txtTotalDiscount', 'class' => 'form-control', 'readonly' => 'true', 'style' => 'text-align:right;');
|
||
echo form_input($data);
|
||
?>
|
||
|
||
</div>
|
||
<div class="form-group col-md-3" id="TotSCST">
|
||
<label>Total SGST Amount <?php echo "($INRSYM)" ?></label>
|
||
|
||
<?php
|
||
$data = array('name' => 'txtTotalSGST', 'value' => set_value('txtTotalSGST'), 'id' => 'txtTotalSGST', 'class' => 'form-control', 'readonly' => 'true', 'style' => 'text-align:right;');
|
||
echo form_input($data);
|
||
?>
|
||
|
||
</div>
|
||
<div class="form-group 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'), 'id' => 'txtTotalIGST', 'class' => 'form-control', 'readonly' => 'true', 'style' => 'text-align:right;');
|
||
echo form_input($data);
|
||
?>
|
||
|
||
</div>
|
||
<div class="form-group col-md-3" id="cgstContainerView">
|
||
<label>Total CGST Amount <?php echo "($INRSYM)" ?> </label>
|
||
|
||
<?php
|
||
$data = array('name' => 'txtTotalCGST', 'value' => set_value('txtTotalCGST'), 'id' => 'txtTotalCGST', 'class' => 'form-control', 'readonly' => 'true', 'style' => 'text-align:right;');
|
||
echo form_input($data);
|
||
?>
|
||
|
||
</div>
|
||
</div>
|
||
<div class="form-row">
|
||
<div class="form-group col-md-3">
|
||
<label>Total Packaging Amount <?php echo "($INRSYM)" ?></label>
|
||
|
||
<?php
|
||
$data = array('name' => 'txtTotalPackaing', 'value' => set_value('txtTotalPackaing'), 'id' => 'txtTotalPackaing', 'class' => 'form-control', 'readonly' => 'true', 'style' => 'text-align:right;');
|
||
echo form_input($data);
|
||
?>
|
||
|
||
</div>
|
||
<div class="form-group col-md-3">
|
||
<label>Total Insurance Amount <?php echo "($INRSYM)" ?></label>
|
||
|
||
<?php
|
||
$data = array('name' => 'txtTotalInsurance', 'value' => set_value('txtTotalInsurance'), 'id' => 'txtTotalInsurance', 'class' => 'form-control', 'readonly' => 'true', 'style' => 'text-align:right;');
|
||
echo form_input($data);
|
||
?>
|
||
|
||
</div>
|
||
<div class="form-group col-md-3">
|
||
<label>Total Freight Amount <?php echo "($INRSYM)" ?></label>
|
||
|
||
<?php
|
||
$data = array('name' => 'txtTotalFreight', 'value' => set_value('txtTotalFreight'), 'id' => 'txtTotalFreight', 'class' => 'form-control', 'readonly' => 'true', 'style' => 'text-align:right;');
|
||
echo form_input($data);
|
||
?>
|
||
|
||
</div>
|
||
<div class="form-group col-md-3">
|
||
<label>Total Order Amount <?php echo "($INRSYM)" ?></label>
|
||
<?php
|
||
$data = array('name' => 'txtTotalOrderValueSummary', 'value' => set_value('txtTotalOrderValueSummary'), 'id' => 'txtTotalOrderValueSummary', 'class' => 'form-control', 'readonly' => 'true', 'style' => 'text-align:right;');
|
||
echo form_input($data);
|
||
?>
|
||
</div>
|
||
</div>
|
||
<div class="form-row">
|
||
<div class="form-group col-md-12">
|
||
<label>Special Instructions </label>
|
||
<?php
|
||
$data = array('name' => 'txtSpcialInstruction', 'value' => set_value('txtSpcialInstruction'), 'id' => 'txtSpcialInstruction', 'class' => 'form-control', 'rows' => '8');
|
||
echo Form_textarea($data);
|
||
?>
|
||
<input type="hidden" name="SpcialInstruction" id="SpcialInstruction" value="">
|
||
</div>
|
||
</div>
|
||
|
||
|
||
<label>Select Purchase Order File</label>
|
||
<div class="form-row">
|
||
|
||
<div class="form-group col-md-12">
|
||
|
||
<input type="file" name="POFile" id="POFile"><br>
|
||
</div>
|
||
|
||
|
||
</div>
|
||
|
||
<div class="form-row">
|
||
<div class="form-group col-md-12">
|
||
<div align="right" style="padding-right:10px">
|
||
|
||
<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" />
|
||
<input type="hidden" name="txtDeletedRow" id="txtDeletedRow" />
|
||
<input type="hidden" name="Budget" id="Budget" />
|
||
<div class="btn-container" style="text-align: right;">
|
||
<a class="btn btn-secondary Save" ID="Cancel" onclick="Reset();"> <span class="bold">Cancel</span></a>
|
||
<a class="btn btn-success Save" ID="Save" onclick="Save(0)"> <span class="bold">Save as Draft</span></a>
|
||
<a class="btn btn-success Submit" ID="Submit" onclick="Save(1)"> <span class="bold">Submit</span></a>
|
||
</div>
|
||
</div>
|
||
</div><br />
|
||
</div>
|
||
</div> <!-- end card body-->
|
||
</div> <!-- end card -->
|
||
</div><!-- end col-->
|
||
</div>
|
||
</div> <!-- container -->
|
||
</div> <!-- content -->
|
||
</div>
|
||
<!-- Modal for Packing Calculation -->
|
||
<div id="packagingcalmodel" class="modal fade" role="dialog"
|
||
aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
|
||
<div class="modal-dialog modal-lg">
|
||
<div class="modal-content">
|
||
<div class="modal-header">
|
||
<h4 class="modal-title">Packing Calculation On</h4>
|
||
<button type="button" class="close" data-dismiss="modal"
|
||
aria-hidden="true">×</button>
|
||
</div>
|
||
<div class="modal-body p-4">
|
||
<form>
|
||
<div>
|
||
<label>
|
||
<input type="radio" name="optPackaging" checked="checked" value='0' id="optPackaging"> Basic Amount
|
||
</label>
|
||
</div>
|
||
<div>
|
||
<label>
|
||
<input type="radio" name="optPackaging" id="optPackaging" value='1'> After Discount Amount
|
||
</label>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
<div class="modal-footer" style="border:none;">
|
||
<a class="btn btn-secondary waves-effect" data-dismiss="modal" style="margin-top: -24px;" value="Cancel">Cancel</a>
|
||
<a class="btn btn-info waves-effect waves-light" ID="PackagingOption" onclick="SetPackagingOption();" style="margin-top: -24px;"> <span class="bold">Ok</span></a>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div><!-- /.modal -->
|
||
<!-- Modal for freight Calculation-->
|
||
<div id="freightcalmodel" class="modal fade" tabindex="-1" role="dialog"
|
||
aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
|
||
<div class="modal-dialog modal-lg">
|
||
<div class="modal-content">
|
||
<div class="modal-header">
|
||
<h4 class="modal-title">Freight Calculation On</h4>
|
||
<button type="button" class="close" data-dismiss="modal"
|
||
aria-hidden="true">×</button>
|
||
</div>
|
||
<div class="modal-body p-4">
|
||
<form>
|
||
|
||
<div>
|
||
<label><input type="radio" name="optFreight" checked="checked" value='0' id="optFreight"> Basic Amount</label>
|
||
</div>
|
||
<div>
|
||
<label><input type="radio" name="optFreight" id="optFreight" value='1'> After Discount Amount</label>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
<div class="modal-footer" style="border:none;">
|
||
|
||
<a class="btn btn-secondary waves-effect" data-dismiss="modal" style="margin-top: -24px;" value="Cancel">Cancel</a>
|
||
<a class="btn btn-info waves-effect waves-light" ID="FreightOption" onclick="SetfreightOption();" style="margin-top: -24px;"> <span class="bold">Ok</span></a>
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div><!-- /.modal -->
|
||
<!-- Modal for Excise Duty Calculation-->
|
||
<div id="ExciseDutyCalModel" class="modal fade" tabindex="-1" role="dialog"
|
||
aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
|
||
<div class="modal-dialog modal-full-width">
|
||
<div class="modal-content">
|
||
<div class="modal-header">
|
||
<h4 class="modal-title">Excise Duty Calculation On</h4>
|
||
<button type="button" class="close" data-dismiss="modal"
|
||
aria-hidden="true">×</button>
|
||
</div>
|
||
<div class="modal-body p-4">
|
||
<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-secondary waves-effect" data-dismiss="modal" style="margin-top: -24px;" value="Cancel">Cancel</a>
|
||
<a class="btn btn-info waves-effect waves-light" ID="ExciseOption" onclick="SetExciseCalculation();" style="margin-top: -24px;"> <span class="bold">Ok</span></a>
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div><!-- /.modal -->
|
||
<!-- Modal for Vat Calculation -->
|
||
<div id="VatCalModel" class="modal fade" tabindex="-1" role="dialog"
|
||
aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
|
||
<div class="modal-dialog modal-full-width">
|
||
<div class="modal-content">
|
||
<div class="modal-header">
|
||
<h4 class="modal-title">Vat Calculation On</h4>
|
||
<button type="button" class="close" data-dismiss="modal"
|
||
aria-hidden="true">×</button>
|
||
</div>
|
||
<div class="modal-body p-4">
|
||
<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-secondary waves-effect" data-dismiss="modal" style="margin-top: -24px;" value="Cancel">Cancel</a>
|
||
<a class="btn btn-info waves-effect waves-light" ID="VatOption" onclick="SetVatCalculation();" style="margin-top: -24px;"> <span class="bold">Ok</span></a>
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div><!-- /.modal -->
|
||
<!-- Modal for CST Calculation -->
|
||
<div id="CSTCalModel" class="modal fade" tabindex="-1" role="dialog"
|
||
aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
|
||
<div class="modal-dialog modal-full-width">
|
||
<div class="modal-content">
|
||
<div class="modal-header">
|
||
<h4 class="modal-title">CST Calculation On</h4>
|
||
<button type="button" class="close" data-dismiss="modal"
|
||
aria-hidden="true">×</button>
|
||
</div>
|
||
<div class="modal-body p-4">
|
||
<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-secondary waves-effect" ID="CSTOption" onclick="SetCSTCalculation();" style="margin-top: -24px;"> <span class="bold">Ok</span></a>
|
||
<a class="btn btn-info waves-effect waves-light" data-dismiss="modal" style="margin-top: -24px;" value="Cancel">Cancel</a>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div><!-- /.modal -->
|
||
<!-- Model for revenue po -->
|
||
<div align="center">
|
||
<div id="REVENUE" class="modal fade" tabindex="-1" role="dialog"
|
||
aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
|
||
<div class="modal-dialog modal-full-width">
|
||
<div class="modal-content" align="left" style="width:1060px;">
|
||
<div class="modal-header">
|
||
<h4 class="modal-title">Select Revenue Purchase Order Line Item</h4>
|
||
<button type="button" class="close" data-dismiss="modal"
|
||
aria-hidden="true">×</button>
|
||
</div>
|
||
|
||
<form>
|
||
<div class="modal-body p-4">
|
||
|
||
|
||
<div class="form-row">
|
||
<div class="form-group col-md-3">
|
||
<label>Req No<span class="text-danger">*</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="form-group col-md-3">
|
||
<label>Department Name</label>
|
||
|
||
<?php
|
||
$data = array('name' => 'deptName', 'value' => set_value('deptName'), 'id' => 'deptName', 'class' => 'form-control', 'readonly' => 'true');
|
||
echo form_input($data);
|
||
?>
|
||
|
||
</div>
|
||
<div class="form-group col-md-3">
|
||
<label>Cost Center Code</label>
|
||
|
||
<?php
|
||
|
||
$data = array('name' => 'CostCenter', 'value' => set_value('CostCenter'), 'id' => 'CostCenter', 'class' => 'form-control', 'readonly' => 'true');
|
||
echo form_input($data);
|
||
?>
|
||
|
||
</div>
|
||
<div class="form-group col-md-3">
|
||
<label>Avl Bud Amt <?php echo "($INRSYM)" ?></label>
|
||
<?php
|
||
$data = array('name' => 'AvlBudAmt', 'value' => set_value('AvlBudAmt'), 'id' => 'AvlBudAmt', 'class' => 'form-control num', 'readonly' => 'true');
|
||
echo form_input($data);
|
||
?>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-row">
|
||
<div class="form-group col-md-3">
|
||
<label>Item Code<span class="text-danger">*</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="form-group col-md-3">
|
||
<label>Item Name</label>
|
||
|
||
<?php
|
||
$data = array('name' => 'ItemName', 'value' => set_value('ItemName'), 'id' => 'ItemName', 'class' => 'form-control', 'readonly' => 'true');
|
||
echo form_input($data);
|
||
?>
|
||
|
||
</div>
|
||
<div class="form-group col-md-3">
|
||
<label>UOM</label>
|
||
|
||
<?php
|
||
$data = array('name' => 'UOM', 'value' => set_value('UOM'), 'id' => 'UOM', 'class' => 'form-control', 'readonly' => 'true');
|
||
echo form_input($data);
|
||
?>
|
||
|
||
</div>
|
||
<div class="form-group col-md-3">
|
||
<label>Qty<span class="text-danger">*</span></label>
|
||
<?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="form-row">
|
||
|
||
<div class="form-group col-md-3"></div>
|
||
|
||
<div class="form-group col-md-3">
|
||
<label><?php echo "Rate ($INRSYM)"; ?><span class="text-danger">*</span></label>
|
||
<!-- <label>Rate</label> -->
|
||
<?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 class="form-group 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="form-group col-md-3">
|
||
<label><?php echo "Basic Amt ($INRSYM)"; ?></label>
|
||
<!-- <label>Basic Amount</label> -->
|
||
<?php
|
||
$data = array('name' => 'txtBasicValue', 'value' => set_value('txtBasicValue'), 'id' => 'txtBasicValue', 'class' => 'form-control num', 'readonly' => 'true');
|
||
echo form_input($data);
|
||
?>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="form-row" style="padding:0px;">
|
||
<div class="form-group col-md-3"></div>
|
||
|
||
<div class="form-group col-md-3">
|
||
<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="form-group col-md-3">
|
||
<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="form-group col-md-3">
|
||
<label>Discounted Amt <?php echo "($INRSYM)" ?></label>
|
||
<?php
|
||
$data = array('name' => 'txtAfterDiscount', 'value' => set_value('txtAfterDiscount', 0.00), 'id' => 'txtAfterDiscount', 'class' => 'form-control num', 'readonly' => 'true');
|
||
echo form_input($data);
|
||
?>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="form-row" style="text-align:left;">
|
||
<div class="form-group col-md-3"></div>
|
||
<div class="form-group col-md-3">
|
||
<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="form-group col-md-3">
|
||
<label>Packaging Rate </label>
|
||
<?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 class="form-group col-md-3">
|
||
<label>Packaging Amt <?php echo "($INRSYM)" ?></label>
|
||
<?php
|
||
$data = array('name' => 'txtAfterPackaging', 'value' => set_value('txtAfterPackaging', 0.00), 'id' => 'txtAfterPackaging', 'class' => 'form-control num', 'readonly' => 'true');
|
||
echo form_input($data);
|
||
?>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-row">
|
||
<div class="form-group col-md-3"></div>
|
||
|
||
<div class="form-group col-md-3">
|
||
<label>Freight Type </label>
|
||
<?php
|
||
$options = array("0" => 'Select Freight Type');
|
||
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 class="form-group col-md-3">
|
||
<label>Freight Rate </label>
|
||
<?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 class="form-group col-md-3">
|
||
<label>Freight Amt <?php echo "($INRSYM)" ?></label>
|
||
<?php
|
||
$data = array('name' => 'txtAfterFreight', 'value' => set_value('txtAfterFreight', 0.00), 'id' => 'txtAfterFreight', 'class' => 'form-control num', 'readonly' => 'true');
|
||
echo form_input($data);
|
||
?>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="form-row">
|
||
|
||
<div class="from-group col-md-9"></div>
|
||
|
||
<div class="form-group col-md-3" id="TripsValue" style="display:none;">
|
||
<label>NO Of Trips</label>
|
||
<?php
|
||
$data = array('name' => 'NOOfTrips', 'value' => set_value('NOOfTrips'), 'id' => 'NOOfTrips', 'class' => 'form-control num', 'onchange' => 'calculateFreight(0);');
|
||
echo form_input($data);
|
||
?>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
<!-- cgst -->
|
||
<div class="form-row" id="cgstContainerAdd">
|
||
<div class="form-group col-md-6"></div>
|
||
<div class="form-group col-md-3">
|
||
<label>CGST In %</label>
|
||
<?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 class="form-group col-md-3">
|
||
<label>CGST Amt <?php echo "($INRSYM)" ?></label>
|
||
<?php
|
||
$data = array('name' => 'AfterCgst', 'value' => set_value('AfterCgst', 0.00), 'id' => 'AfterCgst', 'class' => 'form-control num', 'readonly' => 'true');
|
||
echo form_input($data);
|
||
?>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- sgst -->
|
||
<div class="form-row" id="SGSTAddModel">
|
||
<div class="form-group col-md-6"></div>
|
||
<div class="form-group col-md-3">
|
||
<label>SGST In %</label>
|
||
<?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 class="form-group col-md-3">
|
||
<label>SGST Amt <?php echo "($INRSYM)" ?></label>
|
||
<?php
|
||
$data = array('name' => 'AfterSgst', 'value' => set_value('AfterSgst', 0.00), 'id' => 'AfterSgst', 'class' => 'form-control num', 'readonly' => 'true');
|
||
echo form_input($data);
|
||
?>
|
||
</div>
|
||
</div>
|
||
<div class="form-row" id="IGSTAddModel" style="display:none;">
|
||
<div class="form-group col-md-6"></div>
|
||
<div class="form-group col-md-3">
|
||
<label>IGST In %</label>
|
||
<?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 class="form-group col-md-3">
|
||
<label>IGST Amt <?php echo "($INRSYM)" ?></label>
|
||
<?php
|
||
$data = array('name' => 'AfterIgst', 'value' => set_value('AfterIgst', 0.00), 'id' => 'AfterIgst', 'class' => 'form-control num', 'readonly' => 'true');
|
||
echo form_input($data);
|
||
?>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-row">
|
||
<div class="form-group col-md-9"></div>
|
||
<div class="form-group col-md-3">
|
||
<label> Insurance <?php echo "($INRSYM)" ?> (if Any)</label>
|
||
<?php
|
||
$data = array('name' => 'txtInsurance', 'value' => set_value('txtInsurance', 0.00), 'id' => 'txtInsurance', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'calculateTotalValue(0);');
|
||
echo form_input($data);
|
||
?>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-row">
|
||
<div class="form-group col-md-9"></div>
|
||
<div class="form-group col-md-3 ">
|
||
<label><?php echo "Total Order Amt ($INRSYM)"; ?></label>
|
||
<?php
|
||
$data = array('name' => 'txtTotalOrderValue', 'value' => set_value('txtTotalOrderValue', 0.00), 'id' => 'txtTotalOrderValue', 'class' => 'form-control num', 'readonly' => 'true');
|
||
echo form_input($data);
|
||
?>
|
||
</div>
|
||
</div>
|
||
<div class="form-row">
|
||
<div class="form-group col-md-12">
|
||
<label><?php echo "Revenue Description"; ?></label>
|
||
<?php
|
||
$data = array('name' => 'Service_Description', 'value' => set_value('Service_Description'), 'id' => 'Service_Description', 'class' => 'form-control', 'rows' => '2', 'cols' => '100');
|
||
echo form_textarea($data);;
|
||
?>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
</div>
|
||
<div class="modal-footer">
|
||
|
||
<a class="btn btn-secondary waves-effect" data-dismiss="modal" value="Cancel">Cancel</a>
|
||
<a class="btn btn-info waves-effect waves-light font AddRevenue" ID="AddRevenue"> <span class="bold">Add Revenue</span></a>
|
||
|
||
</div>
|
||
</form>
|
||
|
||
</div>
|
||
</div>
|
||
</div><!-- /.modal -->
|
||
</div>
|
||
|
||
<!-- Edit Model for revenue po -->
|
||
<div align="center">
|
||
<div id="EDITREVENUE" class="modal fade" tabindex="-1" role="dialog"
|
||
aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
|
||
<div class="modal-dialog modal-full-width">
|
||
<div class="modal-content" align="left" style="width:1060px;">
|
||
<div class="modal-header">
|
||
<h4 class="modal-title">Edit Revenue Purchase Order Line Item </h4>
|
||
<button type="button" class="close" data-dismiss="modal"
|
||
aria-hidden="true">×</button>
|
||
</div>
|
||
<form>
|
||
<div class="modal-body p-4">
|
||
<div class="form-row">
|
||
<div class="form-group col-md-3">
|
||
<label>Req No<span class="text-danger">*</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="form-group 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="form-group 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="form-group 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', 'readonly' => 'true');
|
||
echo form_input($data);
|
||
?>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="form-row">
|
||
<div class="form-group col-md-3">
|
||
<label>Item Code<span class="text-danger">*</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="form-group col-md-3">
|
||
<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="form-group col-md-3">
|
||
<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="form-group col-md-3">
|
||
<label>Quantity<span class="text-danger">*</span></label>
|
||
<div class="form-group">
|
||
<?php
|
||
$data = array('name' => 'EditQuantity', 'value' => set_value('EditQuantity'), 'id' => 'EditQuantity', 'class' => 'form-control', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'Editchange()', 'style' => 'text-align:right;');
|
||
echo form_input($data);
|
||
?>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
</div>
|
||
|
||
<div class="form-row">
|
||
<div class="form-group col-md-3"></div>
|
||
<div class="form-group col-md-3">
|
||
<label><?php echo "Rate ($INRSYM)" ?><span class="text-danger">*</span></label>
|
||
<div class="form-group">
|
||
<?php
|
||
$data = array('name' => 'EditRate', 'value' => set_value('EditRate'), 'id' => 'EditRate', 'class' => 'form-control', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'Editchange()', 'style' => 'text-align:right;');
|
||
echo form_input($data);
|
||
?>
|
||
</div>
|
||
</div>
|
||
<div class="form-group 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="form-group 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', 'readonly' => 'true', 'style' => 'text-align:right;');
|
||
echo form_input($data);
|
||
?>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-row">
|
||
<div class="col-md-3"></div>
|
||
<div class="col-md-3">
|
||
<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="form-group col-md-3">
|
||
<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();', 'style' => 'text-align:right;');
|
||
echo form_input($data);
|
||
?>
|
||
</div>
|
||
</div>
|
||
<div class="form-group col-md-3">
|
||
<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>
|
||
|
||
<div class="form-row" style="text-align:left;">
|
||
<div class="col-md-3"></div>
|
||
<div class="col-md-3">
|
||
<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="form-group col-md-3">
|
||
<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="form-group col-md-3">
|
||
<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>
|
||
|
||
<div class="form-row">
|
||
<div class="col-md-3"></div>
|
||
<div class="col-md-3">
|
||
<label>Freight Type </label>
|
||
<?php
|
||
$options = array("0" => 'Select Freight Type');
|
||
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 class="form-group col-md-3">
|
||
<label>Freight Rate </label>
|
||
<?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 class="form-group col-md-3">
|
||
<label>Freight Amt <?php echo "($INRSYM)" ?></label>
|
||
<?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="form-row">
|
||
<div class="col-md-9"></div>
|
||
<div class="form-group col-md-3" id="EditTripsValue" style="display:none;">
|
||
<label>NO Of Trips</label>
|
||
<?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="form-row" id="cgstContainerEdit">
|
||
<div class="form-group col-md-6"></div>
|
||
<div class="form-group col-md-3">
|
||
<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="form-group col-md-3">
|
||
<label>CGST Amt <?php echo "($INRSYM)" ?></label>
|
||
<div class="form-group">
|
||
<?php
|
||
$data = array('name' => 'EditAfterCgst', 'value' => set_value('EditAfterCgst', 0.00), 'id' => 'EditAfterCgst', 'class' => 'form-control num', 'readonly' => 'true');
|
||
echo form_input($data);
|
||
?>
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="form-row" id="SGSTEditModel">
|
||
|
||
<div class="form-group col-md-6"></div>
|
||
<div class="form-group col-md-3">
|
||
<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="form-group col-md-3">
|
||
<label>SGST Amt <?php echo "($INRSYM)" ?></label>
|
||
<div class="form-group">
|
||
<?php
|
||
$data = array('name' => 'EditAfterSgst', 'value' => set_value('EditAfterSgst', 0.00), 'id' => 'EditAfterSgst', 'class' => 'form-control num', 'readonly' => 'true');
|
||
echo form_input($data);
|
||
?>
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="form-row" id="IGSTEditModel" style="display:none;">
|
||
<div class="col-md-6"></div>
|
||
<div class="form-group col-md-3">
|
||
<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="form-group col-md-3">
|
||
<label>IGST Amt <?php echo "($INRSYM)" ?></label>
|
||
<div class="form-group">
|
||
<?php
|
||
$data = array('name' => 'EditAfterIgst', 'value' => set_value('EditAfterIgst', 0.00), 'id' => 'EditAfterIgst', 'class' => 'form-control num', 'readonly' => 'true');
|
||
echo form_input($data);
|
||
?>
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="form-row">
|
||
<div class="form-group col-md-9"></div>
|
||
<div class="form-group col-md-3">
|
||
<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="form-row">
|
||
<div class="form-group col-md-9"></div>
|
||
<div class="form-group col-md-3">
|
||
<div class="form-group">
|
||
<label><?php echo "Total Order Amt ($INRSYM)"; ?></label>
|
||
<?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="form-row">
|
||
<div class="form-group col-md-12">
|
||
<label><?php echo "Reveneue Description"; ?></label>
|
||
|
||
<?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="modal-footer" style="border:none;">
|
||
<a class=" btn btn-secondary waves-effect" data-dismiss="modal" value="Cancel">Cancel</a>
|
||
<a class="btn btn-info waves-effect waves-light EditRevenue" ID="EditRevenue"> <span class="bold">Edit Revenue</span></a>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
</div>
|
||
</div><!-- /.modal -->
|
||
</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>
|
||
<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> </a> <a href='#' onclick="DeleteRow('<%=index%>')" class="link" data-id="<%=index%>" data-userid="<%=index%>" id="Del"><span class="ri-delete-bin-7-fill"></span></a>
|
||
</td>
|
||
</tr>
|
||
</script> -->
|
||
<script>
|
||
var index = '1';
|
||
var userid = '';
|
||
|
||
$("#REVENUE").on("shown.bs.modal", function(e) {
|
||
|
||
$('#isEdit').val(0);
|
||
});
|
||
|
||
$("#insurance").change(function() {
|
||
var ans = $("#insurance").val();
|
||
//alert(ans);
|
||
if (ans == 0) {
|
||
$("#InsuranceNumberdiv").hide();
|
||
$("#InsuranceNumber").val("");
|
||
} else {
|
||
$("#InsuranceNumberdiv").show();
|
||
$("#InsuranceNumber").val('Yes');
|
||
}
|
||
});
|
||
|
||
|
||
$("#BudgetType").change(function() {
|
||
|
||
var aa = $("#BudgetType option:selected").text();
|
||
|
||
$('#Budget').val(aa);
|
||
|
||
|
||
});
|
||
|
||
|
||
$(document).ready(function() {
|
||
$("#EDITREVENUE").on("shown.bs.modal", function(e) {
|
||
|
||
userid = $(e.relatedTarget).data('userid');
|
||
// alert("**");
|
||
$('#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($('#AvilBudget' + userid).val());
|
||
|
||
$('#EditItemName').val($('#materialName' + userid).val());
|
||
$('#EditUOM').val($('#uom' + userid).val());
|
||
$('#EditQuantity').val($('#quantity' + userid).val());
|
||
$('#EditRate').val($('#itemRate' + userid).val());
|
||
var p = $('#per' + userid).val()
|
||
if (p != "") {
|
||
$('#EditPer').val($('#per' + userid).val());
|
||
} else {
|
||
$('#EditPer').val($('#uom' + userid).val());
|
||
}
|
||
$('#txtEditBasicValue').val(cellval[8].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());
|
||
$('#EditNOOfTrips').val($('#NoOfTrip' + userid).val());
|
||
$('#txtEditInsurance').val($('#Insval' + userid).val());
|
||
|
||
var FreightType = $('#FreightType' + userid).val();
|
||
|
||
if (FreightType == "PER TRIP") {
|
||
$('#EditTripsValue').show();
|
||
} else {
|
||
$('#EditTripsValue').hide();
|
||
}
|
||
$('#txtEditTotalOrderValue').val($('#TotalOrderValue' + userid).val());
|
||
tinyMCE.get('Edit_Service_Description').setContent($('#Service_Description' + userid).val());
|
||
//$('#Edit_Service_Description').val($('#Service_Description'+userid).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');
|
||
|
||
|
||
});
|
||
});
|
||
$('.AddRevenue').click(function() {
|
||
tinyMCE.triggerSave();
|
||
if (validateRevenueTax() && ExceedQuantityCheck()) {
|
||
// console.log(index);
|
||
var temp = index;
|
||
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 = $("#Quantity").val();
|
||
var itemRate = parseFloat($("#Rate").val()).toFixed(2);
|
||
var per = $("#AddPer").val();
|
||
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 FreightType = $("#drpFreight").val();
|
||
var FreightVal = $("#txtFreight").val();
|
||
var AfterFreightVal = $("#txtAfterFreight").val();
|
||
var NoOfTrip = $("#NOOfTrips").val();
|
||
var basicval = $("#txtBasicValue").val();
|
||
var Insval = parseFloat($('#txtInsurance').val() == '' ? '0.00' : $('#txtInsurance').val()).toFixed(2);
|
||
|
||
var TotalOrderValue = $("#txtTotalOrderValue").val();
|
||
|
||
var Service_Description = $('#Service_Description').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 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,
|
||
|
||
});
|
||
|
||
populateValueMainFormForRevenue();
|
||
|
||
|
||
|
||
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,
|
||
// BasicAmount: basicval,
|
||
// Taxvalue: TotalTaxValue,
|
||
// TotalValue: TotalOrderValue
|
||
// }));
|
||
|
||
// Define your template using ES6 template literals
|
||
var shorten = materialName.length > 13 ? materialName.slice(0, 13) + "..." : materialName;
|
||
var rowHtml = `
|
||
<tr id="${temp}">
|
||
<td style="text-align:left !important">${temp}</td>
|
||
<td style="text-align:left !important">${Reqnumber}</td>
|
||
<td style="text-align:left !important">${materialCode}</td>
|
||
<td style="text-align:left !important">${shorten}</td>
|
||
<td style="text-align:left !important">
|
||
<a href="#" class="editable-field"
|
||
data-notes = "-" data-id ="${temp}">-</a>
|
||
<div class="edit-container" style="display:none;">
|
||
<input type="text" class="edit-input-field" />
|
||
<button class="save-btn">✔</button>
|
||
<button class="cancel-btn">✖</button>
|
||
</div>
|
||
</td>
|
||
<td style="text-align:right !important">${quantity}</td>
|
||
<td style="text-align:left !important">${uom}</td>
|
||
<td style="text-align:right !important">${itemRate}</td>
|
||
<td style="text-align:right !important">${basicval}</td>
|
||
<td style="text-align:right !important">${TotalTaxValue}</td>
|
||
<td style="text-align:right !important">${TotalOrderValue}</td>
|
||
<td>
|
||
<a data-target='#EDITREVENUE' data-id="${temp}" data-userid="${temp}" data-toggle="modal" href="#EDITREVENUE">
|
||
<i class="ri-pencil-fill" data-toggle="tooltip"></i>
|
||
</a>
|
||
|
||
<a href='#' onclick="DeleteRow('${temp}')" class="link" data-id="${temp}" data-userid="${temp}" id="Del">
|
||
<span class="ri-delete-bin-7-fill"></span>
|
||
</a>
|
||
</td>
|
||
</tr>
|
||
`;
|
||
|
||
// Append the generated HTML to the target container
|
||
$('#RevenueAppend').append(rowHtml);
|
||
|
||
|
||
|
||
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, "per" + temp, per);
|
||
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, "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, "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, "Service_Description" + temp, Service_Description);
|
||
addHidden(theForm, "LineItemNo" + temp, 0);
|
||
addHidden(theForm, "LineItemNoteForAuditor" + temp, '-');
|
||
$('#txtRowCount').val(temp);
|
||
$('#REVENUE').modal('hide');
|
||
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();
|
||
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();
|
||
// tinyMCE.get('EdittxtSpcialInstruction').setContent($('#ItemDescription'+userid).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[5].innerHTML = editQuantity;
|
||
cellval[6].innerHTML = editUOM;
|
||
cellval[7].innerHTML = itemRate;
|
||
cellval[8].innerHTML = basicval;
|
||
cellval[9].innerHTML = TotalTaxValue;
|
||
cellval[10].innerHTML = TotalOrderValue;
|
||
|
||
|
||
$('#materialCode' + userid).val(editMaterialCode);
|
||
$('#materialName' + userid).val(editDescription);
|
||
$('#uom' + userid).val(editUOM);
|
||
$('#quantity' + userid).val(editQuantity);
|
||
$('#itemRate' + userid).val(itemRate);
|
||
$('#per' + userid).val(per);
|
||
$('#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);
|
||
$('#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);
|
||
$('#NoOfTrip' + userid).val(NoOfTrip);
|
||
|
||
$('#AfterFreightVal' + userid).val(AfterFreightVal);
|
||
$('#basicval' + userid).val(basicval);
|
||
$('#Insval' + userid).val(Insval);
|
||
$('#TotalOrderValue' + userid).val(TotalOrderValue);
|
||
$('#Service_Description' + userid).val(Service_Description);
|
||
populateValueMainFormForEditRevenueTax();
|
||
$('#EDITREVENUE').modal('hide');
|
||
}
|
||
|
||
});
|
||
|
||
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 = $('#txtTotalInsurance').val() == '' ? '0.00' : $('#txtTotalInsurance').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));
|
||
$('#txtTotalInsurance').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 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;
|
||
|
||
|
||
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 < rows);
|
||
|
||
// alert(totOrderSummaryAmt);
|
||
$('#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('');
|
||
$('#Quantity').val('');
|
||
$("#Rate").val('');
|
||
$("#AddPer").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');
|
||
|
||
ExciseOption = '';
|
||
PackOption = '';
|
||
CSTOption = '';
|
||
VatOption = '';
|
||
|
||
$("#Cgst").val(0);
|
||
$("#AfterCgst").val(0);
|
||
$("#Sgst").val(0);
|
||
$("#AfterSgst").val(0);
|
||
$("#Igst").val(0);
|
||
$("#AfterIgst").val(0);
|
||
|
||
|
||
$("#drpFreight").val('0');
|
||
$("#txtFreight").val('');
|
||
$("#txtAfterFreight").val('');
|
||
$("#NOOfTrips").val('');
|
||
$("#txtBasicValue").val('');
|
||
$("#txtInsurance").val('');
|
||
$("#txtTotalOrderValue").val('');
|
||
tinyMCE.activeEditor.setContent('');
|
||
//$('#Service_Description').val('');
|
||
}
|
||
|
||
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;
|
||
}
|
||
}
|
||
</script>
|
||
<script>
|
||
function DeleteRow(rowid) {
|
||
var DelRows = $('#txtDeletedRow').val();
|
||
//alertMaterialListrowid);
|
||
|
||
var answer = confirm(" Do you want to delete the Item from the List?")
|
||
if (answer) {
|
||
var td = document.getElementById(rowid);
|
||
td.parentNode.removeChild(td);
|
||
|
||
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);
|
||
}
|
||
});
|
||
// alert(SelectedMaterialCode);
|
||
if (DelRows != '') {
|
||
DelRows = DelRows + ":" + rowid;
|
||
} else {
|
||
DelRows = "0" + ":" + rowid;
|
||
}
|
||
$('#txtDeletedRow').val(DelRows);
|
||
populateValueMainFormForDeleteItem(rowid);
|
||
}
|
||
|
||
}
|
||
|
||
function populateValueMainFormForDeleteItem(rowid) {
|
||
|
||
|
||
// alert(rows);
|
||
var totBasicAmt = $('#txtTotBasicAmount').val();
|
||
var totDiscountAmt = $('#txtTotalDiscount').val();
|
||
var totPackagingAmt = $('#txtTotalPackaing').val();
|
||
|
||
var totFreightAmt = $('#txtTotalFreight').val();
|
||
var totInsuranceAmt = $('#txtTotalInsurance').val();
|
||
var totOrderSummaryAmt = $('#txtTotalOrderValueSummary').val();
|
||
|
||
var totCgst = $('#txtTotalCGST').val();
|
||
var totSgst = $('#txtTotalSGST').val();
|
||
var totIgst = $('#txtTotalIGST').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));
|
||
$('#txtTotalInsurance').val(parseFloat(totInsuranceAmt).toFixed(2));
|
||
$('#txtTotalOrderValueSummary').val(parseFloat(totOrderSummaryAmt).toFixed(2));
|
||
|
||
}
|
||
|
||
function Save(status) {
|
||
|
||
if (status == '0') {
|
||
stat = '<?php echo PO_DRAFT; ?>';
|
||
} else {
|
||
stat = '<?php echo PO_CREATED; ?>';
|
||
}
|
||
|
||
$('#txtStatus').val(stat);
|
||
tinyMCE.triggerSave();
|
||
var splinstr = $('#txtSpcialInstruction').val();
|
||
$('#SpcialInstruction').val(splinstr);
|
||
var AvlBudAmt = '<?php echo $AvlAmount ?>';
|
||
var txtTotBasicAmount = $('#txtTotBasicAmount').val();
|
||
var txtTotalDiscount = $('#txtTotalDiscount').val();
|
||
var finalBasicAmount = txtTotBasicAmount - txtTotalDiscount;
|
||
//alert(txtTotBasicAmount+"--"+txtTotalDiscount+"--"+finalBasicAmount+"--"+AvlBudAmt);
|
||
if (revenueValidate()) {
|
||
// if (document.getElementById('revenueTax').rows.length < 1) {
|
||
// alert('Please Select Line item to Create PO');
|
||
// return false;
|
||
// }
|
||
// else if(parseInt(AvlBudAmt) < parseInt(finalBasicAmount)) {
|
||
// 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 ($('#insurance').val() == 1 && $('#InsuranceNumber').val() == '') {
|
||
// alert('Please Enter Insurance No / Insurance Details..!');
|
||
// $('#insurance').focus();
|
||
// return false;
|
||
// } else if ($('#PoTypeOptions').val() == "0") {
|
||
// alert('Please Select Revenue Type');
|
||
// $('#PoTypeOptions').focus();
|
||
// return false;
|
||
// }
|
||
// else {
|
||
|
||
var formData = new FormData($('.CreatePO')[0]);
|
||
$('#loader').show();
|
||
|
||
$.ajax({
|
||
type: "POST",
|
||
url: "<?php echo base_url() ?>purchaseorder/addNewPurchaseOrder",
|
||
data: formData,
|
||
processData: false,
|
||
contentType: false,
|
||
success: function(data) {
|
||
$('#loader').hide();
|
||
if (data) {
|
||
|
||
alert(data);
|
||
$('#txtRowCount').val('');
|
||
$('#txtDeletedRow').val('');
|
||
//$('#SpcialInstruction').val('');
|
||
//$('#txtDeliveryAddress').val('');
|
||
window.location = "purchaseorderListing";
|
||
// setTimeout(function() { enableButtons(); }, 2000);
|
||
|
||
|
||
} else {
|
||
alert("Error");
|
||
// setTimeout(function() { enableButtons(); }, 2000);
|
||
}
|
||
|
||
},
|
||
error: function(jqXHR, textStatus, errorThrown) {
|
||
$('#loader').hide();
|
||
console.error("AJAX Error: " + textStatus + ": " + errorThrown);
|
||
alert("Error: " + textStatus);
|
||
// setTimeout(function() { enableButtons(); }, 2000);
|
||
}
|
||
|
||
});
|
||
// }
|
||
|
||
}
|
||
}
|
||
|
||
$(function() {
|
||
|
||
// $('#revenueTax').DataTable({
|
||
// "paging": false,
|
||
// "lengthChange": false,
|
||
// "searching": false,
|
||
// "ordering": false,
|
||
// // "info": true,
|
||
// "autoWidth": false
|
||
// });
|
||
});
|
||
// 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'
|
||
// });
|
||
|
||
});
|
||
$('#Deliverydt').change(function() {
|
||
|
||
|
||
$('#Scheduleby').val('');
|
||
|
||
});
|
||
|
||
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 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()));
|
||
}
|
||
//alert($('#Cgst').val());
|
||
if ($("#Sgst").val() != '') {
|
||
|
||
$('#AfterSgst').val(calculateCgstTax($('#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 calculateCgstTax(varBasicValue, Cgst, discount, pack, freight) {
|
||
//alert('hai');
|
||
var discount = discount;
|
||
var packaging = pack;
|
||
var freight = freight;
|
||
var packfreight = parseFloat(packaging) + parseFloat(freight);
|
||
// alert( packfreight);
|
||
var basicValue1 = parseFloat(varBasicValue - discount);
|
||
// alert("basicValue1:"+basicValue1);
|
||
var basicValue = parseFloat(basicValue1 + packfreight);
|
||
var Cgst = parseFloat(Cgst);
|
||
// alert("Cgst:"+Cgst);
|
||
// alert ("basicValue:"+basicValue);
|
||
var ServiceTaxValue = 0.0;
|
||
|
||
|
||
ServiceTaxValue = <?php echo SERVICETAX_CGST; ?>;
|
||
|
||
var TAXval = parseFloat(ServiceTaxValue).toFixed(2);
|
||
|
||
return TAXval; // $('#AfterServiceTax').val(TAXval);
|
||
|
||
}
|
||
|
||
function calculateSgstTax(varBasicValue, Sgst, discount, pack, freight) {
|
||
var discount = discount;
|
||
var packaging = pack;
|
||
var freight = freight;
|
||
var packfreight = parseFloat(packaging) + parseFloat(freight);
|
||
// alert( packfreight);
|
||
var basicValue1 = parseFloat(varBasicValue - discount);
|
||
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;
|
||
// alert(discount);
|
||
var packaging = parseFloat(pack1);
|
||
//alert(packaging);
|
||
var freight = parseFloat(freight1);
|
||
//alert(freight);
|
||
var packfreight = parseFloat(packaging) + parseFloat(freight);
|
||
//alert(packfreight);
|
||
var basicValue1 = parseFloat(varBasicValue - discount);
|
||
// alert(basicValue1);
|
||
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);
|
||
|
||
return TAXval; // $('#AfterServiceTax').val(TAXval);
|
||
|
||
}
|
||
|
||
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 txtEditAfterPackaging = $('#txtEditAfterPackaging').val() == '' ? '0.00' : $('#txtEditAfterPackaging').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
|
||
$(document).ready(function(){
|
||
$("#PaymentTerms").change(function() {
|
||
if ($('#PaymentTerms').val().trim() == 'PT08') {
|
||
$('#otheroptiondiv').show();
|
||
$('#Otherpayment').prop('required', true);
|
||
} else {
|
||
$('#otheroptiondiv').hide();
|
||
$('#Otherpayment').prop('required', false);
|
||
$('#Otherpayment').val('');
|
||
}
|
||
});
|
||
})
|
||
|
||
|
||
function clearTotalItemValues() {
|
||
|
||
|
||
$('#txtTotBasicAmount').val('');
|
||
$('#txtTotalDiscount').val('');
|
||
$('#txtTotalPackaing').val('');
|
||
|
||
$('#txtTotalCGST').val('');
|
||
$('#txtTotalSGST').val('');
|
||
$('#txtTotalIGST').val('');
|
||
|
||
$('#txtTotalFreight').val('');
|
||
$('#txtTotalInsurance').val('');
|
||
$('#txtTotalOrderValueSummary').val('');
|
||
|
||
}
|
||
|
||
function Reset() {
|
||
// disableButtons();
|
||
location.reload();
|
||
// setTimeout(function() {
|
||
// enableButtons();
|
||
// }, 2000);
|
||
|
||
}
|
||
|
||
|
||
function disableButtons() {
|
||
document.querySelectorAll('.Save, .Submit').forEach(function(button) {
|
||
button.classList.add('disabled');
|
||
button.setAttribute('disabled', 'disabled');
|
||
});
|
||
}
|
||
|
||
|
||
function enableButtons() {
|
||
document.querySelectorAll('.Save, .Submit').forEach(function(button) {
|
||
button.classList.remove('disabled');
|
||
button.removeAttribute('disabled');
|
||
});
|
||
}
|
||
|
||
|
||
</script>
|