Iniit
This commit is contained in:
@@ -0,0 +1,881 @@
|
||||
var Unibase;
|
||||
(function (Unibase) {
|
||||
let Forms;
|
||||
(function (Forms) {
|
||||
let Controls;
|
||||
(function (Controls) {
|
||||
class ItemDetails extends Unibase.Platform.Core.BaseComponent {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.rowIndex = 0;
|
||||
this.deletedItems = new Array();
|
||||
this.itemIds = new Array();
|
||||
this.SplitedInvoiceItemList = new Array();
|
||||
this.deleted_invoiceItems = new Array();
|
||||
this.container = "";
|
||||
}
|
||||
init(formpropertyid, prop, callback) {
|
||||
var instance = ItemDetails.Instance();
|
||||
instance.loadControlSettings(prop.ControlJsonText, prop.FormPropertyId);
|
||||
instance.loadPropertySettings(prop.PropertySettings, prop.FormPropertyId);
|
||||
Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("platform/controls/itemdetails/item.mrp.js", function () {
|
||||
});
|
||||
}
|
||||
loadControl(containerid, prop) {
|
||||
var html = '<div class="section_ItemDetails card"><div class="card-header">Item Details</div><div class="card-body"><div class="row"><div id="control-container-100691780039438" class="control-group divCustomProperties divCustomProperties_InvoiceItemEntity controldata_0 col-sm-12 " data-size="12" data-propertyname="null" data-propertyid="0" data-doctypeid="0" data-level="0" data-doctypetable="null" data-doctypename="InvoiceItemEntity" data-isdefault="false" data-rowindex="13" data-formpropertyid="100691780039438" data-controlname="InvoiceItems" data-validatename="InvoiceItems"><div class="panel panel-default" style="padding-bottom:10px" id="invoiceitem"><input type="hidden" id="hdninvoiceitem" class="" value="" data-isdynamic="true" data-propdoctypename=""><div class="" style="padding-bottom:10px"> <div id="tbl_InvoiceItems" class="col-sm-12 d-none d-md-block "><div class="row lineheight wrapper-sm" style="border-bottom: 2px solid grey;"><div class="col-sm-4 min-padding"><strong class="ml-10">Item Name</strong></div><div class="col-sm-2 text-center"><strong class="">Qty</strong></div><div class="col-sm-2 text-center min-padding"><strong>Unit Price</strong></div><div class="col-sm-2 text-center min-padding"><strong>Disc.</strong></div><div class="col-sm-2 text-right min-padding"><strong>Total</strong></div></div></div></div><div class="panel-body InvoiceItems"><div class="item-row added-row InvoiceitemRow-0 "></div><div class="discount-row hidden"></div></div></div><a href="javascript:;" class="default pull-left" title="Add Item" data-original-title="Add Item"><span class="pull-right btn" style="text-decoration:underline;color:deepskyblue" id="btnInvoiceItem"> Add Item</span></a></div></div></div></div>';
|
||||
$("#" + containerid).html(html);
|
||||
$("#btnInvoiceItem").off().click(function () {
|
||||
ItemDetails.instance.AddRow();
|
||||
});
|
||||
ItemDetails.instance.container = containerid;
|
||||
Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("tenants/themes/default/components/details/details.js", function () {
|
||||
});
|
||||
}
|
||||
loadControlSettings(controlsettingjson, formpropertyid) {
|
||||
return null;
|
||||
}
|
||||
loadPropertySettings(propertysettings, formpropertyid) {
|
||||
return null;
|
||||
}
|
||||
bindEditFormDetails(formpropertyid, propval, DocPropertyName) {
|
||||
return null;
|
||||
}
|
||||
AddRow() {
|
||||
var emptyRow = {
|
||||
orderItemId: 0,
|
||||
invoiceItemId: 0,
|
||||
itemName: "",
|
||||
itemId: 0,
|
||||
itemSKU: "",
|
||||
unitName: "",
|
||||
packSize: 0,
|
||||
packCount: 0,
|
||||
packs: 0,
|
||||
quantity: 0,
|
||||
availPacks: 0,
|
||||
availQty: 0,
|
||||
listPrice: 0,
|
||||
description: "",
|
||||
taxGroupName: "",
|
||||
taxGroupId: 0,
|
||||
isTaxInclusive: $("#hfIsTaxInclusive").val(),
|
||||
addlDiscountPercent: 0,
|
||||
addlDiscountValue: 0,
|
||||
creditNote: 0,
|
||||
priceListId: 0,
|
||||
batchId: 0,
|
||||
unitPrice: 0,
|
||||
invoiceallocations: null,
|
||||
exciseInvoiceItem: null,
|
||||
accountId: 0,
|
||||
accountName: "",
|
||||
walletId: 0,
|
||||
Adjustment: 0,
|
||||
IsFoc: false,
|
||||
TariffNo: "",
|
||||
exciseAmount: 0,
|
||||
discountName: "",
|
||||
discountId: 0,
|
||||
_description: "",
|
||||
refNo: "",
|
||||
DiscountGroupId: 0,
|
||||
DiscountGroupName: '',
|
||||
RefInvoiceItemId: 0,
|
||||
MrpId: 0,
|
||||
taxAdjustment: 0,
|
||||
assesableAdjustment: 0,
|
||||
inventoryTypeId: 0,
|
||||
dcItemId: 0,
|
||||
TotalRowAmount: 0,
|
||||
maxQty: 0,
|
||||
};
|
||||
this.addDataRow(emptyRow);
|
||||
}
|
||||
addDataRow(row) {
|
||||
Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("tenants/themes/default/components/details/details.js", function () {
|
||||
});
|
||||
this.rowIndex = $(".InvoiceItems").find(".item-addedrow").length + 1;
|
||||
var bg = "";
|
||||
if (row.packSize == 0)
|
||||
row.packSize = 1;
|
||||
if (row.packCount == 0)
|
||||
row.packCount = 1;
|
||||
if (row.quantity == 0)
|
||||
row.quantity = row.packCount * row.packs * row.packSize;
|
||||
var price = row.unitPrice;
|
||||
if (row.unitPrice == 0)
|
||||
price = row.listPrice;
|
||||
var currenttaxgroupid = 0;
|
||||
if ($("#hfInv_Invoicetype").val() == "PurchaseReturn" || $("#hfInv_Invoicetype").val() == "SalesReturn")
|
||||
row.invoiceallocations = null;
|
||||
if ($('#hfInv_IsRetun').val() == 1)
|
||||
row.invoiceItemId = 0;
|
||||
var zeroBilled = "";
|
||||
if (price == 0)
|
||||
zeroBilled = "bg-danger";
|
||||
var zeroQtyText = "";
|
||||
var zeroQtyDiv = "bg-light";
|
||||
var recordId = Unibase.Themes.Providers.Detail_Settings.Instance().RecordId;
|
||||
if (recordId == 0 || recordId == undefined) {
|
||||
if ($('#hfInv_IsRetun').val() == 1 && row.itemId != 0 && ($('#hfInv_Invoicetype').val() == 'Sales' || $('#hfInv_Invoicetype').val() == 'PurchaseReturn')) {
|
||||
if (row.availQty == 0) {
|
||||
row.quantity = 0;
|
||||
zeroQtyText = "text-danger";
|
||||
zeroQtyDiv = "bg-danger";
|
||||
}
|
||||
else if (row.availQty < row.quantity) {
|
||||
row.quantity = row.availQty;
|
||||
}
|
||||
}
|
||||
}
|
||||
var readonlyQty = "";
|
||||
if (($("#hfDcId").val() != "0" || $("#hfDcId").val() == "") && recordId == 0) {
|
||||
readonlyQty = "readonly";
|
||||
}
|
||||
var ManageInvoice = 2;
|
||||
var AutoDc = false;
|
||||
var ManageInvoiceTax = 2;
|
||||
var readonlyPrice = "";
|
||||
var readonlyDisc = "";
|
||||
var readonlyTax = "";
|
||||
if (ManageInvoice == 1 && AutoDc == false) {
|
||||
readonlyQty = "readonly";
|
||||
readonlyPrice = "readonly";
|
||||
readonlyDisc = "readonly";
|
||||
readonlyTax = "disabled";
|
||||
}
|
||||
if ($('#hfInv_Invoicetype').val() == "Sales" && ManageInvoiceTax == 1 && AutoDc == false) {
|
||||
readonlyTax = "readonly";
|
||||
}
|
||||
if (row.inventoryTypeId == "2") {
|
||||
readonlyQty = "";
|
||||
readonlyPrice = "";
|
||||
}
|
||||
var activeDiscVal = "";
|
||||
var activeDiscPercent = "";
|
||||
var activeDiscMul = "";
|
||||
var activeDiscText = "";
|
||||
var discValue = 0;
|
||||
if (row.addlDiscountPercent > 0) {
|
||||
discValue = row.addlDiscountPercent;
|
||||
activeDiscPercent = "active";
|
||||
activeDiscText = "%";
|
||||
}
|
||||
else if (row.addlDiscountValue > 0 && row.DiscountGroupId > 0) {
|
||||
discValue = row.addlDiscountValue;
|
||||
activeDiscMul = "active";
|
||||
activeDiscText = "Mul";
|
||||
}
|
||||
else {
|
||||
discValue = row.addlDiscountValue;
|
||||
activeDiscVal = "active";
|
||||
activeDiscText = "Val";
|
||||
}
|
||||
var itemNameClass = "floating-label-form-group";
|
||||
if (row.invoiceItemId != 0)
|
||||
itemNameClass = "";
|
||||
var mt = "";
|
||||
if (row.invoiceItemId != 0) {
|
||||
mt = "mt-5";
|
||||
}
|
||||
if (row.orderItemId != 0) {
|
||||
mt = "mt-10";
|
||||
}
|
||||
if (row.inventoryTypeId != 5 && row.inventoryTypeId != 6 && row.inventoryTypeId != 7) {
|
||||
var IsBom = "";
|
||||
if (row.IsBoMItem == true && row.IsBoMItem != undefined) {
|
||||
IsBom = "hidden";
|
||||
}
|
||||
var html = '<div id="div_itemAddedRow_' + this.rowIndex + '" class="item-row item-addedrow ' + bg + ' form-group">' +
|
||||
'<div class="row ' + IsBom + ' divItemRow_' + row.itemId + ' ">' +
|
||||
'<div class="col-sm-4">' +
|
||||
'<div class=" item-name min-padding" style="margin-left:20px;">' +
|
||||
'<lable for="lbl_itemname" class="d-md-none">Item Name</lable>' +
|
||||
'<input type="hidden" class="rowIndex" value="' + this.rowIndex + '" />' +
|
||||
'<input type="hidden" class="orderItemId" value="' + row.orderItemId + '" />' +
|
||||
'<input type="hidden" class="dcItemId" value="' + row.dcItemId + '" />' +
|
||||
'<input type="hidden" class="selectedInvoiceItemId" value="' + row.invoiceItemId + '" />' +
|
||||
'<input type="hidden" class="refInvoiceItemId" value="' + row.RefInvoiceItemId + '" />' +
|
||||
'<input type="hidden" class="selectedItemId" id="hf_txtitem_' + this.rowIndex + '" value="' + row.itemId + '" />' +
|
||||
'<input type="hidden" id="selectedItemId" value="' + row.itemId + '" />' +
|
||||
'<input type="hidden" class="hfMrpId" value="' + row.MrpId + '" />' +
|
||||
'<input type="hidden" class="offerapplied" value="0" />' +
|
||||
'<input type="hidden" class="refNo" value="' + row.refNo + '"/>' +
|
||||
'<input type="hidden" class="description" value="' + row.description + '"/>' +
|
||||
'<input type="hidden" class="IsExchangeItem" value="' + row.ExchangeItem + '" />' +
|
||||
'<input type="hidden" class="maxQty" value="' + row.maxQty + '" />' +
|
||||
'<input type="hidden" class="hfAccountId" value="' + row.accountId + '"/>' +
|
||||
'<input type="hidden" class="hfItemTaxAdjsutmentVal" value="' + row.taxAdjustment + '" />' +
|
||||
'<input type="hidden" class="hfItemAssesableAdjustmentVal" value="' + row.assesableAdjustment + '" />' +
|
||||
'<input type="hidden" class="hfoldItemId" value="' + row.itemId + '"/>' +
|
||||
'<input type="hidden" class="hf_IsFoc" value="' + row.IsFoc + '"/>';
|
||||
if (row.IsFoc == true) {
|
||||
html += '<input type="hidden" class="hfOfferedItemId" value="' + row.OfferItemId + '"/>';
|
||||
}
|
||||
html += '<div class="' + mt + '">' +
|
||||
'<a class="no-border bg-white delete" href = "javascript:;" title = "Remove row" style = "" > <i class="fa fa-trash-o fa-lg mt-15 mr-2" style="margin-left:-25px;color:red"></i></a>';
|
||||
if (row.invoiceItemId != 0) {
|
||||
var itemName = row.itemSKU + ' - ' + row.itemName;
|
||||
if (row.ExchangeItem)
|
||||
itemName = '(Exchange) ' + row.itemSKU + ' - ' + row.itemName;
|
||||
html += '<a class="default prodName-link mt-10 ItemName" href="javascript:;">' + itemName + '</a>';
|
||||
}
|
||||
else {
|
||||
var itemName = "";
|
||||
if (row.ExchangeItem)
|
||||
itemName = '(Exchange) ' + row.itemName;
|
||||
else if (itemName != "" && row.itemSKU != "") {
|
||||
itemName = row.itemSKU + '-' + row.itemName;
|
||||
html += '<a class="default prodName-link mt-10 ItemName" href="javascript:;">' + itemName + '</a>';
|
||||
}
|
||||
else if (itemName != "") {
|
||||
itemName = row.itemName;
|
||||
html += '<a class="default prodName-link mt-10 ItemName" href="javascript:;">' + itemName + '</a>';
|
||||
}
|
||||
else {
|
||||
html += '<select class="form-control prodName" value="" id="txt_item_' + this.rowIndex + '" placeholder=" Select the item to Invoice" style="width:100%;" id="txtItem"></select>';
|
||||
}
|
||||
}
|
||||
html += '</div>' +
|
||||
'</div></div>' +
|
||||
'<div class="col-sm-2 input-group pr-0">' +
|
||||
'<div class="col-sm-1 pl-0"><a class="btn btn-sm btn_offer hidden"><span class="badge badge-sm bg-danger count mt-20" style="color:white;margin-left:-30px">offer</span></a></div>' +
|
||||
'<div class="col-sm-10 pl-0">' +
|
||||
'<div class="floating-label-form-group text-center">' +
|
||||
'<lable for="lbl_qty" class="d-md-none">Qty</lable>' +
|
||||
'<input type="text" class="prodQuantity text-center ' + zeroQtyText + ' form-control" placeholder="0.00" value="' + row.quantity + '" ' + readonlyQty + ' />' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'<div class="col-sm-2 div_UnitPrice">' +
|
||||
'<div class="floating-label-form-group min-padding text-center"><lable for="lbl_unitprice" class="d-md-none">Unit Price</lable>';
|
||||
var readonly = "";
|
||||
html += '<input type="text" class="prodPrice text-center form-control" placeholder="0.00" value="' + price + '" ' + readonlyPrice + ' />';
|
||||
html += '</div></div>' +
|
||||
'<div class="col-sm-2 div_SplitInvoiceItem hidden"><div class="mt-20 text-center"><a href="javascript:;" class="mr-10"><span id="spn_InvoiceItem_' + this.rowIndex + '" class="spn_InvoiceItem" style="text-decoration:underline;">Select</span></a></div></div>' +
|
||||
'<div class="col-sm-2 div_Discount"> ' +
|
||||
'<div class="floating-label-form-group text-center">' +
|
||||
'<lable for="lbl_disc" class="d-md-none">Disc.</lable>' +
|
||||
'<input type="hidden" id="hfProdDiscountGroupId" value="' + row.DiscountGroupId + '" />' +
|
||||
'<input type="hidden" id="hfProdDiscountGroupName" value="' + row.DiscountGroupName + '" />' +
|
||||
'<input type="hidden" id="hfProdDiscountList" value="" />' +
|
||||
'<input type="hidden" id="hfProdDiscountApplyTypes" value="" />' +
|
||||
'<div class="input-group">' +
|
||||
'<input type="text" id="inv_txtdiscount" placeholder="0.00" class="form-control inv_txtaddldiscount" value="' + discValue + '" ' + readonlyDisc + '>' +
|
||||
'<div class="input-group-btn">' +
|
||||
'<select class="btnInvoice_DiscType btn_inv_DiscType mt-10 border-blue"><option value="Val">Val</option><option value="%">%</option></select>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'<div class="col-sm-2">' +
|
||||
'<input type="hidden" class="hfDiscountedAmount" value="0" />' +
|
||||
'<input type="hidden" class="hfRowTotalAdjustment" value="' + row.Adjustment + '" />' +
|
||||
'<input type="hidden" class="hfAssesableAdjustment" value="" />' +
|
||||
'<input type="hidden" class="hfTaxAdjustment" value="" />';
|
||||
if ($("#hfInv_Invoicetype").val() == "Purchase" || $("#hfInv_Invoicetype").val() == "PurchaseReturn" || $("#hfInv_Invoicetype").val() == "DebitNote") {
|
||||
html += '<a href="javascript:;" class=Adjustmentrow><input type="text" class="hfRowTotalwithAdjustment form-control txtRowTotalwithAdjustment text-right" value="0" style="color:#5ba8fb;cursor:pointer" disabled/></a>';
|
||||
html += '<a href="javascript:;" class="hidden" onclick="javascript:_bizgazetransact_invoice_edit.editInvItemTaxAllocs(' + row.invoiceItemId + ',' + row.taxGroupId + ',' + row.itemId + ',' + row.orderItemId + ')"><input type="text" style="color:#5ba8fb;text-decoration:underline;cursor:pointer" class="hfRowTotal form-control txtRowTotal text-right" value="0" /></a>';
|
||||
}
|
||||
else {
|
||||
html += '<p class="pull-right mt-10 mr-15 text-center"><lable for="lbl_disc" class="d-md-none">Total:</lable><strong><input type="hidden" class="hfRowTotal" value="0" /><span class="prodTotalPrice">0.00</span></strong></p>';
|
||||
}
|
||||
html += '</div>' +
|
||||
'</div><div class="hidden div_MoreDetails clear mt-5 ' + zeroQtyDiv + '">' +
|
||||
'<div class="row ml-5 mr-5">' +
|
||||
'<div class="col-sm-3">' +
|
||||
'<div class="floating-label-form-group form-group floating-label focus">' +
|
||||
'<label for="from_lbl_Description" id="lbl_Description">Description</label>' +
|
||||
'<input type="text" id="txt_Description" data-isdynamic="false" class="form-control floating-label-control " data-placeholder="Enter Description" placeholder="Description" data-label="Description"/>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'<div class="col-sm-3">' +
|
||||
'<div class="floating-label-form-group-with-value">' +
|
||||
'<label for="from_lbl_Output" id="lbl_Output">Tax Group<span class="text-danger">*</span></label>' +
|
||||
'<div class="input-group">';
|
||||
if (row.taxGroupId != 0) {
|
||||
html += '<select type="text" data-isdynamic="false" class="form-control ui-autocomplete prodTax required ' + readonlyTax + '" value="' + row.taxGroupName + '" data-placeholder="Output @ 18%" placeholder="Output" data-label="Output" style="width:100%;" data-required="true"></select>' +
|
||||
'<input type="hidden" id="hfProdTaxPercent_' + this.rowIndex + '" class="hfProdTaxPercent" value="0" />' +
|
||||
'<input type="hidden" id="hfProdTax_' + this.rowIndex + '" class="hfProdTax hidden" value="' + row.taxGroupId + '"/>' +
|
||||
'<input type="hidden" class="txtProdTax hidden" value="' + row.taxGroupName + '"/>';
|
||||
}
|
||||
else {
|
||||
html += '<select type="text" data-isdynamic="false" class="form-control text-control required select2-hidden-accessible prodTax required ' + readonlyTax + '" id="txt_prodTax_' + this.rowIndex + '" data-placeholder="Output @ 18%" placeholder="Output" data-label="Output" style="width:100%;" data-required="true" id="prodTax"></select>' +
|
||||
'<input type="hidden" id="hfProdTaxPercent_' + this.rowIndex + '" class="hfProdTaxPercent" value="0" />' +
|
||||
'<input type="hidden" id="hfProdTax_' + this.rowIndex + '" class="hfProdTax hidden" value="0"/>' +
|
||||
'<input type="hidden" class="txtProdTax hidden" value=""/>';
|
||||
}
|
||||
html += '</div>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'<div class="col-sm-3">' +
|
||||
'<div class="floating-label-form-group-with-value">' +
|
||||
'<label for="from_lbl_Account" id="lbl_Account">Account<span class="text-danger">*</span></label>';
|
||||
if (row.accountId != 0) {
|
||||
html += '<select data-isdynamic="false" class="form-control txt_Account required ' + readonlyTax + '" data-placeholder="Account Number" placeholder="Account" data-label="Account" value="' + row.accountName + '" id="txt_Account_' + this.rowIndex + '" style="width:100%;" data-required="true"></select>' +
|
||||
'<input type="hidden" id="hf_Account_' + this.rowIndex + '" class="hf_Account" value="' + row.accountId + '" />' +
|
||||
'<input type="hidden" id="txt_AccountName_' + this.rowIndex + '" class="txt_AccountName" value="' + row.accountName + '"/>';
|
||||
}
|
||||
else {
|
||||
html += '<select data-isdynamic="false" class="form-control text-control required select2-hidden-accessible txt_Account required ' + readonlyTax + '" data-placeholder="Account Number" placeholder="Account" id="txt_Account_' + this.rowIndex + '" data-label="Account" style="width:100%;" data-required="true"></select>' +
|
||||
'<input type="hidden" id="hf_Account_' + this.rowIndex + '" class="hf_Account" value="0" />' +
|
||||
'<input type="hidden" id="txt_AccountName_' + this.rowIndex + '" class="txt_AccountName" value=""/>';
|
||||
}
|
||||
html += '</div>' +
|
||||
'</div>' +
|
||||
'<div class="col-sm-3 mt-40 text-right">' +
|
||||
'<label for="from_lbl_Avalilability" id="lbl_Avalilability"><b>Availability:   </b></label>' +
|
||||
'<span class=" prodAvail">' + row.availQty + '</span>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'<div class="row">' +
|
||||
'<div class="col-sm-12">' +
|
||||
'<div class="col-sm-3 form-group div_Mrp hidden">' +
|
||||
'<div class="floating-label-form-group floating-label focus">' +
|
||||
'<input type="hidden" class="hf_PriceList" value="' + row.priceListId + '" />' +
|
||||
'<label for="from_lbl_MRP" id="lbl_MRP">MRP</label>' +
|
||||
'<input type="text" data-isdynamic="false" class="form-control floating-label-control txt_MRP" data-placeholder="53" placeholder="MRP" data-label="MRP" />' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'<div class="orderitemlist"></div>' +
|
||||
'</div><div class="accountRow"></div>';
|
||||
$(".item-row:last").after(html);
|
||||
var element = $(".item-addedrow:last");
|
||||
$("#spn_InvoiceItem_" + this.rowIndex).click(function () {
|
||||
ItemDetails.Instance().loadMrp(element);
|
||||
});
|
||||
ItemDetails.instance.itemsAutoComplete(element);
|
||||
$('.inv_txtaddldiscount').keypress(function (event) {
|
||||
if ((event.which > 47 && event.which < 58) || (event.which == 46 || event.which == 8)) {
|
||||
}
|
||||
else {
|
||||
event.preventDefault();
|
||||
}
|
||||
}).on('paste', function (event) {
|
||||
event.preventDefault();
|
||||
});
|
||||
$('.prodQuantity').keypress(function (event) {
|
||||
if ((event.which > 47 && event.which < 58) || (event.which == 46 || event.which == 8)) {
|
||||
}
|
||||
else {
|
||||
event.preventDefault();
|
||||
}
|
||||
}).on('paste', function (event) {
|
||||
event.preventDefault();
|
||||
});
|
||||
$('.prodPrice').keypress(function (event) {
|
||||
if ((event.which > 47 && event.which < 58) || (event.which == 46 || event.which == 8)) {
|
||||
}
|
||||
else {
|
||||
event.preventDefault();
|
||||
}
|
||||
}).on('paste', function (event) {
|
||||
event.preventDefault();
|
||||
});
|
||||
ItemDetails.Instance().RemoveItem(element);
|
||||
element.find(".btnInvoice_DiscType option[value='" + activeDiscText + "']").prop("selected", true);
|
||||
element.find(".prodPrice,.prodQuantity,.inv_txtaddldiscount").focusin(function () {
|
||||
if (element.find($(".prodName")).val() != null || element.find($(".ItemName")).val() != null) {
|
||||
$(".div_MoreDetails").addClass("hidden");
|
||||
element.find(".div_MoreDetails").removeClass("hidden");
|
||||
}
|
||||
});
|
||||
element.find(".prodName").focusin(function () {
|
||||
$(".divMoreDetails").addClass("hidden");
|
||||
});
|
||||
if (row.description != null && row.description != '' && row.description != 'null')
|
||||
element.find('#txt_Description').val(row.description);
|
||||
element.find("#inv_txtdiscount").change(function () {
|
||||
if (!element.hasClass('SplitItem')) {
|
||||
if (element.find(".btnInvoice_DiscType").val() == "%") {
|
||||
if (Number(element.find("#inv_txtdiscount").val()) > 100) {
|
||||
element.find("#inv_txtdiscount").val("100");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
if (!element.hasClass('SplitItem')) {
|
||||
}
|
||||
if (row.TotalRowAmount != 0) {
|
||||
if ($("#hfInv_Invoicetype").val() == "Purchase" || $("#hfInv_Invoicetype").val() == "PurchaseReturn" || $("#hfInv_Invoicetype").val() == "DebitNote") {
|
||||
element.find(".hfRowTotalwithAdjustment").val();
|
||||
}
|
||||
else {
|
||||
element.find('.prodTotalPrice').text('');
|
||||
}
|
||||
}
|
||||
if (row.TotalDiscount != 0 && row.TotalDiscount != undefined)
|
||||
if (row.invoiceItemId != "0" && ($("#hfInv_Invoicetype").val() == "Purchase" || $("#hfInv_Invoicetype").val() == "SalesReturn" || $("#hfInv_Invoicetype").val() == "DebitNote")) {
|
||||
var x = element.find('.hfRowTotalwithAdjustment');
|
||||
element.find('.AdjustmentRow').click(function () {
|
||||
});
|
||||
}
|
||||
if (row.IsFoc == true) {
|
||||
element.find('.delete').addClass('hidden');
|
||||
element.find('.prodQuantity').prop('readonly', 'readonly');
|
||||
element.find('.prodPrice').prop('readonly', 'readonly');
|
||||
element.find("#inv_txtdiscount").prop('readonly', 'readonly');
|
||||
element.find(".btnInvoice_DiscType").prop('disabled', true);
|
||||
element.find('.prodQuantity').css('cursor', 'not-allowed');
|
||||
element.find('.prodPrice').css('cursor', 'not-allowed');
|
||||
element.find("#inv_txtdiscount").css('cursor', 'not-allowed');
|
||||
}
|
||||
}
|
||||
else {
|
||||
var element = $(".discount-addedrow:last");
|
||||
if (row.inventoryTypeId == 7) {
|
||||
element = $(".netdiscount-addedrow:last");
|
||||
}
|
||||
else {
|
||||
}
|
||||
}
|
||||
}
|
||||
loadMrp(element) {
|
||||
var instance = this;
|
||||
Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("platform/controls/itemdetails/item.mrp.js", function () {
|
||||
instance.navigationHelper.popup(0, "", Unibase.Forms.Controls.MRPDetails.Instance(), null, Unibase.Platform.Helpers.Size.Large);
|
||||
Controls.MRPDetails.element = element;
|
||||
Unibase.Forms.Controls.MRPDetails.Instance().init(element, "", 2);
|
||||
});
|
||||
}
|
||||
loadTaxGroupAutoComplete(element) {
|
||||
var txtTaxGroup = element.find(".prodTax");
|
||||
var hfProdTax = element.find(".hfProdTax");
|
||||
var hfAccount = element.find(".hf_Account");
|
||||
var txtAccount = element.find(".txt_Account");
|
||||
var accid = element.find(".hf_Account").val();
|
||||
var taxgrpid = element.find(".hfProdTax").val();
|
||||
var taxgrptext = element.find(".txtProdTax").val();
|
||||
var acctext = element.find(".txt_AccountName").val();
|
||||
var applytype = "Sales";
|
||||
var url = _appsettings.server_url() + '/apis/v4/unibase/platform/forms/getformsautocomplete';
|
||||
AutoCompleteHelper.getHelper().Create("#txt_prodTax_" + this.rowIndex, hfProdTax, url, function (response) {
|
||||
var data = response;
|
||||
});
|
||||
var url = _appsettings.server_url() + '/apis/v4/unibase/platform/forms/getformsautocomplete';
|
||||
AutoCompleteHelper.getHelper().Create("#txt_Account_" + this.rowIndex, hfAccount, url, function (response) {
|
||||
var data = response;
|
||||
});
|
||||
if (taxgrpid != 0) {
|
||||
$("#hf_TaxGroupId").val(taxgrpid);
|
||||
if ($("#ddl_TaxGroupId option[value='" + taxgrpid + "']").attr("selected", "selected").length == 0) {
|
||||
$("#ddl_TaxGroupId").append(new Option(taxgrptext, taxgrpid, true));
|
||||
}
|
||||
else {
|
||||
$("#ddl_TaxGroupId option[value='" + taxgrpid + "']").attr("selected", "selected");
|
||||
}
|
||||
}
|
||||
if (accid != 0) {
|
||||
$("#hf_AccountId").val(accid);
|
||||
if ($("#ddl_AccountId option[value='" + accid + "']").attr("selected", "selected").length == 0) {
|
||||
$("#ddl_AccountId").append(new Option(acctext, accid, true));
|
||||
}
|
||||
else {
|
||||
$("#ddl_AccountId option[value='" + accid + "']").attr("selected", "selected");
|
||||
}
|
||||
}
|
||||
}
|
||||
update_total() {
|
||||
var totalAmount = 0;
|
||||
var totalDiscountAmount = 0;
|
||||
var totalNonDiscountedAmount = 0;
|
||||
var totalTaxAmount = 0;
|
||||
var totalTaxAdjustment = 0;
|
||||
var totalAsseableAdjustment = 0;
|
||||
var totalQty = 0;
|
||||
var totalDiscountPercent = 0;
|
||||
var totalDiscountValue = 0;
|
||||
var totalAddlDiscountPercent = 0;
|
||||
var totalAddlDiscountValue = 0;
|
||||
var totalExpensePercent = 0;
|
||||
var totalExpenseValue = 0;
|
||||
var addexpenserow_total = 0;
|
||||
$('.expenserow-total').each(function (i) {
|
||||
var expense_row_total = Number($(this).html());
|
||||
addexpenserow_total += expense_row_total;
|
||||
});
|
||||
var ConsumedWalletValue = 0;
|
||||
var totalTaxPercent = 0;
|
||||
var totalTaxValue = 0;
|
||||
var totalCreditNote = 0;
|
||||
var adddiscountrow_total = 0;
|
||||
var netadddiscountrow_total = ConsumedWalletValue;
|
||||
$('.discount-row-total').each(function (i) {
|
||||
var discount_row_total = Number($(this).html());
|
||||
adddiscountrow_total += discount_row_total;
|
||||
});
|
||||
$('.netdiscount-row-total').each(function (i) {
|
||||
var discount_row_total = Number($(this).html());
|
||||
netadddiscountrow_total += discount_row_total;
|
||||
});
|
||||
var itemdiscount_total = 0;
|
||||
var totalLineAmount_total = 0;
|
||||
$('.hfRowTotal').each(function (i) {
|
||||
var element = $(this).parents(".item-row");
|
||||
if (!element.hasClass('SplitItem')) {
|
||||
var totalLineAmount = Number($(this).val());
|
||||
if (!isNaN(totalLineAmount))
|
||||
totalLineAmount_total += Number(totalLineAmount);
|
||||
var discountPercent = 0;
|
||||
var discountValue = 0;
|
||||
var quantity = Number(element.find(".prodQuantity").val());
|
||||
var unitPrice = Number(element.find(".prodPrice").val());
|
||||
var exciseAmount = Number(element.find(".exciseAmount").val());
|
||||
if (isNaN(exciseAmount))
|
||||
exciseAmount = 0;
|
||||
var nonexciseAmount = totalLineAmount - exciseAmount;
|
||||
if (element.find(".btnInvoice_DiscType option:selected").text().trim() == 'Val' && element.find('.inv_txtaddldiscount').val() != '' && element.find('.inv_txtaddldiscount').val() != undefined) {
|
||||
discountValue = Number(element.find('.inv_txtaddldiscount').val());
|
||||
}
|
||||
else if (element.find(".btnInvoice_DiscType option:selected").text().trim() == '%' && element.find('.inv_txtaddldiscount').val() != '' && element.find('.inv_txtaddldiscount').val() != undefined) {
|
||||
discountPercent = Number(element.find('.inv_txtaddldiscount').val());
|
||||
}
|
||||
else if (element.find(".btnInvoice_DiscType option:selected").text().trim() == 'Mul') {
|
||||
if (element.find('#hfProdDiscountList').val() != '' || element.find('#hfProdDiscountApplyTypes').val() != '') {
|
||||
var discountsArray = element.find('#hfProdDiscountList').val().toString().split(',');
|
||||
var applyTypes = element.find('#hfProdDiscountApplyTypes').val().toString().split(',');
|
||||
var price = Number(unitPrice) * Number(quantity);
|
||||
var currentAmount = Number(unitPrice) * Number(quantity);
|
||||
$.each(discountsArray, function (j) {
|
||||
var percent = discountsArray[j];
|
||||
var applyType = applyTypes[j];
|
||||
var discount = 0;
|
||||
if (applyType == 'NET' || applyType == '1') {
|
||||
discount = Number(price) * Number(percent) / 100;
|
||||
currentAmount -= Number(discount);
|
||||
}
|
||||
else {
|
||||
discount = Number(currentAmount) * Number(percent) / 100;
|
||||
currentAmount -= Number(discount);
|
||||
}
|
||||
discountValue += Number(discount);
|
||||
});
|
||||
element.find('.inv_txtaddldiscount').val(discountValue);
|
||||
}
|
||||
else {
|
||||
discountValue = Number(element.find('.inv_txtaddldiscount').val());
|
||||
}
|
||||
}
|
||||
if (!isNaN(discountPercent))
|
||||
totalDiscountPercent += Number(discountPercent);
|
||||
if (!isNaN(discountValue))
|
||||
totalAddlDiscountValue += Number(discountValue);
|
||||
var discountAmount = 0;
|
||||
discountAmount = (Number(nonexciseAmount) * Number(discountPercent) / 100)
|
||||
+ (Number(quantity) * Number(discountValue));
|
||||
itemdiscount_total += discountAmount;
|
||||
var discountedAmount = Number(totalLineAmount) - Number(discountAmount);
|
||||
totalDiscountAmount += Number(discountAmount);
|
||||
element.find(".hfDiscountedAmount").val(discountAmount);
|
||||
if ($("#hfInv_Invoicetype").val() == "Purchase" || $("#hfInv_Invoicetype").val() == "PurchaseReturn" || $("#hfInv_Invoicetype").val() == "DebitNote") {
|
||||
element.find(".txtRowTotalwithAdjustment").val(totalLineAmount - discountAmount);
|
||||
}
|
||||
else
|
||||
element.find(".prodTotalPrice").html((totalLineAmount - discountAmount).toString());
|
||||
}
|
||||
});
|
||||
if (this.SplitedInvoiceItemList.length > 0) {
|
||||
for (var i = 0; i < this.SplitedInvoiceItemList.length; i++) {
|
||||
var totalline_Amount = Number(this.SplitedInvoiceItemList[i].quantity * this.SplitedInvoiceItemList[i].unitPrice);
|
||||
var discountAmount = 0;
|
||||
var nonexciseAmount = totalline_Amount - Number(this.SplitedInvoiceItemList[i].exciseAmount);
|
||||
discountAmount = (Number(nonexciseAmount) * Number(this.SplitedInvoiceItemList[i].addlDiscountPercent) / 100)
|
||||
+ (Number(this.SplitedInvoiceItemList[i].quantity) * Number(this.SplitedInvoiceItemList[i].addlDiscountValue));
|
||||
discountAmount = Number(discountAmount);
|
||||
totalLineAmount_total += Number(this.SplitedInvoiceItemList[i].quantity * this.SplitedInvoiceItemList[i].unitPrice);
|
||||
itemdiscount_total += discountAmount;
|
||||
totalDiscountAmount += discountAmount;
|
||||
}
|
||||
}
|
||||
var overalldiscountpercent = 0;
|
||||
if (adddiscountrow_total != 0) {
|
||||
overalldiscountpercent = (100 * Number(adddiscountrow_total)) / Number(totalLineAmount_total);
|
||||
overalldiscountpercent = Number(overalldiscountpercent);
|
||||
$("#hfOverallDiscountPercent").val(overalldiscountpercent);
|
||||
}
|
||||
var taxAmounts = [];
|
||||
$('.hfRowTotal').each(function (i) {
|
||||
var element = $(this).parents(".item-row");
|
||||
if (!element.hasClass('SplitItem')) {
|
||||
var totalLineAmount = Number($(this).val());
|
||||
var quantity = element.find(".prodQuantity").val();
|
||||
if (!isNaN(totalLineAmount))
|
||||
totalNonDiscountedAmount += Number(totalLineAmount);
|
||||
discountAmount = Number(element.find(".hfDiscountedAmount").val()) + (Number(totalLineAmount) * Number(overalldiscountpercent) / 100);
|
||||
var assesableAmount = totalLineAmount - discountAmount;
|
||||
assesableAmount = Number(assesableAmount);
|
||||
var taxPercents = element.find(".hfProdTaxPercent").val();
|
||||
if (taxPercents != undefined)
|
||||
var taxpercentarray = taxPercents.toString().split(',');
|
||||
var taxValue = 0;
|
||||
var assesableAdjustment = Number(element.find('.hfItemAssesableAdjustmentVal').val());
|
||||
var taxAdjustment = Number(element.find('.hfItemTaxAdjsutmentVal').val());
|
||||
if (!isNaN(taxAdjustment))
|
||||
totalTaxAdjustment += Number(taxAdjustment);
|
||||
if (!isNaN(assesableAdjustment))
|
||||
totalAsseableAdjustment += Number(assesableAdjustment);
|
||||
var cumlTax = 0;
|
||||
var cumtaxtotal = 0;
|
||||
if ($("#hfId_IsTaxInclusive").val() == "true") {
|
||||
for (var i = 0; i < taxpercentarray.length; i++) {
|
||||
var taxPercentModel1 = taxpercentarray[i];
|
||||
var taxPercentM1 = Number(taxPercentModel1.split(":"));
|
||||
if (!isNaN(taxPercentM1[1]))
|
||||
cumlTax += Number(taxPercentM1[1]);
|
||||
}
|
||||
var currentAmt = Number((Number(assesableAmount) * 100) / (100 + Number(cumlTax)));
|
||||
cumtaxtotal = (Number(assesableAmount) - Number(currentAmt));
|
||||
}
|
||||
if (taxpercentarray != undefined) {
|
||||
for (var i = 0; i < taxpercentarray.length; i++) {
|
||||
var taxPercentModel = taxpercentarray[i];
|
||||
var taxPercentM = taxPercentModel.split(":");
|
||||
var ledgerid = taxPercentM[0];
|
||||
var taxPercent = Number(taxPercentM[1]);
|
||||
var taxAmt = 0;
|
||||
if ($("#hfId_IsTaxInclusive").val() == "true") {
|
||||
taxAmt = Number((taxPercent * cumtaxtotal) / cumlTax);
|
||||
}
|
||||
else {
|
||||
var tax = (Number(assesableAmount) * Number(taxPercent) / 100);
|
||||
taxAmt = Number(tax);
|
||||
}
|
||||
var ledgerexists = false;
|
||||
$.map(taxAmounts, function (e, i) {
|
||||
if (e.LedgerId == ledgerid) {
|
||||
ledgerexists = true;
|
||||
taxAmounts[i].TaxAmount += taxAmt;
|
||||
}
|
||||
});
|
||||
if (!ledgerexists) {
|
||||
taxAmounts.push({
|
||||
LedgerId: ledgerid,
|
||||
TaxAmount: taxAmt,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
totalAmount += Number(totalLineAmount);
|
||||
totalQty += Number(quantity);
|
||||
}
|
||||
});
|
||||
if (this.SplitedInvoiceItemList.length > 0) {
|
||||
for (var i = 0; i < this.SplitedInvoiceItemList.length; i++) {
|
||||
var TotalLineAmount = Number(this.SplitedInvoiceItemList[i].quantity * this.SplitedInvoiceItemList[i].unitPrice);
|
||||
var quantiy = Number(this.SplitedInvoiceItemList[i].quantity);
|
||||
if (!isNaN(TotalLineAmount))
|
||||
totalNonDiscountedAmount += Number(TotalLineAmount);
|
||||
var discountAmount = Number(this.SplitedInvoiceItemList[i].addlDiscountValue) + (Number(TotalLineAmount) * Number(this.SplitedInvoiceItemList[i].addlDiscountPercent) / 100);
|
||||
var assesableAmount = TotalLineAmount - discountAmount;
|
||||
assesableAmount = Number(assesableAmount);
|
||||
var taxPercents = '';
|
||||
var instance = this;
|
||||
if (this.SplitedInvoiceItemList[i].TaxPercent == undefined || this.SplitedInvoiceItemList[i].TaxPercent == 0) {
|
||||
var element = "";
|
||||
$(".SplitItem").each(function () {
|
||||
if ($(this).find(".selectedItemId").val() == instance.SplitedInvoiceItemList[i].itemId) {
|
||||
element = $(this);
|
||||
taxPercents = element.find('.hfProdTaxPercent').val();
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
taxPercents = instance.SplitedInvoiceItemList[i].TaxPercent;
|
||||
if (taxPercents != undefined && taxPercents != '')
|
||||
var taxpercentarray = taxPercents.split(',');
|
||||
var assesableAdjustment = instance.SplitedInvoiceItemList[i].assesableAdjustment;
|
||||
var taxAdjustment = instance.SplitedInvoiceItemList[i].taxAdjustment;
|
||||
if (!isNaN(taxAdjustment))
|
||||
totalTaxAdjustment += Number(taxAdjustment);
|
||||
if (!isNaN(assesableAdjustment))
|
||||
totalAsseableAdjustment += Number(assesableAdjustment);
|
||||
var cumlTax = 0;
|
||||
var cumtaxtotal = 0;
|
||||
if ($("#hfId_IsTaxInclusive").val() == "true") {
|
||||
for (var j = 0; j < taxpercentarray.length; j++) {
|
||||
var taxPercentModel1 = taxpercentarray[j];
|
||||
var taxPercentM1 = taxPercentModel1.split(":");
|
||||
if (!isNaN(taxPercentM1[1]))
|
||||
cumlTax += Number(taxPercentM1[1]);
|
||||
}
|
||||
var currentAmt = Number((Number(assesableAmount) * 100) / (100 + Number(cumlTax)));
|
||||
cumtaxtotal = (Number(assesableAmount) - Number(currentAmt));
|
||||
}
|
||||
if (taxpercentarray != undefined) {
|
||||
for (var k = 0; k < taxpercentarray.length; k++) {
|
||||
var taxPercentModel = taxpercentarray[k];
|
||||
var taxPercentM = taxPercentModel.split(":");
|
||||
var ledgerid = taxPercentM[0];
|
||||
var taxPercent = taxPercentM[1];
|
||||
var taxAmt = 0;
|
||||
if ($("#hfId_IsTaxInclusive").val() == "true") {
|
||||
taxAmt = Number((taxPercent * cumtaxtotal) / cumlTax);
|
||||
}
|
||||
else {
|
||||
var tax = (Number(assesableAmount) * Number(taxPercent) / 100);
|
||||
taxAmt = Number(tax);
|
||||
}
|
||||
var ledgerexists = false;
|
||||
$.map(taxAmounts, function (e, m) {
|
||||
if (e.LedgerId == ledgerid) {
|
||||
ledgerexists = true;
|
||||
taxAmounts[m].TaxAmount += taxAmt;
|
||||
}
|
||||
});
|
||||
if (!ledgerexists) {
|
||||
taxAmounts.push({
|
||||
LedgerId: ledgerid,
|
||||
TaxAmount: taxAmt,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
totalAmount += Number(TotalLineAmount);
|
||||
totalQty += Number(quantiy);
|
||||
}
|
||||
}
|
||||
var taxAmount = 0;
|
||||
var taxAdjustment = 0;
|
||||
for (var i = 0; i < taxAmounts.length; i++) {
|
||||
if (!isNaN(taxAmounts[i].TaxAmount)) {
|
||||
taxAmount += Number(taxAmounts[i].TaxAmount);
|
||||
}
|
||||
}
|
||||
if (!isNaN(totalTaxAdjustment))
|
||||
totalTaxAdjustment = totalTaxAdjustment;
|
||||
if (!isNaN(totalAsseableAdjustment)) {
|
||||
totalAsseableAdjustment = totalAsseableAdjustment;
|
||||
}
|
||||
else {
|
||||
totalAsseableAdjustment = 0;
|
||||
}
|
||||
if (!isNaN(totalAsseableAdjustment))
|
||||
totalAmount += Number(totalAsseableAdjustment);
|
||||
totalTaxAmount = Number(taxAmount) + Number(totalTaxAdjustment);
|
||||
totalDiscountAmount += adddiscountrow_total;
|
||||
var totaltax = totalTaxAmount;
|
||||
var grosstotal = totalAmount;
|
||||
var creditnotes = 0;
|
||||
var assessableadjustment = 0;
|
||||
if (!isNaN(Number($("#txt_AssessableAdjustment").val())))
|
||||
assessableadjustment = Number($("#txt_AssessableAdjustment").val());
|
||||
var subtotal = grosstotal - totalDiscountAmount + assessableadjustment;
|
||||
subtotal = subtotal;
|
||||
var overalldiscount = 0;
|
||||
var taxadjustment = 0;
|
||||
if (!isNaN(Number($('#txt_TaxAdjustment').val()))) {
|
||||
taxadjustment = Number($('#txt_TaxAdjustment').val());
|
||||
}
|
||||
totaltax = Number(totaltax) + Number(taxadjustment);
|
||||
$('#totalTax').html(totaltax);
|
||||
$('#grosstotal').html(grosstotal);
|
||||
$('#totalItemDiscount').html(itemdiscount_total);
|
||||
$('#totalDiscount').html(totalDiscountAmount);
|
||||
$("#totalinvoiceqty").html(totalQty);
|
||||
var expense = 0;
|
||||
if (!isNaN(Number($('#txtOverallExpenseAmount').val()))) {
|
||||
expense = Number($('#txtOverallExpenseAmount').val());
|
||||
$("#totalexpense").text(expense);
|
||||
}
|
||||
var adjustment = 0;
|
||||
if (!isNaN(Number($('#txt_Adjustment').val()))) {
|
||||
adjustment = Number($('#txt_Adjustment').val());
|
||||
$("#span_Adjustment").text(adjustment);
|
||||
}
|
||||
var nettotal = Number(subtotal) + Number(addexpenserow_total) - Number(overalldiscount) - Number(netadddiscountrow_total) + Number(adjustment);
|
||||
if ($("#hfId_IsTaxInclusive").val() == "false")
|
||||
nettotal += Number(totaltax);
|
||||
if ($("#hfId_IsTaxInclusive").val() == "true") {
|
||||
subtotal = Number(subtotal) - Number(totalTaxAmount);
|
||||
}
|
||||
$('#subtotal').html(subtotal);
|
||||
$('.nettotal').html(nettotal);
|
||||
ItemDetails.Instance().totalAdjustment();
|
||||
}
|
||||
totalAdjustment() {
|
||||
if ($('#chk_AutoAdjustment').is(':checked')) {
|
||||
var total = $('.nettotal').text();
|
||||
var splitTotal = total.split('.');
|
||||
var AdjustmentValue = 0;
|
||||
var splitedAdjestment = 0;
|
||||
if (!isNaN(Number($('#txt_Adjustment').val()))) {
|
||||
AdjustmentValue = Number($('#txt_Adjustment').val());
|
||||
}
|
||||
if (Number(splitTotal[1]) > 0) {
|
||||
if (Number(splitTotal[1]) >= 50) {
|
||||
splitedAdjestment = (100 - Number(splitTotal[1])) / 100;
|
||||
AdjustmentValue += splitedAdjestment;
|
||||
$('#txt_Adjustment').val(Number(AdjustmentValue).toFixed(2)).blur();
|
||||
}
|
||||
else {
|
||||
splitedAdjestment = Number(splitTotal[1]) / 100;
|
||||
AdjustmentValue -= splitedAdjestment;
|
||||
$('#txt_Adjustment').val(Number(AdjustmentValue).toFixed(2)).blur();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
itemsAutoComplete(element) {
|
||||
Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("tenants/themes/default/components/details/details.js", function () {
|
||||
});
|
||||
var txtAutoSearchCtrl = element.find(".prodName");
|
||||
var hdnOrderItemId = element.find(".orderItemId");
|
||||
var hdnDcItemId = element.find(".dcItemId");
|
||||
var hdnSelectedItemId = element.find(".selectedItemId");
|
||||
if (hdnSelectedItemId.val() != 0 && hdnSelectedItemId.val() != "") {
|
||||
this.itemIds.push(hdnSelectedItemId.val());
|
||||
element.find(".hfoldItemId").val(hdnSelectedItemId.val());
|
||||
}
|
||||
this.itemIds = [];
|
||||
var hdnAutoId = hdnSelectedItemId;
|
||||
var orderid = $("#hf_" + $("#hfLayout_InstalledPageId").val() + "_OrderId").val();
|
||||
var dcid = $("#hf_" + $("#hfLayout_InstalledPageId").val() + "_DcId").val();
|
||||
var invoiceid = $("#hf_" + $("#hfLayout_InstalledPageId").val() + "_InvoiceId").val();
|
||||
if (invoiceid == undefined || invoiceid == "null")
|
||||
invoiceid = 0;
|
||||
var url = "";
|
||||
var OrdersettingId = 0;
|
||||
var url = _appsettings.server_url() + '/apis/v4/unibase/transact/items/getitems/itemids/' + ',' + '/lobid/' + 100284890000001;
|
||||
AutoCompleteHelper.getHelper().Create("#txt_item_" + this.rowIndex, "#hf_txtitem_" + this.rowIndex, url, function (response) {
|
||||
var data = response;
|
||||
ItemDetails.Instance().update_total();
|
||||
});
|
||||
element.find(".div_SplitInvoiceItem").removeClass("hidden");
|
||||
ItemDetails.instance.loadTaxGroupAutoComplete(element);
|
||||
}
|
||||
RemoveItem(element) {
|
||||
var rowIndex = element.find(".rowIndex").val();
|
||||
element.find(".delete").on('click', function () {
|
||||
var _this = element.find(".delete");
|
||||
var invoiceitemid = _this.parents('.item-row').find(".selectedInvoiceItemId").val();
|
||||
_this.parents('.item-row').remove();
|
||||
var count = 1;
|
||||
$(".InvoiceItems").find(".item-addedrow").each(function () {
|
||||
$(this).find(".rowIndex").val(count);
|
||||
$(this).find(".selectedItemId").attr("id", "hf_txtitem_" + count);
|
||||
$(this).find(".prodName").attr("id", "txt_item_" + count);
|
||||
$(this).attr("id", "div_itemAddedRow_" + count);
|
||||
count++;
|
||||
});
|
||||
});
|
||||
}
|
||||
deleteRow(rowid, itemid) {
|
||||
var ids = this.deletedItems.push(itemid);
|
||||
ItemDetails.instance.deleteInvoiceItem(ids);
|
||||
}
|
||||
deleteInvoiceItem(invItemIds) {
|
||||
for (var i = 0; i < invItemIds.length; i++) {
|
||||
}
|
||||
}
|
||||
static Instance() {
|
||||
if (this.instance === undefined) {
|
||||
this.instance = new ItemDetails();
|
||||
}
|
||||
return this.instance;
|
||||
}
|
||||
}
|
||||
Controls.ItemDetails = ItemDetails;
|
||||
})(Controls = Forms.Controls || (Forms.Controls = {}));
|
||||
})(Forms = Unibase.Forms || (Unibase.Forms = {}));
|
||||
})(Unibase || (Unibase = {}));
|
||||
File diff suppressed because one or more lines are too long
+1
File diff suppressed because one or more lines are too long
@@ -0,0 +1,663 @@
|
||||
var Unibase;
|
||||
(function (Unibase) {
|
||||
let Forms;
|
||||
(function (Forms) {
|
||||
let Controls;
|
||||
(function (Controls) {
|
||||
class MRPDetails extends Unibase.Platform.Core.BaseComponent {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.Type = "";
|
||||
this.PendingQty = 0;
|
||||
this.SplitedInvoiceItemList = new Array();
|
||||
this.rowIndex = 0;
|
||||
this.container = "";
|
||||
this.DcItemIds = new Array();
|
||||
}
|
||||
jsFiles() {
|
||||
return ["platform/controls/itemdetails/item.mrp.js"];
|
||||
}
|
||||
cssFiles() {
|
||||
return [];
|
||||
}
|
||||
load(containerid) {
|
||||
var instance = this;
|
||||
$("#btn_InvoiceItem_Close").click(function () {
|
||||
instance.navigationHelper.closePopUp();
|
||||
});
|
||||
}
|
||||
loadForm(FormId, Pk_Value, AppConfigurationId, Callback, ElementId) {
|
||||
}
|
||||
html() {
|
||||
var html = '<div class="frm_Bizgazetransact_Invoice_createInvoiceItem card"><div class="card-header"><div class="row col-sm-12 ml-5"><strong class="titlename InvoiceItemName col-8"></strong><div class="col-4 pull-right"><span class="pull-right mr-10">Amount: <strong class="hf_nettotal">0.00</strong></span></div></div></div><div style="overflow-x:hidden;" class="d modal-body bg-light"><div class="bg-white mb-10"><span class="ml-10"> Pending: <span class="hf_pendingQty ml-5" > 0 </span><span>/Total Avail: </span><span class="hf_AvailQty ml-5">0</span > </span></div > <div class="card" > <div class="card-body"><div class="col-sm-12 d-none d-md-block"><div class="row " style="overflow-x:hidden;"><input type="hidden" id="hf_ItemId" ><div class="col-sm-4 min-padding"><strong class="EnabledType ml-20">MRP</strong> </div><div class="col-sm-2 text-center min-padding"><strong class="ml-15">Qty</strong></div><div class="col-sm-2 text-center min-padding"><strong>Unit Price</strong></div><div class="col-sm-2 text-center min-padding"><strong>Disc.</strong></div><div class="col-sm-2 text-right min-padding"><strong class="mr-15">Total</strong></div></div></div><div><div class="Mrp-row added-row hidden"></div><div class="Batch-row added-row hidden"></div><div class="Serial-row added-row hidden"></div></div><div class="row"><a href="javascript:;" class="default pull-left" title="Add" data-original-title="Add"><span class="pull-right btn" id="btnInvoice_Batch">Add</span></a></div></div></div></div><footer class="bg-white modal-footer"><a id="btn_InvoiceItem_Close" class="btn btn-light btn-sm mr-auto"> Close</a><a href="javascript:;" id="btn_InvoiceItem_Save_mobile" class="btn btn-primary btn-sm">Save</a></footer>';
|
||||
return html;
|
||||
}
|
||||
init(element, ItemName, type) {
|
||||
$(".InvoiceItemName").text(ItemName);
|
||||
$(".EnabledType").text(type);
|
||||
this.Type = type;
|
||||
this.SplitedInvoiceItemList.push({
|
||||
orderItemId: 0,
|
||||
invoiceItemId: 0,
|
||||
itemName: "test",
|
||||
itemId: 0,
|
||||
itemSKU: 0,
|
||||
unitName: 0,
|
||||
packSize: 0,
|
||||
packCount: 0,
|
||||
packs: 0,
|
||||
quantity: 0,
|
||||
availPacks: 0,
|
||||
availQty: 0,
|
||||
listPrice: 0,
|
||||
description: "",
|
||||
taxGroupName: "",
|
||||
taxGroupId: 0,
|
||||
isTaxInclusive: $("#hfId_IsTaxInclusive").val(),
|
||||
addlDiscountPercent: 0,
|
||||
addlDiscountValue: 0,
|
||||
creditNote: 0,
|
||||
priceListId: 0,
|
||||
batchId: 0,
|
||||
unitPrice: 0,
|
||||
invoiceallocations: null,
|
||||
exciseInvoiceItem: null,
|
||||
accountId: 0,
|
||||
accountName: "",
|
||||
walletId: 0,
|
||||
Adjustment: 0,
|
||||
IsFoc: 0,
|
||||
TariffNo: "",
|
||||
exciseAmount: 0,
|
||||
discountName: "",
|
||||
discountId: 0,
|
||||
refNo: "",
|
||||
DiscountGroupId: 0,
|
||||
DiscountGroupName: "",
|
||||
ExchangeItem: 0,
|
||||
maxQty: 0,
|
||||
RefInvoiceItemId: 0,
|
||||
MrpId: 0,
|
||||
taxAdjustment: 0,
|
||||
assesableAdjustment: 0,
|
||||
inventoryTypeId: 0,
|
||||
IsBoMItem: 0,
|
||||
dcItemId: 0,
|
||||
TotalRowAmount: 0,
|
||||
TotalDiscount: 0,
|
||||
BatchId: 0,
|
||||
});
|
||||
var ItemExist = false;
|
||||
for (var i = 0; i < this.SplitedInvoiceItemList.length; i++) {
|
||||
if (this.SplitedInvoiceItemList[i].itemId == $("#hf_ItemId").val()) {
|
||||
ItemExist = true;
|
||||
MRPDetails.Instance().addMrpRowWithData(this.SplitedInvoiceItemList[i]);
|
||||
}
|
||||
}
|
||||
$("#hf_ItemId").val(element.find(".selectedItemId").val());
|
||||
$(".hf_AvailQty").text(element.find(".prodAvail").text());
|
||||
if ($("#hf_" + $("#hfLayout_InstalledPageId").val() + "_OrderId").val() != "0" && $("#hf_" + $("#hfLayout_InstalledPageId").val() + "_OrderId").val() != undefined) {
|
||||
$(".hf_pendingQty").text(element.find(".maxQty").val());
|
||||
this.PendingQty = element.find(".maxQty").val();
|
||||
}
|
||||
$("#btnInvoice_Batch").click(function () {
|
||||
MRPDetails.Instance().addMrpRow(element);
|
||||
});
|
||||
$("#btn_InvoiceItem_Save").click(function () {
|
||||
});
|
||||
$(document).click(function (e) {
|
||||
var container = $(".div_Item_MoreDetails");
|
||||
});
|
||||
if (ItemExist == false)
|
||||
var orderid = $("#hf_" + $("#hfLayout_InstalledPageId").val() + "_OrderId").val();
|
||||
var dcid = $("#hf_" + $("#hfLayout_InstalledPageId").val() + "_DcId").val();
|
||||
var InvoiceId = $("#hf_" + $("#hfLayout_InstalledPageId").val() + "_InvoiceId").val();
|
||||
var OrdersettingId = 2;
|
||||
if (OrdersettingId == 1 || ((orderid == "0" || orderid == undefined) && (dcid != "0" && dcid != undefined) && (InvoiceId == "0" || InvoiceId == "null")))
|
||||
$("#btnInvoice_Batch").addClass('hidden');
|
||||
}
|
||||
addMrpRow(element) {
|
||||
var array = {
|
||||
orderItemId: element.find('.orderItemId').val(),
|
||||
invoiceItemId: 0,
|
||||
itemId: element.find('.selectedItemId').val(),
|
||||
packSize: 0,
|
||||
packCount: 0,
|
||||
packs: 0,
|
||||
quantity: 0,
|
||||
availPacks: 0,
|
||||
availQty: 0,
|
||||
Description: "",
|
||||
isTaxInclusive: $("#hfIsTaxInclusive").val(),
|
||||
addlDiscountPercent: 0,
|
||||
addlDiscountValue: 0,
|
||||
creditNote: 0,
|
||||
priceListId: element.find('.hf_PriceList').val(),
|
||||
invoiceallocations: null,
|
||||
exciseInvoiceItem: null,
|
||||
walletId: 0,
|
||||
Adjustment: 0,
|
||||
IsFoc: 0,
|
||||
TariffNo: "",
|
||||
exciseAmount: 0,
|
||||
discountName: "",
|
||||
discountId: 0,
|
||||
description: "",
|
||||
RefNo: "",
|
||||
DiscountGroupId: 0,
|
||||
DiscountGroupName: '',
|
||||
RefInvoiceItemId: 0,
|
||||
taxAdjustment: element.find('.hfItemTaxAdjsutmentVal').val(),
|
||||
assesableAdjustment: element.find('.hfItemAssesableAdjustmentVal').val(),
|
||||
inventoryTypeId: 0,
|
||||
dcItemId: 0,
|
||||
ExchangeItem: element.find('.IsExchangeItem').val(),
|
||||
unitPrice: element.find('.prodPrice').val(),
|
||||
taxGroupId: $("#hf_TaxGroupId").val(),
|
||||
BatchId: 0,
|
||||
MrpId: 0,
|
||||
SerialId: 0,
|
||||
Name: '',
|
||||
maxQty: 0
|
||||
};
|
||||
MRPDetails.Instance().addMrpRowWithData(array);
|
||||
}
|
||||
addMrpRowWithData(row) {
|
||||
this.rowIndex = $(".SplInvoiceItemRow").length + 1;
|
||||
var activeDiscVal = "";
|
||||
var activeDiscPercent = "";
|
||||
var activeDiscMul = "";
|
||||
var activeDiscText = "";
|
||||
var discValue = 0;
|
||||
if (row.addlDiscountPercent > 0) {
|
||||
discValue = row.addlDiscountPercent;
|
||||
activeDiscPercent = "active";
|
||||
activeDiscText = "%";
|
||||
}
|
||||
else if (row.addlDiscountValue > 0 && row.DiscountGroupId > 0) {
|
||||
discValue = row.addlDiscountValue;
|
||||
activeDiscMul = "active";
|
||||
activeDiscText = "Mul";
|
||||
}
|
||||
else {
|
||||
discValue = row.addlDiscountValue;
|
||||
activeDiscVal = "active";
|
||||
activeDiscText = "Val";
|
||||
}
|
||||
var Class = "";
|
||||
if (Type == "MRP") {
|
||||
Class = "Mrp-row Mrp-addedrow";
|
||||
}
|
||||
else if (Type == "BatchNo") {
|
||||
Class = "Batch-row Batch-addedrow";
|
||||
}
|
||||
else if (Type == "SerialNo") {
|
||||
Class = "Serial-row Serial-addedrow";
|
||||
}
|
||||
var readonlyPrice = "";
|
||||
var readonlyDisc = "";
|
||||
var readonlyTax = "";
|
||||
var readonlyQty = "";
|
||||
var ManageInvoice = 1;
|
||||
var ManageInvoiceTax = 1;
|
||||
if (ManageInvoice == 1 && AutoDc == false) {
|
||||
readonlyQty = "readonly";
|
||||
readonlyPrice = "readonly";
|
||||
readonlyDisc = "readonly";
|
||||
readonlyTax = "readonly";
|
||||
}
|
||||
if ($('#hfInv_Invoicetype').val() == "Sales" && ManageInvoiceTax == 1 && AutoDc == false) {
|
||||
readonlyTax = "readonly";
|
||||
}
|
||||
var html = '<div class="row ' + Class + ' form-group mt-20 SplInvoiceItemRow">' +
|
||||
'<div class="row col-sm-12 ml-5">' +
|
||||
'<input type="hidden" class="txt_rowIndex" value="' + this.rowIndex + '"/>' +
|
||||
'<input type="hidden" class="hf_orderItemId" value="' + row.orderItemId + '"/>' +
|
||||
'<input type="hidden" class="hf_dcItemId" value="' + row.dcItemId + '"/>' +
|
||||
'<input type="hidden" class="hf_selectedInvoiceItemId" value="' + row.invoiceItemId + '"/>' +
|
||||
'<input type="hidden" class="hf_refInvoiceItemId" value="' + row.RefInvoiceItemId + '"/>' +
|
||||
'<input type="hidden" class="hf_selectedItemId" value="' + row.itemId + '"/>' +
|
||||
'<input type="hidden" class="hf_offerapplied" value="0"/>' +
|
||||
'<input type="hidden" class="hf_refNo" value="' + row.RefNo + '"/>' +
|
||||
'<input type="hidden" class="hf_description" value="' + row.description + '"/>' +
|
||||
'<input type="hidden" class="hf_IsExchangeItem" value="' + row.ExchangeItem + '"/>' +
|
||||
'<input type="hidden" class="hf_ItemTaxAdjsutmentVal" value="' + row.taxAdjustment + '"/>' +
|
||||
'<input type="hidden" class="hf_ItemAssesableAdjustmentVal" value="' + row.assesableAdjustment + '"/>' +
|
||||
'<input type="hidden" class="hf_maxQty" value="' + row.maxQty + '" />' +
|
||||
'<input type="hidden" class="exciseAmount" value="0"/>' +
|
||||
'<input type="hidden" class="hf_UnitPrice" value="' + row.unitPrice + '"/>' +
|
||||
'<input type="hidden" class="hf_' + Type + '_Name" value=""/>' +
|
||||
'<div class="col-sm-4">' +
|
||||
'<div class=" min-padding">' +
|
||||
'<a class="no-border bg-white delete-row" href = "javascript:;" title = "Remove row" style = ""> <i class="fa fa-trash-o fa-lg mt-15 mr-2" style="margin-left:-25px;color:red"></i></a>' +
|
||||
'<select type="text" class=" required form-control ui-autocomplete select_' + Type + '" id="select_itemMrp_' + this.rowIndex + '" data-required="true" value="" placeholder=" Select ' + Type + '" style="width:100%;" ></select>' +
|
||||
'<input type="hidden" id="hf_itemMrp_' + this.rowIndex + '" class="hf_' + Type + '_Id"/>' +
|
||||
'</div></div>' +
|
||||
'<div class="col-sm-2">' +
|
||||
'<div class="floating-label-form-group min-padding">' +
|
||||
'<input type="text" class="Quantity text-center form-control" placeholder="0.00" value="' + row.quantity + '" ' + readonlyQty + '>' +
|
||||
'</div></div>' +
|
||||
'<div class="col-sm-2">' +
|
||||
'<div class="floating-label-form-group min-padding">' +
|
||||
'<input type="text" class="Price text-center form-control" placeholder="0.00" value="' + row.unitPrice + '" ' + readonlyPrice + '/>' +
|
||||
'</div></div>' +
|
||||
'<div class="col-sm-2">' +
|
||||
'<div class="floating-label-form-group">' +
|
||||
'<input type="hidden" id="hf_ItemDiscountGroupId" value="' + row.DiscountGroupId + '" />' +
|
||||
'<input type="hidden" id="hf_ItemDiscountGroupName" value="' + row.DiscountGroupName + '" />' +
|
||||
'<input type="hidden" id="hf_ItemDiscountList" value=""/>' +
|
||||
'<input type="hidden" id="hf_ItemDiscountApplyTypes" value=""/>' +
|
||||
'<div class="input-group">' +
|
||||
'<input type="text" id="txt_discount" placeholder="0.00" class="form-control txt_addldiscount text-center d-none d-md-block" value="' + discValue + '" readonlyDisc>' +
|
||||
'<input type="text" id="txt_discount" placeholder="0.00" class="form-control txt_addldiscount text-center ml-40 d-md-none" value="' + discValue + '" readonlyDisc>' +
|
||||
'<div class="input-group-btn">' +
|
||||
'<div class="input-group-btn">' +
|
||||
'<select class="btn_item_DiscType mt-10 border-blue"><option value="Val">Val</option><option value="%">%</option></select>' +
|
||||
'</div>' +
|
||||
'</div></div></div></div>' +
|
||||
'<div class="col-sm-2">' +
|
||||
'<input type="hidden" class="hf_DiscountedAmount" value="0" />' +
|
||||
'<input type="hidden" class="hf_RowTotalAdjustment" value="' + row.Adjustment + '" />' +
|
||||
'<input type="hidden" class="hf_AssesableAdjustment" value="" />' +
|
||||
'<input type="hidden" class="hf_TaxAdjustment" value="" />';
|
||||
if ($("#hfInv_Invoicetype").val() == "Purchase" || $("#hfInv_Invoicetype").val() == "PurchaseReturn" || $("#hfInv_Invoicetype").val() == "DebitNote") {
|
||||
html += '<a href="javascript:;" class="AjustmentRow"><input type="text" style="color:#5ba8fb;text-decoration:underline;cursor:pointer" class="hf_RowTotalwithAdjustment form-control txt_RowTotalwithAdjustment text-right" value="0" /></a>';
|
||||
html += '<a href="javascript:;" class="hidden" onclick="javascript:_bizgazetransact_invoice_edit.editInvItemTaxAllocs(' + row.invoiceItemId + ',' + row.TaxGroupId + ',' + row.itemId + ',' + row.orderItemId + ')"><input type="text" style="color:#5ba8fb;text-decoration:underline;cursor:pointer" class="hf_RowTotal form-control txt_RowTotal text-right" value="0" /></a>';
|
||||
}
|
||||
else {
|
||||
html += '<p class="pull-right mt-10 mr-10"><strong><input type="hidden" class="hf_RowTotal" value="0" /><span class="TotalPrice">0.00</span></strong></p>';
|
||||
}
|
||||
html += '</div></div >';
|
||||
html += '<div class="row col-sm-12 div_Item_MoreDetails clear hidden">' +
|
||||
'<div class="row col-sm-12 bg-light ml-10 mt-5">' +
|
||||
'<div class="col-sm-6">' +
|
||||
'<div class="floating-label-form-group form-group floating-label focus">' +
|
||||
'<label for="lbl_Description" id="lbl_Description">Description</label>' +
|
||||
'<input type="text" id="txt_Item_Description" data-isdynamic="false" class="form-control floating-label-control " data-placeholder="Enter Description" placeholder="Description" data-label="Description"/>' +
|
||||
'</div></div>';
|
||||
if (Type != "MRP") {
|
||||
html += '<div class="col-sm-2 mt-30">' +
|
||||
'<label for="lbl_Mrp" id="lbl_Mrp"><b>Mrp:  <span></span></b></label>' +
|
||||
'<span class="spn_Mrp">0</span>' +
|
||||
'<input type="hidden" class="hf_MrpId"/>' +
|
||||
'</div>';
|
||||
}
|
||||
html += '<div class="col-sm-3 mt-30">' +
|
||||
'<label for="lbl_Avalilability" id="lbl_Avalilability"><b>Availability:  <span></span></b></label>' +
|
||||
'<span class="spn_Avail">0</span>' +
|
||||
'<input type="hidden" class="hf_PriceList" value="' + row.priceListId + '"/>' +
|
||||
'</div>' +
|
||||
'</div></div></div>';
|
||||
var element = "";
|
||||
var Type = "MRP";
|
||||
if (Type == "MRP") {
|
||||
$(".Mrp-row:last").after(html);
|
||||
element = $(".Mrp-addedrow:last");
|
||||
}
|
||||
else if (Type == "BatchNo") {
|
||||
$(".Batch-row:last").after(html);
|
||||
element = $(".Batch-addedrow:last");
|
||||
}
|
||||
else if (Type == "SerialNo") {
|
||||
$(".Serial-row:last").after(html);
|
||||
element = $(".Serial-addedrow:last");
|
||||
}
|
||||
element.find(".btn_item_DiscType option[value='" + activeDiscText + "']").prop("selected", true);
|
||||
if (row.description != null && row.description != '' && row.description != 'null')
|
||||
element.find('#txt_Item_Description').val(row.description);
|
||||
if ((row.orderItemId != 0 && row.dcItemId != 0 && OrdersettingId == 1) || (row.orderItemId == 0 && row.dcItemId != 0 && AutoDc == false)) {
|
||||
element.find('.select_' + Type + '').prop('disabled', true);
|
||||
}
|
||||
$('.txt_addldiscount').keypress(function (event) {
|
||||
if ((event.which > 47 && event.which < 58) || (event.which == 46 || event.which == 8)) {
|
||||
}
|
||||
else {
|
||||
event.preventDefault();
|
||||
}
|
||||
}).on('paste', function (event) {
|
||||
event.preventDefault();
|
||||
});
|
||||
$('.Quantity').keypress(function (event) {
|
||||
if ((event.which > 47 && event.which < 58) || (event.which == 46 || event.which == 8)) {
|
||||
}
|
||||
else {
|
||||
event.preventDefault();
|
||||
}
|
||||
}).on('paste', function (event) {
|
||||
event.preventDefault();
|
||||
});
|
||||
$('.Price').keypress(function (event) {
|
||||
if ((event.which > 47 && event.which < 58) || (event.which == 46 || event.which == 8)) {
|
||||
}
|
||||
else {
|
||||
event.preventDefault();
|
||||
}
|
||||
}).on('paste', function (event) {
|
||||
event.preventDefault();
|
||||
});
|
||||
this.Load(element);
|
||||
var OrdersettingId = 2;
|
||||
var AutoDc = false;
|
||||
if (row.dcItemId != 0 && OrdersettingId != 2 && AutoDc == false)
|
||||
element.find(".Quantity").prop('disabled', true);
|
||||
if (row.invoiceItemId != 0 || row.dcItemId != 0 || row.orderItemId != 0) {
|
||||
if (Type == "MRP") {
|
||||
row.Name = element.find('.hf_' + Type + '_Name').val();
|
||||
}
|
||||
else if (Type == "BatchNo") {
|
||||
row.Name = element.find('.hf_' + Type + '_Name').val();
|
||||
}
|
||||
else if (Type == "SerialNo") {
|
||||
row.Name = element.find('.hf_' + Type + '_Name').val();
|
||||
}
|
||||
}
|
||||
if (row.Name != '') {
|
||||
if (Type == "MRP") {
|
||||
if (row.MrpId != 0) {
|
||||
element.find(".select_" + Type + "").empty();
|
||||
element.find(".select_" + Type + "").append(new Option(row.Name, row.MrpId, true));
|
||||
element.find('.hf_' + Type + '_Id').val(row.MrpId);
|
||||
}
|
||||
}
|
||||
else if (Type == "BatchNo") {
|
||||
if (row.BatchId != 0) {
|
||||
element.find(".select_" + Type + "").empty();
|
||||
element.find(".select_" + Type + "").append(new Option(row.Name, row.BatchId, true));
|
||||
element.find('.hf_' + Type + '_Id').val(row.BatchId);
|
||||
}
|
||||
}
|
||||
else if (Type == "SerialNo") {
|
||||
if (row.SerialId != 0) {
|
||||
element.find(".select_" + Type + "").empty();
|
||||
element.find(".select_" + Type + "").append(new Option(row.Name, row.SerialId, true));
|
||||
element.find('.hf_' + Type + '_Id').val(row.SerialId);
|
||||
}
|
||||
}
|
||||
}
|
||||
element.find(".Price,.Quantity,.txt_addldiscount ").focusin(function () {
|
||||
$(".div_Item_MoreDetails").addClass("hidden");
|
||||
element.find(".div_Item_MoreDetails").removeClass("hidden");
|
||||
});
|
||||
element.find(".prodName").focusin(function () {
|
||||
$(".div_Item_MoreDetails").addClass("hidden");
|
||||
});
|
||||
element.find(".txt_addldiscount").change(function () {
|
||||
if (element.find(".btn_item_DiscType").val() == "%") {
|
||||
if (Number(element.find(".txt_addldiscount").val()) > 100)
|
||||
element.find(".txt_addldiscount").val("100");
|
||||
}
|
||||
});
|
||||
element.find('.AjustmentRow').click(function () {
|
||||
});
|
||||
var url = _appsettings.server_url() + '/apis/v4/unibase/transact/items/getitems/itemids/' + ',' + '/lobid/' + 100284890000001;
|
||||
AutoCompleteHelper.getHelper().Create("#select_itemMrp_" + this.rowIndex, "#hf_itemMrp_" + this.rowIndex, url, function (response) {
|
||||
var data = response;
|
||||
});
|
||||
MRPDetails.Instance().RemoveRow(element);
|
||||
element.find('.btn_item_DiscType').change(function () {
|
||||
if (element.find(".btn_item_DiscType").val() == "%") {
|
||||
if (Number(element.find(".txt_addldiscount").val()) > 100)
|
||||
element.find(".txt_addldiscount").val("100");
|
||||
}
|
||||
if (element.find(".btn_item_DiscType option:selected").text().trim() == 'Val') {
|
||||
element.find('#hf_ItemDiscountGroupId').val(0);
|
||||
element.find('#hf_ItemDiscountGroupName').val('');
|
||||
element.find('.txt_addldiscount').prop('disabled', false);
|
||||
}
|
||||
else if (element.find(".btn_item_DiscType option:selected").text().trim() == '%') {
|
||||
element.find('#hf_ItemDiscountGroupId').val(0);
|
||||
element.find('#hf_ItemDiscountGroupName').val('');
|
||||
element.find('.txt_addldiscount').prop('disabled', false);
|
||||
}
|
||||
});
|
||||
}
|
||||
RemoveRow(element) {
|
||||
element.find(".delete-row").on('click', function () {
|
||||
var _this = $(this);
|
||||
_this.parents('.SplInvoiceItemRow');
|
||||
var invoiceitemid = _this.parents('.SplInvoiceItemRow').find(".hf_selectedInvoiceItemId").val();
|
||||
if (invoiceitemid != 0) {
|
||||
if (confirm("You are about to Delete the invoice item. Are you sure?")) {
|
||||
var x = [];
|
||||
for (var i = 0; i < this.SplitedInvoiceItemList.length; i++) {
|
||||
if (this.SplitedInvoiceItemList[i].invoiceItemId == _this.parents('.SplInvoiceItemRow').find('.hf_selectedInvoiceItemId').val()) {
|
||||
x.push(i);
|
||||
}
|
||||
}
|
||||
for (var i = x.length - 1; i >= 0; i--) {
|
||||
this.SplitedInvoiceItemList.splice(x[i], 1);
|
||||
}
|
||||
_this.parents('.SplInvoiceItemRow').remove();
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (confirm("You are about to Delete the invoice item. Are you sure?")) {
|
||||
_this.parents('.SplInvoiceItemRow').remove();
|
||||
}
|
||||
}
|
||||
});
|
||||
element.find('.btn_item_DiscType').change(function () {
|
||||
if (element.find(".btn_item_DiscType").val() == "%") {
|
||||
if (Number(element.find(".txt_addldiscount").val()) > 100)
|
||||
element.find(".txt_addldiscount").val("100");
|
||||
}
|
||||
if (element.find(".btn_item_DiscType option:selected").text().trim() == 'Val') {
|
||||
element.find('#hf_ItemDiscountGroupId').val(0);
|
||||
element.find('#hf_ItemDiscountGroupName').val('');
|
||||
element.find('.txt_addldiscount').prop('disabled', false);
|
||||
}
|
||||
else if (element.find(".btn_item_DiscType option:selected").text().trim() == '%') {
|
||||
element.find('#hf_ItemDiscountGroupId').val(0);
|
||||
element.find('#hf_ItemDiscountGroupName').val('');
|
||||
element.find('.txt_addldiscount').prop('disabled', false);
|
||||
}
|
||||
});
|
||||
}
|
||||
Load(element) {
|
||||
var Type = "";
|
||||
var Ids = [];
|
||||
var AutoText = element.find(".select_" + Type + "");
|
||||
var hdnAutoId = element.find(".hf_" + Type + "_Id");
|
||||
Ids = [0];
|
||||
$(".hf_" + Type + "_Id").each(function () {
|
||||
Ids.push($(this).val());
|
||||
});
|
||||
var InvoiceType = 'Purchase';
|
||||
var BranchId = $("#ddl_ShipToAddressId").val();
|
||||
if ($('#hfInv_Invoicetype').val() == 'Sales' || $('#hfInv_Invoicetype').val() == 'PurchaseReturn' || $('#hfInv_Invoicetype').val() == 'CreditNote') {
|
||||
InvoiceType = 'Sales';
|
||||
BranchId = $("#ddl_ShipFromAddressId").val();
|
||||
}
|
||||
var url;
|
||||
if (Type == "MRP") {
|
||||
if ($("#hf_FormAppTitle").val() == "Sales Return" || $("#hf_FormAppTitle").val() == "Purchase Return") {
|
||||
}
|
||||
else { }
|
||||
}
|
||||
else if (Type == "BatchNo") {
|
||||
}
|
||||
else if (Type == "SerialNo") {
|
||||
}
|
||||
var AutoText = element.find(".select_" + Type + "");
|
||||
var hdnAutoId = element.find(".hf_" + Type + "_Id");
|
||||
}
|
||||
SaveItem(elements) {
|
||||
var qty = false;
|
||||
var avlqty = false;
|
||||
var UnitPrice = false;
|
||||
var CreateBatch_Validation = 'frm_Bizgazetransact_Invoice_createInvoiceItem';
|
||||
if (!CreateBatch_Validation) {
|
||||
MessageHelper.Instance().showError(" Mandatory fields are missing ", "bizgaze_CreateBatchErrorMessages");
|
||||
return false;
|
||||
}
|
||||
$(".SplInvoiceItemRow").each(function () {
|
||||
if ($(this).find(".Quantity").val() == 0) {
|
||||
qty = true;
|
||||
}
|
||||
});
|
||||
$(".SplInvoiceItemRow").each(function () {
|
||||
if ($(this).find(".Price ").val() == 0) {
|
||||
UnitPrice = true;
|
||||
}
|
||||
});
|
||||
var OrdersettingId = 1;
|
||||
var AutoDc = false;
|
||||
var qty = true;
|
||||
var UnitPrice = true;
|
||||
var avlqty = true;
|
||||
if ($('#hfInv_Invoicetype').val() == 'Sales' || $('#hfInv_Invoicetype').val() == 'PurchaseReturn') {
|
||||
$(".SplInvoiceItemRow").each(function () {
|
||||
if (OrdersettingId == 1 || AutoDc == true) {
|
||||
if (Number($(this).find(".Quantity").val()) > Number($(this).find('.spn_Avail').text())) {
|
||||
avlqty = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
if (qty == true) {
|
||||
MessageHelper.Instance().showError("Item quantity should not be zero.", "bizgaze_CreateBatchErrorMessages");
|
||||
return false;
|
||||
}
|
||||
if (UnitPrice == true) {
|
||||
MessageHelper.Instance().showError("Unit Price should not be zero.", "bizgaze_CreateBatchErrorMessages");
|
||||
return false;
|
||||
}
|
||||
if (avlqty == true) {
|
||||
MessageHelper.Instance().showError("Available Quantity is less for an item", 'bizgaze_CreateBatchErrorMessages');
|
||||
return false;
|
||||
}
|
||||
var x = [];
|
||||
for (var i = 0; i < this.SplitedInvoiceItemList.length; i++) {
|
||||
if (this.SplitedInvoiceItemList[i].itemId == $("#hf_ItemId").val()) {
|
||||
x.push(i);
|
||||
var index = this.DcItemIds.indexOf(this.SplitedInvoiceItemList[i].dcItemId);
|
||||
if (index > -1)
|
||||
this.DcItemIds.splice(index, 1);
|
||||
}
|
||||
}
|
||||
for (var i = x.length - 1; i >= 0; i--) {
|
||||
this.SplitedInvoiceItemList.splice(x[i], 1);
|
||||
}
|
||||
var TotalQuantity = 0;
|
||||
var TotalAmount = 0;
|
||||
var TotalDisc = 0;
|
||||
var RowExist = false;
|
||||
var TaxGroupId = elements.find('.hfProdTax').val();
|
||||
var Taxgroupname = elements.find('.txtProdTax').val();
|
||||
var AccountId = elements.find('.hf_Account').val();
|
||||
var AccountName = elements.find('.txt_AccountName').val();
|
||||
var instance = this;
|
||||
$(".SplInvoiceItemRow").each(function () {
|
||||
var element = $(this);
|
||||
var BatchId = 0;
|
||||
var SerialNoId = 0;
|
||||
var MrpId = 0;
|
||||
var Name = '';
|
||||
var Type = "MRP";
|
||||
if (Type == "MRP") {
|
||||
MrpId = Number(element.find('.hf_MRP_Id').val());
|
||||
Name = element.find('.select_' + Type + ' option[value=' + MrpId + ']').text();
|
||||
}
|
||||
else if (Type == "BatchNo") {
|
||||
BatchId = Number(element.find('.select_' + Type + '').val());
|
||||
MrpId = Number(element.find(".hf_MrpId").val());
|
||||
Name = element.find('.select_' + Type + ' option[value =' + BatchId + ']').text();
|
||||
}
|
||||
else if (Type == "SerialNo") {
|
||||
SerialNoId = Number(element.find('.select_' + Type + '').val());
|
||||
MrpId = Number(element.find(".hf_MrpId").val());
|
||||
Name = element.find('.select_' + Type + ' option[value=' + SerialNoId + ']').text();
|
||||
}
|
||||
if (element.find("#hf_" + Type + "_Id").val() != '' && element.find("#hf_" + Type + "_Id").val() != 0) {
|
||||
RowExist = true;
|
||||
var discountAmount = 0;
|
||||
var discountPercent = 0;
|
||||
if ((element.find(".btn_item_DiscType option:selected").text().trim() == 'Val' || element.find(".btnOrder_DiscType option:selected").text().trim() == 'Mul') && element.find('.txt_addldiscount').val() != '' && element.find('.txt_addldiscount').val() != undefined) {
|
||||
discountAmount = Number(element.find('.txt_addldiscount').val());
|
||||
}
|
||||
else if (element.find(".btn_item_DiscType option:selected").text().trim() == '%' && element.find('.txt_addldiscount').val() != '' && element.find('.txt_addldiscount').val() != undefined) {
|
||||
discountPercent = Number(element.find('.txt_addldiscount').val());
|
||||
}
|
||||
var DiscType = element.find(".btnOrder_DiscType option:selected").text().trim();
|
||||
instance.SplitedInvoiceItemList.push({
|
||||
invoiceItemId: element.find(".hf_selectedInvoiceItemId").val(),
|
||||
orderItemId: element.find(".hf_orderItemId").val(),
|
||||
itemId: element.find(".hf_selectedItemId").val(),
|
||||
taxGroupId: TaxGroupId,
|
||||
taxGroupName: Taxgroupname,
|
||||
description: element.find("#txt_Item_Description").val(),
|
||||
priceListId: element.find(".hf_PriceList").val(),
|
||||
unitPrice: element.find(".Price").val(),
|
||||
addlDiscountValue: discountAmount,
|
||||
addlDiscountPercent: discountPercent,
|
||||
IsTaxInclusive: $('#hfId_IsTaxInclusive').val(),
|
||||
accountId: AccountId,
|
||||
accountName: AccountName,
|
||||
Adjustment: element.find(".hf_RowTotalAdjustment").val(),
|
||||
TotalAmount: element.find(".hf_RowTotal").val(),
|
||||
quantity: element.find(".Quantity").val(),
|
||||
exciseAmount: element.find(".exciseAmount").val(),
|
||||
refNo: element.find(".hf_refNo").val(),
|
||||
DiscountGroupId: element.find("#hf_ItemDiscountGroupId").val(),
|
||||
RefInvoiceItemId: element.find(".hf_refInvoiceItemId").val(),
|
||||
MrpId: MrpId,
|
||||
dcItemId: element.find(".hf_dcItemId").val(),
|
||||
BatchId: BatchId,
|
||||
SerialId: SerialNoId,
|
||||
ExchangeItem: element.find('.hf_IsExchangeItem').val(),
|
||||
taxAdjustment: element.find('.hf_ItemTaxAdjsutmentVal').val(),
|
||||
assesableAdjustment: element.find('.hf_ItemAssesableAdjustmentVal').val(),
|
||||
DiscountGroupName: element.find('.hf_ItemDiscountGroupName').val(),
|
||||
DiscountedAmount: element.find(".hf_DiscountedAmount").val(),
|
||||
TaxPercent: elements.find(".hfProdTaxPercent").val(),
|
||||
Name: Name,
|
||||
DiscType: DiscType,
|
||||
maxQty: element.find('.hf_maxQty').val()
|
||||
});
|
||||
TotalQuantity += Number(element.find(".Quantity").val());
|
||||
var discount = 0;
|
||||
var qyt = Number(element.find(".Quantity").val());
|
||||
var price = Number(element.find(".Price").val());
|
||||
var excamt = Number(element.find(".exciseAmount").val());
|
||||
var assesableAdjustment = Number(element.find('.hf_ItemAssesableAdjustmentVal').val());
|
||||
var ItemAdjustment = Number(element.find(".hf_RowTotalAdjustment").val());
|
||||
discount = (((qyt * price) + assesableAdjustment + ItemAdjustment - excamt) * Number(discountPercent) / 100) + (Number(qyt) * Number(discountAmount));
|
||||
discount = Number(discount);
|
||||
TotalDisc += discount;
|
||||
if ($("#hfInv_Invoicetype").val() == "Purchase" || $("#hfInv_Invoicetype").val() == "PurchaseReturn" || $("#hfInv_Invoicetype").val() == "DebitNote") {
|
||||
TotalAmount += Number(element.find(".txt_RowTotalwithAdjustment").val());
|
||||
}
|
||||
else {
|
||||
TotalAmount += Number(element.find(".TotalPrice").text());
|
||||
}
|
||||
instance.DcItemIds.push(Number(element.find(".hf_dcItemId").val()));
|
||||
}
|
||||
});
|
||||
var Type = "MRP";
|
||||
if (RowExist = true)
|
||||
elements.find('.spn_InvoiceItem').text("View " + Type);
|
||||
else
|
||||
elements.find('.spn_InvoiceItem').text("Select " + Type);
|
||||
elements.find('.prodQuantity').val();
|
||||
elements.find('.prodQuantity').val(TotalQuantity);
|
||||
elements.find('#inv_txtdiscount').val();
|
||||
elements.find('#inv_txtdiscount').val(TotalDisc);
|
||||
if ($("#hfInv_Invoicetype").val() == "Purchase" || $("#hfInv_Invoicetype").val() == "PurchaseReturn" || $("#hfInv_Invoicetype").val() == "DebitNote") {
|
||||
elements.find(".txtRowTotalwithAdjustment").val();
|
||||
elements.find(".txtRowTotalwithAdjustment").val(TotalAmount);
|
||||
}
|
||||
else {
|
||||
elements.find('.prodTotalPrice').text('');
|
||||
elements.find('.prodTotalPrice').text(TotalAmount);
|
||||
}
|
||||
this.navigationHelper.closePopUp();
|
||||
}
|
||||
static Instance() {
|
||||
return new MRPDetails();
|
||||
}
|
||||
}
|
||||
MRPDetails.element = "";
|
||||
Controls.MRPDetails = MRPDetails;
|
||||
})(Controls = Forms.Controls || (Forms.Controls = {}));
|
||||
})(Forms = Unibase.Forms || (Unibase.Forms = {}));
|
||||
})(Unibase || (Unibase = {}));
|
||||
File diff suppressed because one or more lines are too long
+1
File diff suppressed because one or more lines are too long
@@ -0,0 +1,36 @@
|
||||
var Unibase;
|
||||
(function (Unibase) {
|
||||
let Forms;
|
||||
(function (Forms) {
|
||||
let Controls;
|
||||
(function (Controls) {
|
||||
class ItemDetails_Setting {
|
||||
loadSettingHtml() {
|
||||
return ``;
|
||||
}
|
||||
bindControlData(controldatajson) {
|
||||
return "";
|
||||
}
|
||||
SaveControlData(controldatajson) {
|
||||
return "";
|
||||
}
|
||||
loadControlPropertiesHtml(Container) {
|
||||
return "";
|
||||
}
|
||||
bindPropertySettings(prop) {
|
||||
return "";
|
||||
}
|
||||
savePropertySettings(prop) {
|
||||
return "";
|
||||
}
|
||||
static Instance() {
|
||||
if (this.instance === undefined) {
|
||||
this.instance = new ItemDetails_Setting();
|
||||
}
|
||||
return this.instance;
|
||||
}
|
||||
}
|
||||
Controls.ItemDetails_Setting = ItemDetails_Setting;
|
||||
})(Controls = Forms.Controls || (Forms.Controls = {}));
|
||||
})(Forms = Unibase.Forms || (Unibase.Forms = {}));
|
||||
})(Unibase || (Unibase = {}));
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"item.settings.js","sourceRoot":"","sources":["item.settings.ts"],"names":[],"mappings":"AACA,IAAU,OAAO,CAkChB;AAlCD,WAAU,OAAO;IACb,IAAiB,KAAK,CAgCrB;IAhCD,WAAiB,KAAK;QAClB,IAAiB,QAAQ,CA8BxB;QA9BD,WAAiB,QAAQ;YACrB,MAAa,mBAAmB;gBAC5B,eAAe;oBACX,OAAO,EAAE,CAAC;gBACd,CAAC;gBACD,eAAe,CAAC,eAAoB;oBAChC,OAAO,EAAE,CAAC;gBACd,CAAC;gBACD,eAAe,CAAC,eAAoB;oBAChC,OAAO,EAAE,CAAC;gBACd,CAAC;gBACD,yBAAyB,CAAC,SAAS;oBAC/B,OAAO,EAAE,CAAC;gBACd,CAAC;gBACD,oBAAoB,CAAC,IAAgB;oBACjC,OAAO,EAAE,CAAC;gBACd,CAAC;gBACD,oBAAoB,CAAC,IAAgB;oBACjC,OAAO,EAAE,CAAC;gBACd,CAAC;gBAID,MAAM,CAAC,QAAQ;oBACX,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE;wBAC7B,IAAI,CAAC,QAAQ,GAAG,IAAI,mBAAmB,EAAE,CAAC;qBAC7C;oBACD,OAAO,IAAI,CAAC,QAAQ,CAAC;gBACzB,CAAC;aACJ;YA5BY,4BAAmB,sBA4B/B,CAAA;QACL,CAAC,EA9BgB,QAAQ,GAAR,cAAQ,KAAR,cAAQ,QA8BxB;IACL,CAAC,EAhCgB,KAAK,GAAL,aAAK,KAAL,aAAK,QAgCrB;AACL,CAAC,EAlCS,OAAO,KAAP,OAAO,QAkChB"}
|
||||
+1
@@ -0,0 +1 @@
|
||||
var Unibase;(function(n){let t;(function(n){let t;(function(n){class t{loadSettingHtml(){return``}bindControlData(){return""}SaveControlData(){return""}loadControlPropertiesHtml(){return""}bindPropertySettings(){return""}savePropertySettings(){return""}static Instance(){return this.instance===undefined&&(this.instance=new t),this.instance}}n.ItemDetails_Setting=t})(t=n.Controls||(n.Controls={}))})(t=n.Forms||(n.Forms={}))})(Unibase||(Unibase={}));
|
||||
@@ -0,0 +1,279 @@
|
||||
var Bizgaze;
|
||||
(function (Bizgaze) {
|
||||
let Apps;
|
||||
(function (Apps) {
|
||||
let Transact;
|
||||
(function (Transact) {
|
||||
let Controls;
|
||||
(function (Controls) {
|
||||
class ItemRecDetails extends Unibase.Platform.Core.BaseComponent {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.ItemList = [];
|
||||
this.IsEnablepacks = false;
|
||||
this.ItemIds = [0];
|
||||
}
|
||||
init(formpropertyid, prop, callback) {
|
||||
let instance = this;
|
||||
instance.ItemList = [];
|
||||
instance.IsEnablepacks = false;
|
||||
instance.ItemIds = [0];
|
||||
let jsFiles = ["platform/core/helpers/numberhelper/numberhelper.js", "apps/transact/managers/inventory/itemmanager.js", "apps/transact/managers/inventory/itemmanager.js", "apps/transact/managers/inventory/dcmanager.js"];
|
||||
instance.fileCacheHelper.loadJsFiles(jsFiles, function () {
|
||||
instance.loadControlSettings(prop.ControlJsonText, prop.FormPropertyId);
|
||||
instance.loadPropertySettings(prop.PropertySettings, prop.FormPropertyId, "");
|
||||
});
|
||||
if (Bizgaze.Apps.Transact.Controls.ItemRecDetails.Instance().ItemList.length > 0) {
|
||||
$("#chk_showtype").attr('disabled', "true");
|
||||
}
|
||||
}
|
||||
loadControl(containerid, prop) {
|
||||
var instance = Bizgaze.Apps.Transact.Controls.ItemRecDetails.Instance();
|
||||
var html = '<div class="panel panel-default" style="padding-bottom:0px" id="ItemRecDetails">' +
|
||||
'<div class="" style="padding-bottom:10px"> <div id="tbl_ItemRecdetails" class="col-sm-12 d-none d-md-block ">' +
|
||||
'<div class="row lineheight wrapper-sm div_irecdetails" style = "border-bottom: 2px solid grey;">' +
|
||||
'<div class="col-5 min-padding" id="div_cbn">' +
|
||||
'<strong class="">Created By Name</strong></div>' +
|
||||
'<div class="col-4 pl-100 text-center min-padding"><strong id="hdr_value" class="ml-20">Physical Qty</strong></div></div ></div ></div > ' +
|
||||
'<div class="panel-body ItemRecDetails"><div class="ird-list added-row IrdRow-0 "></div></div></div>' +
|
||||
'<div class="row hidden col-12 text-center" id="div_nird"><strong class="col-12 text-center" style="color:black">No Reconciliation Details</strong></div>';
|
||||
$("#" + containerid).html(html);
|
||||
$(".section_ItemRecDetails").hide();
|
||||
instance.fileCacheHelper.loadJsFile("platform/core/helpers/numberhelper/numberhelper.js", function () { });
|
||||
$(".hrefSection_RecDetails").click(function () {
|
||||
debugger;
|
||||
if ($(".hrefSection_RecDetails").text() == "Hide Details") {
|
||||
$(".hrefSection_RecDetails").text("Rec Details");
|
||||
$(".section_ItemRecDetails").hide();
|
||||
}
|
||||
else if ($(".hrefSection_RecDetails").text() == "Rec Details") {
|
||||
$(".hrefSection_RecDetails").text("Hide Details");
|
||||
$(".section_ItemRecDetails").show();
|
||||
}
|
||||
});
|
||||
$("#divSectionProperties_MissingQty").removeClass(" mt-10").addClass("mt-20");
|
||||
$("#divSectionProperties_MissingDamaged").removeClass(" mt-10").addClass("mt-20");
|
||||
$(".hdn_isreconcil").val("true");
|
||||
$(".txtAutoComplete_itemid").change(function () {
|
||||
let elem1 = $(this);
|
||||
let a = $(elem1).parentsUntil(".subformcls");
|
||||
let elem = a[a.length - 1];
|
||||
let itemlength = ItemRecDetails.instance.ItemIds.findIndex(x => x == Number($(elem).find(".txtAutoComplete_itemid").val()));
|
||||
ItemRecDetails.instance.getitem($(elem).find(".txtAutoComplete_itemid").val(), elem);
|
||||
if (Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.length != 0) {
|
||||
ItemRecDetails.instance.bindRecDetails();
|
||||
}
|
||||
});
|
||||
$(".number_phylqty").keyup(function () {
|
||||
let elem1 = $(this);
|
||||
let a = $(elem1).parentsUntil(".subformcls");
|
||||
let elem = a[a.length - 1];
|
||||
$(elem).find(".labelSection_MissingQty").text("Missing Qty : " + (Number($(elem).find(".number_phylqty").val()) - Number($(elem).find(".hdn_avalqty").val())).toFixed(2));
|
||||
});
|
||||
$(".number_phydmgqty").keyup(function () {
|
||||
let elem1 = $(this);
|
||||
let a = $(elem1).parentsUntil(".subformcls");
|
||||
let elem = a[a.length - 1];
|
||||
$(elem).find(".labelSection_PDmgQty").text("Dmg Qty : " + (Number($(elem).find(".number_phydmgqty").val()) - Number($(elem).find(".hdn_avaldmgqty").val())).toFixed(2));
|
||||
});
|
||||
$(".number_phylpacks,.number_phylpieces").keyup(function () {
|
||||
var instance = ItemRecDetails.Instance();
|
||||
let elem1 = $(this);
|
||||
let a = $(elem1).parentsUntil(".subformcls");
|
||||
let elem = a[a.length - 1];
|
||||
var item = instance.ItemList.find(x => x.ItemId == $(elem).find(".txtAutoComplete_itemid").val());
|
||||
var packs = Number($(elem).find(".number_phylpacks").val());
|
||||
var pieces = Number($(elem).find(".number_phylpieces").val());
|
||||
var phy_qty = ((item.PackCount * item.PackSize) * packs) + (pieces * item.PackSize);
|
||||
$(elem).find(".number_phylqty").val(phy_qty);
|
||||
let Phypacks = instance.roundOffIgnoreZerosAfterDecimal(Number(item.Packs) - packs);
|
||||
let phypices = instance.roundOffIgnoreZerosAfterDecimal(Number(item.Pieces) - pieces);
|
||||
var Msgpandp = Phypacks + "/" + phypices;
|
||||
$(elem).find(".labelSection_Misspacks").text("Msg Qty :" + Msgpandp);
|
||||
});
|
||||
$(".number_phydmgpacks,.number_phydmgpieces").keyup(function () {
|
||||
let elem1 = $(this);
|
||||
let elem = $(elem1).parentsUntil(".subformcls")[$(elem1).parentsUntil(".subformcls").length - 1];
|
||||
var item = instance.ItemList.find(x => x.ItemId == $(elem).find(".txtAutoComplete_itemid").val());
|
||||
var dmgpacks = Number($(elem).find(".number_phydmgpacks").val());
|
||||
var dmgpieces = Number($(elem).find(".number_phydmgpieces").val());
|
||||
var phydmg_qty = ((item.PackCount * item.PackSize) * dmgpacks) + (dmgpieces * item.PackSize);
|
||||
$(elem).find(".number_phydmgqty").val(phydmg_qty);
|
||||
let Phydmgpacks = instance.roundOffIgnoreZerosAfterDecimal(Number(item.DmgPacks) - dmgpacks);
|
||||
let Phydmgpieces = instance.roundOffIgnoreZerosAfterDecimal(Number(item.DmgPieces) - dmgpieces);
|
||||
var MsgDmgPandP = Phydmgpacks + "/" + Phydmgpieces;
|
||||
$(elem).find(".labelSection_Dmgpacks").text("Dmg Qty: " + MsgDmgPandP);
|
||||
});
|
||||
}
|
||||
getitem(itemid, elem) {
|
||||
this.fileCacheHelper.loadJsFiles(["apps/transact/managers/inventory/itemmanager.js", "apps/transact/managers/inventory/dcmanager.js"], function () {
|
||||
Bizgaze.Apps.Transact.Managers.ItemManager.Instance().getItem(itemid).then(function (res) {
|
||||
if (res.result != null) {
|
||||
let BranchId = 0;
|
||||
if (Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.length != 0) {
|
||||
BranchId = Number(Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_branchid").Value);
|
||||
}
|
||||
else {
|
||||
BranchId = Number($(".txtAutoComplete_branchid").val());
|
||||
}
|
||||
Bizgaze.Apps.Transact.Managers.DCManager.Instance().getAvailQty(itemid, BranchId).then(function (responce) {
|
||||
Bizgaze.Apps.Transact.Controls.ItemRecDetails.instance.ItemList.push({
|
||||
ItemId: Number(itemid),
|
||||
Packs: responce.result.Packs,
|
||||
Pieces: responce.result.Pieces,
|
||||
PackCount: res.result.PackCount,
|
||||
PackSize: res.result.PackSize,
|
||||
AvailQty: responce.result.Quantity,
|
||||
DmgQty: responce.result.AvailDamagedQty,
|
||||
DmgPacks: responce.result.DmgPacks,
|
||||
DmgPieces: responce.result.DmgPieces,
|
||||
});
|
||||
if (elem != null) {
|
||||
$(elem).find(".hdn_avalqty").val(responce.result.Quantity);
|
||||
$(elem).find(".hdn_avaldmgqty").val(responce.result.AvailDamagedQty);
|
||||
if ($("#hdnchk_showtype").val() == "true") {
|
||||
$(elem).find(".labelSection_AvailQty").text("Avail Qty :" + responce.result.Packs + "/" + responce.result.Pieces);
|
||||
$(elem).find(".labelSection_AvailDmgQty").text("Avail Dmg Qty:" + responce.result.DmgPacks + "/" + responce.result.DmgPieces);
|
||||
}
|
||||
else {
|
||||
$(elem).find(".labelSection_AvailQty").text("Avail Qty :" + responce.result.Quantity);
|
||||
$(elem).find(".labelSection_AvailDmgQty").text("Avail Dmg Qty:" + responce.result.AvailDamagedQty);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$(".hdn_avalqty").val(responce.result.Quantity);
|
||||
$(".hdn_avaldmgqty").val(responce.result.AvailDamagedQty);
|
||||
if ($("#hdnchk_showtype").val() == "true") {
|
||||
$(".labelSection_AvailQty").text("Avail Qty :" + responce.result.Packs + "/" + responce.result.Pieces);
|
||||
$(".labelSection_AvailDmgQty").text("Avail Dmg Qty:" + responce.result.DmgPacks + "/" + responce.result.DmgPieces);
|
||||
}
|
||||
else {
|
||||
$(".labelSection_AvailQty").text("Avail Qty :" + responce.result.Quantity);
|
||||
$(".labelSection_AvailDmgQty").text("Avail Dmg Qty:" + responce.result.AvailDamagedQty);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
bindRecDetails() {
|
||||
this.fileCacheHelper.loadJsFile("apps/transact/managers/inventory/itemmanager.js", function () {
|
||||
Bizgaze.Apps.Transact.Managers.ItemManager.Instance().getItemRecDetails(Unibase.Themes.Providers.DetailHelper.recordId, Number($(".txtAutoComplete_itemid option:selected").val())).then(function (res) {
|
||||
if (res.result.length > 0) {
|
||||
$(".section_ItemRecDetails").show();
|
||||
if ($(".div_irecdetails").hasClass('hidden')) {
|
||||
$(".div_irecdetails").removeClass('hidden');
|
||||
}
|
||||
$("#div_nird").addClass('hidden');
|
||||
var html1 = "";
|
||||
for (var i = 0; i < res.result.length; i++) {
|
||||
html1 += "<div class='col-sm-12 itemrecdetails'><div Class='row'><div class='col-7'><span>" + res.result[i].CreatedByName + "</span></div><div class='col-4'><span>" + res.result[i].PhylQty + "</span></div></div></div>";
|
||||
}
|
||||
$(".ItemRecDetails:last").after(html1);
|
||||
}
|
||||
else {
|
||||
$(".itemrecdetails").empty();
|
||||
$("#div_nird").removeClass('hidden');
|
||||
$(".div_irecdetails").addClass('hidden');
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
updateIsReconcil(ItemrecDetailId) {
|
||||
var instance = this;
|
||||
instance.fileCacheHelper.loadJsFile("apps/transact/managers/inventory/dcmanager.js", function () {
|
||||
var postdata = {
|
||||
ItemrecDetailId: ItemrecDetailId,
|
||||
};
|
||||
Bizgaze.Apps.Transact.Managers.DCManager.Instance().updateIsReconcil(postdata).then(function (responce) {
|
||||
if (responce.errors == null) {
|
||||
instance.navigationHelper.loadDetail(Unibase.Themes.Providers.DetailHelper.recordId, Unibase.Themes.Providers.DetailHelper.installedAppId, null);
|
||||
MessageHelper.Instance().showSuccess(responce.message, "");
|
||||
}
|
||||
else {
|
||||
MessageHelper.Instance().showError(responce.message, 'div_message');
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
loadControlSettings(controlsettingjson, formpropertyid) {
|
||||
return '';
|
||||
}
|
||||
loadPropertySettings(propertysettings, formpropertyid, DocPropertyName) {
|
||||
return '';
|
||||
}
|
||||
bindEditFormDetails(formpropertyid, propval, DocPropertyName) {
|
||||
return '';
|
||||
}
|
||||
roundOffIgnoreZerosAfterDecimal(n, decimalValue = 2) {
|
||||
n = Number(n);
|
||||
return Number(n.toFixed(decimalValue));
|
||||
}
|
||||
validate(ItemContainerId) {
|
||||
if (Number($(".txtAutoComplete_lobid").val()) == 0) {
|
||||
Unibase.Platform.Forms.Components.FormViewer.Instance().showError("Please Select LoB");
|
||||
$(".subformcls").remove();
|
||||
}
|
||||
else if (Number($(".txtAutoComplete_branchid").val()) == 0) {
|
||||
Unibase.Platform.Forms.Components.FormViewer.Instance().showError("Please Select Branch");
|
||||
$(".subformcls").remove();
|
||||
}
|
||||
else {
|
||||
if (Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.length != 0) {
|
||||
let LobId = Number(Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_lobid").Value);
|
||||
var Parameters = [{ "ColumnName": "lobid", "Value": LobId, }];
|
||||
Unibase.Forms.Controls.AutoComplete.Instance().LoadAutoComplete(ItemContainerId, Parameters);
|
||||
}
|
||||
else {
|
||||
var Parameters = [{ "ColumnName": "lobid", "Value": Number($(".txtAutoComplete_lobid").val()), }];
|
||||
Unibase.Forms.Controls.AutoComplete.Instance().LoadAutoComplete(ItemContainerId, Parameters);
|
||||
}
|
||||
}
|
||||
}
|
||||
hideandshowproperties() {
|
||||
if ($("#hdnchk_showtype").val() == "true") {
|
||||
ItemRecDetails.instance.IsEnablepacks = true;
|
||||
$(".divCustomProperties_phylqty").addClass("hidden");
|
||||
$(".divCustomProperties_phydmgqty").addClass("hidden");
|
||||
$(".divSectionProperties_MissingQty").addClass("hidden");
|
||||
$(".divSectionProperties_PDmgQty").addClass("hidden");
|
||||
$(".divCustomProperties_phylpacks").removeClass("hidden");
|
||||
$(".divCustomProperties_phylpieces").removeClass("hidden");
|
||||
$(".divCustomProperties_phydmgpacks").removeClass("hidden");
|
||||
$(".divCustomProperties_phydmgpieces").removeClass("hidden");
|
||||
$(".divSectionProperties_Misspacks").removeClass("hidden");
|
||||
$(".divSectionProperties_Dmgpacks").removeClass("hidden");
|
||||
}
|
||||
else {
|
||||
ItemRecDetails.instance.IsEnablepacks = false;
|
||||
$(".divCustomProperties_phylpacks").addClass("hidden");
|
||||
$(".divCustomProperties_phylpieces").addClass("hidden");
|
||||
$(".divCustomProperties_phydmgpacks").addClass("hidden");
|
||||
$(".divCustomProperties_phydmgpieces").addClass("hidden");
|
||||
$(".divSectionProperties_Misspacks").addClass("hidden");
|
||||
$(".divSectionProperties_Dmgpacks").addClass("hidden");
|
||||
$(".divCustomProperties_phylqty").removeClass("hidden");
|
||||
$(".divCustomProperties_phydmgqty").removeClass("hidden");
|
||||
$(".divSectionProperties_MissingQty").removeClass("hidden");
|
||||
$(".divSectionProperties_PDmgQty").removeClass("hidden");
|
||||
$(".divSectionProperties_AvailQty ").removeClass("hidden");
|
||||
}
|
||||
}
|
||||
resertVariables() {
|
||||
this.ItemIds = [0];
|
||||
this.IsEnablepacks = false;
|
||||
this.ItemList = [];
|
||||
}
|
||||
static Instance() {
|
||||
if (this.instance === undefined) {
|
||||
this.instance = new ItemRecDetails();
|
||||
}
|
||||
return this.instance;
|
||||
}
|
||||
}
|
||||
Controls.ItemRecDetails = ItemRecDetails;
|
||||
})(Controls = Transact.Controls || (Transact.Controls = {}));
|
||||
})(Transact = Apps.Transact || (Apps.Transact = {}));
|
||||
})(Apps = Bizgaze.Apps || (Bizgaze.Apps = {}));
|
||||
})(Bizgaze || (Bizgaze = {}));
|
||||
File diff suppressed because one or more lines are too long
+1
File diff suppressed because one or more lines are too long
@@ -0,0 +1,41 @@
|
||||
var Bizgaze;
|
||||
(function (Bizgaze) {
|
||||
let Apps;
|
||||
(function (Apps) {
|
||||
let Transact;
|
||||
(function (Transact) {
|
||||
let Controls;
|
||||
(function (Controls) {
|
||||
class ItemRecDetail_Setting {
|
||||
loadSettingHtml() {
|
||||
return ``;
|
||||
}
|
||||
bindControlData(controldatajson) {
|
||||
return "";
|
||||
}
|
||||
SaveControlData(controldatajson) {
|
||||
return "";
|
||||
}
|
||||
loadControlPropertiesHtml(Container) {
|
||||
return ``;
|
||||
}
|
||||
bindPropertySettings(prop) {
|
||||
var propertySettings = prop.PropertySettings;
|
||||
return "";
|
||||
}
|
||||
savePropertySettings(prop) {
|
||||
var propertySettings = prop.PropertySettings;
|
||||
return "";
|
||||
}
|
||||
static Instance() {
|
||||
if (this.instance === undefined) {
|
||||
this.instance = new ItemRecDetail_Setting();
|
||||
}
|
||||
return this.instance;
|
||||
}
|
||||
}
|
||||
Controls.ItemRecDetail_Setting = ItemRecDetail_Setting;
|
||||
})(Controls = Transact.Controls || (Transact.Controls = {}));
|
||||
})(Transact = Apps.Transact || (Apps.Transact = {}));
|
||||
})(Apps = Bizgaze.Apps || (Bizgaze.Apps = {}));
|
||||
})(Bizgaze || (Bizgaze = {}));
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"itemrecdetails.setting.js","sourceRoot":"","sources":["itemrecdetails.setting.ts"],"names":[],"mappings":"AAAA,IAAU,OAAO,CAoChB;AApCD,WAAU,OAAO;IACb,IAAiB,IAAI,CAkCpB;IAlCD,WAAiB,IAAI;QACjB,IAAiB,QAAQ,CAgCxB;QAhCD,WAAiB,QAAQ;YACrB,IAAiB,QAAQ,CA8BxB;YA9BD,WAAiB,QAAQ;gBACrB,MAAa,qBAAqB;oBAC9B,eAAe;wBACX,OAAO,EAAE,CAAC;oBACd,CAAC;oBACD,eAAe,CAAC,eAAoB;wBAChC,OAAO,EAAE,CAAC;oBACd,CAAC;oBACD,eAAe,CAAC,eAAoB;wBAChC,OAAO,EAAE,CAAC;oBACd,CAAC;oBACD,yBAAyB,CAAC,SAAS;wBAC/B,OAAO,EAAE,CAAC;oBACd,CAAC;oBACD,oBAAoB,CAAC,IAAgB;wBACjC,IAAI,gBAAgB,GAA6B,IAAI,CAAC,gBAAgB,CAAC;wBACvE,OAAO,EAAE,CAAC;oBACd,CAAC;oBACD,oBAAoB,CAAC,IAAgB;wBACjC,IAAI,gBAAgB,GAA6B,IAAI,CAAC,gBAAgB,CAAC;wBACvE,OAAO,EAAE,CAAC;oBACd,CAAC;oBAED,MAAM,CAAC,QAAQ;wBACX,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE;4BAC7B,IAAI,CAAC,QAAQ,GAAG,IAAI,qBAAqB,EAAE,CAAC;yBAC/C;wBACD,OAAO,IAAI,CAAC,QAAQ,CAAC;oBACzB,CAAC;iBACJ;gBA5BY,8BAAqB,wBA4BjC,CAAA;YACL,CAAC,EA9BgB,QAAQ,GAAR,iBAAQ,KAAR,iBAAQ,QA8BxB;QACL,CAAC,EAhCgB,QAAQ,GAAR,aAAQ,KAAR,aAAQ,QAgCxB;IACL,CAAC,EAlCgB,IAAI,GAAJ,YAAI,KAAJ,YAAI,QAkCpB;AACL,CAAC,EApCS,OAAO,KAAP,OAAO,QAoChB"}
|
||||
+1
@@ -0,0 +1 @@
|
||||
var Bizgaze;(function(n){let t;(function(n){let t;(function(n){let t;(function(n){class t{loadSettingHtml(){return``}bindControlData(){return""}SaveControlData(){return""}loadControlPropertiesHtml(){return``}bindPropertySettings(n){var t=n.PropertySettings;return""}savePropertySettings(n){var t=n.PropertySettings;return""}static Instance(){return this.instance===undefined&&(this.instance=new t),this.instance}}n.ItemRecDetail_Setting=t})(t=n.Controls||(n.Controls={}))})(t=n.Transact||(n.Transact={}))})(t=n.Apps||(n.Apps={}))})(Bizgaze||(Bizgaze={}));
|
||||
@@ -0,0 +1,110 @@
|
||||
var Bizgaze;
|
||||
(function (Bizgaze) {
|
||||
let Apps;
|
||||
(function (Apps) {
|
||||
let Transact;
|
||||
(function (Transact) {
|
||||
let Controls;
|
||||
(function (Controls) {
|
||||
let ItemDetails;
|
||||
(function (ItemDetails) {
|
||||
class ItemsCarousel extends Unibase.Platform.Core.BaseComponent {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.appsHtml = '';
|
||||
this.IsAppRefresh = false;
|
||||
}
|
||||
jsFiles() {
|
||||
return ['apps/transact/controls/itemdetails/itemscarousel.js'];
|
||||
}
|
||||
cssFiles() {
|
||||
return [];
|
||||
}
|
||||
html(id, containerid) {
|
||||
var instance = this;
|
||||
let html = ` <div id="img-modal" class="modal-content h-100">
|
||||
|
||||
<div class="modal-header pa-10"> <strong class="modal-title biz-highlight-bg-color" id="imagegalleryheading">Items</strong>
|
||||
<div class="d-flex align-items-center justify-content-between">
|
||||
|
||||
<div> </div>
|
||||
</div>
|
||||
<div id="divEditFiltersErrMsg" class="form-error-message"></div>
|
||||
</div>
|
||||
<div class="modal-body simple-scroll-bar edit-filters-body py-0 bg-cyan-light-5">
|
||||
<div class="d-flex" id="galleryheightmodel" style="gap: 10px;align-items: center;height:80vh">
|
||||
<a style="opacity: 1; width:20px; " class="carousel-control-prev position-static" href="#carouselExampleControls" role="button"
|
||||
data-slide="prev"> <span style="background-image: none;" class="carousel-control-prev-icon"
|
||||
aria-hidden="true"> <i class="fa fa-angle-double-left " style=" color: black; font-size: 34px; "></i>
|
||||
</span> <span class="preImgHandler sr-only">Previous</span> </a>
|
||||
<div class="card bg-transparent border-0 shadow-none" id="staticFiltersCard" style="
|
||||
flex-grow: 1;
|
||||
">
|
||||
<div id="carouselExampleControls" data-interval="2000" class="carousel slide-fade" data-ride="carousel">
|
||||
<div class="carousel-inner" style="padding:10px "> </div>
|
||||
</div>
|
||||
</div>
|
||||
<a style="opacity: 1;width: 20px;" class="carousel-control-next position-static" href="#carouselExampleControls" role="button"
|
||||
data-slide="next"> <span style="background-image: none;" class="carousel-control-next-icon"
|
||||
aria-hidden="true"> <i class="fa fa-angle-double-right" style=" color: black; font-size: 34px;"></i>
|
||||
</span> <span class="sr-only ">Next</span> </a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer pa-10"> <button type="button"
|
||||
onclick="Unibase.Platform.Helpers.NavigationHelper.Instance().closePopUp()" id="btn_CloseForm_${id}"
|
||||
class="btn btn-light btn-sm mr-auto">Close</button>
|
||||
|
||||
|
||||
</div>
|
||||
</div>`;
|
||||
return html;
|
||||
}
|
||||
load(id, containerid, callback) {
|
||||
var instance = this;
|
||||
instance.carouselModel(id);
|
||||
$('.carousel').carousel({
|
||||
interval: 2000,
|
||||
wrap: false,
|
||||
});
|
||||
}
|
||||
carouselModel(id) {
|
||||
var instance = this;
|
||||
instance.fileCacheHelper.loadJsFile("platform/files/managers/filemanager.js", function () {
|
||||
Unibase.Platform.Files.Managers.FileManager.Instance().getDocumentByRefIdApi(id).then(function (response) {
|
||||
var document = response.result.sort().reverse();
|
||||
var documentfiles = response.result.map(x => x.DocumentFiles);
|
||||
let html = '';
|
||||
for (let i = 0; i < documentfiles.length; i++) {
|
||||
if (documentfiles[i].length > 0) {
|
||||
let DocumentFilePath = documentfiles[i][0].DocumentFilePath;
|
||||
if (i == 0) {
|
||||
html = `<div style = "max-height: 100vh !important" class="carousel-item active" >
|
||||
<img class="mh-100 mw-100 w-100" src = "${DocumentFilePath}" alt = "image not found" onerror = "ReloadImage(event)" data-dynamic="1" data-loaded="0"></div>`;
|
||||
}
|
||||
else {
|
||||
html = `<div style = "max-height: 100vh !important" class="carousel-item" >
|
||||
<img class="mh-100 mw-100 w-100" src="${DocumentFilePath}" alt="image not found" onerror = "ReloadImage(event)" data-dynamic="1" data-loaded="0"></div>`;
|
||||
}
|
||||
$(".carousel-inner").append(html);
|
||||
if (i == documentfiles.length - 1) {
|
||||
return;
|
||||
}
|
||||
;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
static Instance() {
|
||||
if (this._instance === undefined)
|
||||
this._instance = new ItemsCarousel();
|
||||
return this._instance;
|
||||
}
|
||||
}
|
||||
ItemDetails.ItemsCarousel = ItemsCarousel;
|
||||
})(ItemDetails = Controls.ItemDetails || (Controls.ItemDetails = {}));
|
||||
})(Controls = Transact.Controls || (Transact.Controls = {}));
|
||||
})(Transact = Apps.Transact || (Apps.Transact = {}));
|
||||
})(Apps = Bizgaze.Apps || (Bizgaze.Apps = {}));
|
||||
})(Bizgaze || (Bizgaze = {}));
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"itemscarousel.js","sourceRoot":"","sources":["itemscarousel.ts"],"names":[],"mappings":"AAAA,IAAU,OAAO,CA4GhB;AA5GD,WAAU,OAAO;IACb,IAAiB,IAAI,CA0GpB;IA1GD,WAAiB,IAAI;QACjB,IAAiB,QAAQ,CAwGxB;QAxGD,WAAiB,QAAQ;YACrB,IAAiB,QAAQ,CAsGxB;YAtGD,WAAiB,QAAQ;gBACrB,IAAiB,WAAW,CAoG3B;gBApGD,WAAiB,WAAW;oBACxB,MAAa,aAAc,SAAQ,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa;wBAAtE;;4BACI,aAAQ,GAAG,EAAE,CAAC;4BACd,iBAAY,GAAY,KAAK,CAAC;wBAgGlC,CAAC;wBA/FG,OAAO;4BACH,OAAO,CAAC,qDAAqD,CAAC,CAAC;wBACnE,CAAC;wBACD,QAAQ;4BACJ,OAAO,EAAE,CAAC;wBACd,CAAC;wBACD,IAAI,CAAC,EAAE,EAAE,WAAW;4BAChB,IAAI,QAAQ,GAAG,IAAI,CAAC;4BACpB,IAAI,IAAI,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4GA8BqE,EAAE;;;;;OAKvG,CAAC;4BACoB,OAAO,IAAI,CAAC;wBAChB,CAAC;wBACD,IAAI,CAAC,EAAE,EAAE,WAAW,EAAE,QAAQ;4BAC1B,IAAI,QAAQ,GAAG,IAAI,CAAC;4BAEpB,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;4BAC3B,CAAC,CAAC,WAAW,CAAC,CAAC,QAAQ,CAAC;gCACpB,QAAQ,EAAE,IAAI;gCACd,IAAI,EAAE,KAAK;6BACd,CAAC,CAAC;wBACP,CAAC;wBACD,aAAa,CAAC,EAAE;4BACZ,IAAI,QAAQ,GAAG,IAAI,CAAC;4BACpB,QAAQ,CAAC,eAAe,CAAC,UAAU,CAAC,wCAAwC,EAAE;gCAC1E,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,qBAAqB,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,QAAQ;oCAMpG,IAAI,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC;oCAChD,IAAI,aAAa,GAAG,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC;oCAE7D,IAAI,IAAI,GAAG,EAAE,CAAC;oCACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;wCAC3C,IAAI,aAAa,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;4CAC7B,IAAI,gBAAgB,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC;4CAE5D,IAAI,CAAC,IAAI,CAAC,EAAE;gDACR,IAAI,GAAG;mFAC4B,gBAAgB,mGAAmG,CAAA;6CACzJ;iDAAM;gDACH,IAAI,GAAG;iFAC0B,gBAAgB,iGAAiG,CAAA;6CACrJ;4CACD,CAAC,CAAC,iBAAiB,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;4CACjC,IAAI,CAAC,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE;gDAC/B,OAAO;6CACV;4CAAA,CAAC;yCACL;qCACJ;gCACL,CAAC,CAAC,CAAC;4BACP,CAAC,CAAC,CAAC;wBACP,CAAC;wBAGD,MAAM,CAAC,QAAQ;4BACX,IAAI,IAAI,CAAC,SAAS,KAAK,SAAS;gCAC5B,IAAI,CAAC,SAAS,GAAG,IAAI,aAAa,EAAE,CAAC;4BACzC,OAAO,IAAI,CAAC,SAAS,CAAC;wBAC1B,CAAC;qBACJ;oBAlGY,yBAAa,gBAkGzB,CAAA;gBACL,CAAC,EApGgB,WAAW,GAAX,oBAAW,KAAX,oBAAW,QAoG3B;YACL,CAAC,EAtGgB,QAAQ,GAAR,iBAAQ,KAAR,iBAAQ,QAsGxB;QACL,CAAC,EAxGgB,QAAQ,GAAR,aAAQ,KAAR,aAAQ,QAwGxB;IACL,CAAC,EA1GgB,IAAI,GAAJ,YAAI,KAAJ,YAAI,QA0GpB;AACL,CAAC,EA5GS,OAAO,KAAP,OAAO,QA4GhB"}
|
||||
@@ -0,0 +1,200 @@
|
||||
var Bizgaze;
|
||||
(function (Bizgaze) {
|
||||
let Apps;
|
||||
(function (Apps) {
|
||||
let Transact;
|
||||
(function (Transact) {
|
||||
let Controls;
|
||||
(function (Controls) {
|
||||
class ItemWarranty extends Unibase.Platform.Core.BaseComponent {
|
||||
cssFiles() {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
jsFiles() {
|
||||
return ['apps/transact/managers/inventory/itemmanager.js'];
|
||||
}
|
||||
html(id, containerid) {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
load(id, containerid, callback) {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
init(containerid) {
|
||||
var instance = this;
|
||||
if (Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.length > 0) {
|
||||
for (let obj of Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters) {
|
||||
if (obj.Key === "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_itemid") {
|
||||
if (obj.Value != null)
|
||||
instance.itemid = Number(obj.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.render(containerid);
|
||||
$("#txtWarrantyTenure").keypress(function (e) {
|
||||
if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
$("#btnWarrantySettings").click(function () {
|
||||
if ($('#btnWarrantySettings').prop('checked') == true) {
|
||||
$(".div_warranty").removeClass("hidden");
|
||||
}
|
||||
else {
|
||||
$(".div_warranty").addClass("hidden");
|
||||
$("#cmbWarrantyProvider").val(0);
|
||||
$("#txtWarrantyTenure").val(0);
|
||||
$("#cmbDurationTenure").val(0);
|
||||
$("#cmbAppliedFrom").val(0);
|
||||
instance.saveWaranty();
|
||||
}
|
||||
});
|
||||
$("#btnItemsMileageSettingsSave").click(function () {
|
||||
instance.saveWaranty();
|
||||
});
|
||||
this.loadItemWarranty();
|
||||
}
|
||||
render(containerid) {
|
||||
var instance = this;
|
||||
$("." + containerid).empty();
|
||||
var html = `<div class="card"><div class="bg-white card-header">
|
||||
<div class="pull-right">
|
||||
<label class="switch pull-right"><input class="WarrantySettings" type="checkbox" id="btnWarrantySettings"><span></span></label>
|
||||
</div>
|
||||
<strong class="biz-highlight-bg-color">Warranty Settings</strong>
|
||||
</div>
|
||||
<div class="card-body div_warranty"><div class="row">
|
||||
<div class="col-sm-6">
|
||||
<label class="control-label">
|
||||
Provided By
|
||||
</label>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<label class="control-label">
|
||||
Provider
|
||||
</label>
|
||||
<select id="cmbWarrantyProvider" class="form-control input-lg">
|
||||
<option value="0">--Select--</option>
|
||||
<option value="1">Manufacturer</option>
|
||||
<option value="2">SupportTeam</option>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
</div><div class="row">
|
||||
<div class="col-sm-3">
|
||||
<div class="form-group floating-label-form-group floating-label-form-group-with-value">
|
||||
<label>Period</label>
|
||||
<input id="txtWarrantyTenure" placeholder="Period" class="form-control required input-lg" type="text" value="0">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-3">
|
||||
<div class="form-group m-t-lg floating-label-form-group-with-value">
|
||||
<label class="control-label">
|
||||
Tenure
|
||||
</label>
|
||||
<select id="cmbDurationTenure" class="form-control input-lg">
|
||||
<option value="0">--Select--</option>
|
||||
<option value="1">Days</option>
|
||||
<option value="3">Years</option>
|
||||
<option value="2">Months</option>
|
||||
<option value="4">Seconds</option>
|
||||
<option value="6">Hours</option>
|
||||
<option value="5">Minutes</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-6">
|
||||
<div class="form-group floating-label-form-group-with-value">
|
||||
<label class="control-label">
|
||||
From
|
||||
</label>
|
||||
<select id="cmbAppliedFrom" class="form-control input-lg">
|
||||
<option value="0">--Select--</option>
|
||||
<option value="2">DateOfInvoice</option>
|
||||
<option value="1">DateOfManufacture</option>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div><div class="text-right">
|
||||
<button id="btnItemsMileageSettingsSave" class="btn btn-info">
|
||||
Save settings
|
||||
</button>
|
||||
|
||||
|
||||
</div></div>`;
|
||||
$("." + containerid).append(html);
|
||||
}
|
||||
loadItemWarranty() {
|
||||
var instance = this;
|
||||
Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile('apps/transact/managers/inventory/itemmanager.js', function () {
|
||||
Bizgaze.Apps.Transact.Managers.ItemManager.Instance().getItemWarranty(instance.itemid).then(function (response) {
|
||||
for (let i = 0; i < response.result.length; i++) {
|
||||
if (response.result[i].SettingName == "BizgazeTransact_Items_Warranty_HasWarranty") {
|
||||
if (response.result[i].SettingValue == "False") {
|
||||
$("#btnWarrantySettings").prop("checked", false);
|
||||
}
|
||||
else {
|
||||
$("#btnWarrantySettings").prop("checked", true);
|
||||
}
|
||||
}
|
||||
if (response.result[i].SettingName == "BizgazeTransact_Items_Warranty_Duration_Number") {
|
||||
$("#txtWarrantyTenure").val(response.result[i].SettingValue);
|
||||
}
|
||||
if (response.result[i].SettingName == "BizgazeTransact_Items_Warranty_Duration_Tenure") {
|
||||
$("#cmbDurationTenure").val(response.result[i].SettingValue);
|
||||
}
|
||||
if (response.result[i].SettingName == "Warranty_AppliedFrom") {
|
||||
$("#cmbAppliedFrom").val(response.result[i].SettingValue);
|
||||
}
|
||||
if (response.result[i].SettingName == "BizgazeTransact_Items_Warranty_Provider") {
|
||||
$("#cmbWarrantyProvider").val(response.result[i].SettingValue);
|
||||
}
|
||||
}
|
||||
if ($('#btnWarrantySettings').prop('checked') == false) {
|
||||
$(".div_warranty").addClass("hidden");
|
||||
}
|
||||
else {
|
||||
$(".div_warranty").removeClass("hidden");
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
saveWaranty() {
|
||||
var instance = this;
|
||||
var itemId = instance.itemid;
|
||||
var hasWarranty = $('#btnWarrantySettings').prop('checked');
|
||||
var maxDurationTenure = $("#cmbDurationTenure").val();
|
||||
var appliedFrom = $("#cmbAppliedFrom").val();
|
||||
var warrantyProvider = $("#cmbWarrantyProvider").val();
|
||||
var WarrantyDur = $("#txtWarrantyTenure").val();
|
||||
var postData = {
|
||||
ItemId: itemId,
|
||||
Warranty_HasWarranty: hasWarranty,
|
||||
Warranty_Duration_Tenure: maxDurationTenure,
|
||||
Warranty_AppliedFrom: appliedFrom,
|
||||
WarrantyProvider: warrantyProvider,
|
||||
Warranty_Duration_Number: WarrantyDur,
|
||||
};
|
||||
Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile('apps/transact/managers/inventory/itemmanager.js', function () {
|
||||
Bizgaze.Apps.Transact.Managers.ItemManager.Instance().saveWaranty(postData).then(function (response) {
|
||||
var detail_instance = Unibase.Themes.Compact.Components.Details.Instance();
|
||||
var containerid = $("._bizgaze_detail_container:visible").attr("id");
|
||||
var _installedAppId = Unibase.Themes.Providers.DetailHelper.installedAppId;
|
||||
var portletid = detail_instance.unibase_core_activeportletid;
|
||||
detail_instance.loadWidgets(_installedAppId, portletid, "#" + containerid + "");
|
||||
MessageHelper.Instance().showSuccess(response.message, '');
|
||||
});
|
||||
});
|
||||
}
|
||||
static Instance() {
|
||||
if (this._instance === undefined)
|
||||
this._instance = new ItemWarranty();
|
||||
return this._instance;
|
||||
}
|
||||
}
|
||||
Controls.ItemWarranty = ItemWarranty;
|
||||
})(Controls = Transact.Controls || (Transact.Controls = {}));
|
||||
})(Transact = Apps.Transact || (Apps.Transact = {}));
|
||||
})(Apps = Bizgaze.Apps || (Bizgaze.Apps = {}));
|
||||
})(Bizgaze || (Bizgaze = {}));
|
||||
File diff suppressed because one or more lines are too long
+67
@@ -0,0 +1,67 @@
|
||||
var Bizgaze;(function(n){let t;(function(t){let i;(function(t){let i;(function(t){class i extends Unibase.Platform.Core.BaseComponent{cssFiles(){throw new Error("Method not implemented.");}jsFiles(){return["apps/transact/managers/inventory/itemmanager.js"]}html(){throw new Error("Method not implemented.");}load(){throw new Error("Method not implemented.");}init(n){var t=this;if(Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.length>0)for(let n of Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters)n.Key==="hf_"+Unibase.Themes.Providers.DetailHelper.installedAppId+"_itemid"&&n.Value!=null&&(t.itemid=Number(n.Value));this.render(n);$("#txtWarrantyTenure").keypress(function(n){if(n.which!=8&&n.which!=0&&(n.which<48||n.which>57))return!1});$("#btnWarrantySettings").click(function(){$("#btnWarrantySettings").prop("checked")==!0?$(".div_warranty").removeClass("hidden"):($(".div_warranty").addClass("hidden"),$("#cmbWarrantyProvider").val(0),$("#txtWarrantyTenure").val(0),$("#cmbDurationTenure").val(0),$("#cmbAppliedFrom").val(0),t.saveWaranty())});$("#btnItemsMileageSettingsSave").click(function(){t.saveWaranty()});this.loadItemWarranty()}render(n){var i=this,t;$("."+n).empty();t=`<div class="card"><div class="bg-white card-header">
|
||||
<div class="pull-right">
|
||||
<label class="switch pull-right"><input class="WarrantySettings" type="checkbox" id="btnWarrantySettings"><span></span></label>
|
||||
</div>
|
||||
<strong class="biz-highlight-bg-color">Warranty Settings</strong>
|
||||
</div>
|
||||
<div class="card-body div_warranty"><div class="row">
|
||||
<div class="col-sm-6">
|
||||
<label class="control-label">
|
||||
Provided By
|
||||
</label>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<label class="control-label">
|
||||
Provider
|
||||
</label>
|
||||
<select id="cmbWarrantyProvider" class="form-control input-lg">
|
||||
<option value="0">--Select--</option>
|
||||
<option value="1">Manufacturer</option>
|
||||
<option value="2">SupportTeam</option>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
</div><div class="row">
|
||||
<div class="col-sm-3">
|
||||
<div class="form-group floating-label-form-group floating-label-form-group-with-value">
|
||||
<label>Period</label>
|
||||
<input id="txtWarrantyTenure" placeholder="Period" class="form-control required input-lg" type="text" value="0">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-3">
|
||||
<div class="form-group m-t-lg floating-label-form-group-with-value">
|
||||
<label class="control-label">
|
||||
Tenure
|
||||
</label>
|
||||
<select id="cmbDurationTenure" class="form-control input-lg">
|
||||
<option value="0">--Select--</option>
|
||||
<option value="1">Days</option>
|
||||
<option value="3">Years</option>
|
||||
<option value="2">Months</option>
|
||||
<option value="4">Seconds</option>
|
||||
<option value="6">Hours</option>
|
||||
<option value="5">Minutes</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-6">
|
||||
<div class="form-group floating-label-form-group-with-value">
|
||||
<label class="control-label">
|
||||
From
|
||||
</label>
|
||||
<select id="cmbAppliedFrom" class="form-control input-lg">
|
||||
<option value="0">--Select--</option>
|
||||
<option value="2">DateOfInvoice</option>
|
||||
<option value="1">DateOfManufacture</option>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div><div class="text-right">
|
||||
<button id="btnItemsMileageSettingsSave" class="btn btn-info">
|
||||
Save settings
|
||||
</button>
|
||||
|
||||
|
||||
</div></div>`;$("."+n).append(t)}loadItemWarranty(){var t=this;Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/transact/managers/inventory/itemmanager.js",function(){n.Apps.Transact.Managers.ItemManager.Instance().getItemWarranty(t.itemid).then(function(n){for(let t=0;t<n.result.length;t++)n.result[t].SettingName=="BizgazeTransact_Items_Warranty_HasWarranty"&&(n.result[t].SettingValue=="False"?$("#btnWarrantySettings").prop("checked",!1):$("#btnWarrantySettings").prop("checked",!0)),n.result[t].SettingName=="BizgazeTransact_Items_Warranty_Duration_Number"&&$("#txtWarrantyTenure").val(n.result[t].SettingValue),n.result[t].SettingName=="BizgazeTransact_Items_Warranty_Duration_Tenure"&&$("#cmbDurationTenure").val(n.result[t].SettingValue),n.result[t].SettingName=="Warranty_AppliedFrom"&&$("#cmbAppliedFrom").val(n.result[t].SettingValue),n.result[t].SettingName=="BizgazeTransact_Items_Warranty_Provider"&&$("#cmbWarrantyProvider").val(n.result[t].SettingValue);$("#btnWarrantySettings").prop("checked")==!1?$(".div_warranty").addClass("hidden"):$(".div_warranty").removeClass("hidden")})})}saveWaranty(){var t=this,i=t.itemid,r=$("#btnWarrantySettings").prop("checked"),u=$("#cmbDurationTenure").val(),f=$("#cmbAppliedFrom").val(),e=$("#cmbWarrantyProvider").val(),o=$("#txtWarrantyTenure").val(),s={ItemId:i,Warranty_HasWarranty:r,Warranty_Duration_Tenure:u,Warranty_AppliedFrom:f,WarrantyProvider:e,Warranty_Duration_Number:o};Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/transact/managers/inventory/itemmanager.js",function(){n.Apps.Transact.Managers.ItemManager.Instance().saveWaranty(s).then(function(n){var t=Unibase.Themes.Compact.Components.Details.Instance(),i=$("._bizgaze_detail_container:visible").attr("id"),r=Unibase.Themes.Providers.DetailHelper.installedAppId,u=t.unibase_core_activeportletid;t.loadWidgets(r,u,"#"+i+"");MessageHelper.Instance().showSuccess(n.message,"")})})}static Instance(){return this._instance===undefined&&(this._instance=new i),this._instance}}t.ItemWarranty=i})(i=t.Controls||(t.Controls={}))})(i=t.Transact||(t.Transact={}))})(t=n.Apps||(n.Apps={}))})(Bizgaze||(Bizgaze={}));
|
||||
@@ -0,0 +1,182 @@
|
||||
var Bizgaze;
|
||||
(function (Bizgaze) {
|
||||
let Apps;
|
||||
(function (Apps) {
|
||||
let Transact;
|
||||
(function (Transact) {
|
||||
let Controles;
|
||||
(function (Controles) {
|
||||
let ItemDetails;
|
||||
(function (ItemDetails) {
|
||||
class Mileagesetting extends Unibase.Platform.Core.BaseComponent {
|
||||
cssFiles() {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
jsFiles() {
|
||||
return ['apps/transact/managers/inventory/itemmanager.js'];
|
||||
}
|
||||
html(id, containerid) {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
load(id, containerid, callback) {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
init(containerid) {
|
||||
var instance = this;
|
||||
if (Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.length > 0) {
|
||||
for (let obj of Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters) {
|
||||
if (obj.Key === "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_itemid") {
|
||||
if (obj.Value != null)
|
||||
instance.itemid = Number(obj.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.render(containerid);
|
||||
$("#txtMilage_Recommended_Number").keypress(function (e) {
|
||||
if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
$("#txtMilage_Duration_Number").keypress(function (e) {
|
||||
if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
$("#btnMileageSettings").click(function () {
|
||||
if ($('#btnMileageSettings').prop('checked') == true) {
|
||||
$(".div_mileage").removeClass("hidden");
|
||||
}
|
||||
else {
|
||||
$(".div_mileage").addClass("hidden");
|
||||
$("#txtMilage_Recommended_Number").val(0);
|
||||
$("#cmbMileage_Duration_Tenure").val(0);
|
||||
$("#txtMilage_Duration_Number").val(0);
|
||||
instance.saveMileage();
|
||||
}
|
||||
});
|
||||
$("#btnMileageSettingsSave").click(function () {
|
||||
instance.saveMileage();
|
||||
});
|
||||
this.loadMileage();
|
||||
}
|
||||
render(containerid) {
|
||||
var instance = this;
|
||||
$("." + containerid).empty();
|
||||
var html = `<div class="card"><div class="bg-white card-header">
|
||||
<div class="pull-right">
|
||||
<label class="switch pull-right"><input class="WarrantySettings" type="checkbox" id="btnMileageSettings"><span></span></label>
|
||||
</div>
|
||||
<strong class="biz-highlight-bg-color">Mileage Settings</strong>
|
||||
</div>
|
||||
<div class="card-body div_mileage"><div class="row">
|
||||
<div class="col-sm-5">
|
||||
<div class="form-group floating-label-form-group floating-label-form-group-with-value">
|
||||
<label> milage as per the manufacturer</label>
|
||||
<input id="txtMilage_Recommended_Number" value="0" placeholder="milage as per the manufacturer" class="form-control required input-lg" type="text">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-1 m-t">
|
||||
<h3 class="text-center">
|
||||
OR
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-3">
|
||||
<div class="form-group floating-label-form-group floating-label-form-group-with-value">
|
||||
<label> Max Duration </label>
|
||||
<input id="txtMilage_Duration_Number" value="0" placeholder="Max Duration" class="form-control required input-lg" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-3">
|
||||
<div class="form-group m-t-lg ">
|
||||
<label class="control-label">
|
||||
Tenure
|
||||
</label>
|
||||
<select id="cmbMileage_Duration_Tenure" class="form-control inline" style="width: 100px;">
|
||||
|
||||
<option value="1">Days</option>
|
||||
<option value="2">Month</option>
|
||||
<option value="3">Year</option>
|
||||
</select>
|
||||
</div>
|
||||
</div></div>
|
||||
<div class="text-right">
|
||||
<button id="btnMileageSettingsSave" class="btn btn-info">
|
||||
Save settings
|
||||
</button>
|
||||
|
||||
|
||||
</div>
|
||||
</div>`;
|
||||
$("." + containerid).append(html);
|
||||
}
|
||||
loadMileage() {
|
||||
var instance = this;
|
||||
Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile('apps/transact/managers/inventory/itemmanager.js', function () {
|
||||
Bizgaze.Apps.Transact.Managers.ItemManager.Instance().getItemWarranty(instance.itemid).then(function (response) {
|
||||
for (let i = 0; i < response.result.length; i++) {
|
||||
if (response.result[i].SettingName == "BizgazeTransact_Items_Milage_HasMilage") {
|
||||
if (response.result[i].SettingValue == "False") {
|
||||
$("#btnMileageSettings").prop("checked", false);
|
||||
}
|
||||
else {
|
||||
$("#btnMileageSettings").prop("checked", true);
|
||||
}
|
||||
}
|
||||
if (response.result[i].SettingName == "BizgazeTransact_Items_Milage_Recommended_Number") {
|
||||
$("#txtMilage_Recommended_Number").val(response.result[i].SettingValue);
|
||||
}
|
||||
if (response.result[i].SettingName == "BizgazeTransact_Items_Milage_Duration_Number") {
|
||||
$("#txtMilage_Duration_Number").val(response.result[i].SettingValue);
|
||||
}
|
||||
if (response.result[i].SettingName == "BizgazeTransact_Items_Milage_Duration_Tenure") {
|
||||
$("#cmbMileage_Duration_Tenure").val(response.result[i].SettingValue);
|
||||
}
|
||||
}
|
||||
if ($('#btnMileageSettings').prop('checked') == false) {
|
||||
$(".div_mileage").addClass("hidden");
|
||||
}
|
||||
else {
|
||||
$(".div_mileage").removeClass("hidden");
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
saveMileage() {
|
||||
var instance = this;
|
||||
var itemId = instance.itemid;
|
||||
var hasMilage = $('#btnMileageSettings').prop('checked');
|
||||
var mileageRecommendNumber = $("#txtMilage_Recommended_Number").val();
|
||||
var mileageDuration = $("#txtMilage_Duration_Number").val();
|
||||
var mileageDurationTenure = $("#cmbMileage_Duration_Tenure").val();
|
||||
var postData = {
|
||||
ItemId: itemId,
|
||||
Milage_HasMilage: hasMilage,
|
||||
Milage_Recommended_Number: mileageRecommendNumber,
|
||||
Milage_Duration_Number: mileageDuration,
|
||||
Milage_Duration_Tenure: mileageDurationTenure
|
||||
};
|
||||
Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile('apps/transact/managers/inventory/itemmanager.js', function () {
|
||||
Bizgaze.Apps.Transact.Managers.ItemManager.Instance().saveMileage(postData).then(function (response) {
|
||||
var detail_instance = Unibase.Themes.Compact.Components.Details.Instance();
|
||||
var containerid = $("._bizgaze_detail_container:visible").attr("id");
|
||||
var _installedAppId = Unibase.Themes.Providers.DetailHelper.installedAppId;
|
||||
var portletid = detail_instance.unibase_core_activeportletid;
|
||||
detail_instance.loadWidgets(_installedAppId, portletid, "#" + containerid + "");
|
||||
MessageHelper.Instance().showSuccess(response.message, '');
|
||||
});
|
||||
});
|
||||
}
|
||||
static Instance() {
|
||||
if (this._instance === undefined)
|
||||
this._instance = new Mileagesetting();
|
||||
return this._instance;
|
||||
}
|
||||
}
|
||||
ItemDetails.Mileagesetting = Mileagesetting;
|
||||
})(ItemDetails = Controles.ItemDetails || (Controles.ItemDetails = {}));
|
||||
})(Controles = Transact.Controles || (Transact.Controles = {}));
|
||||
})(Transact = Apps.Transact || (Apps.Transact = {}));
|
||||
})(Apps = Bizgaze.Apps || (Bizgaze.Apps = {}));
|
||||
})(Bizgaze || (Bizgaze = {}));
|
||||
File diff suppressed because one or more lines are too long
+47
@@ -0,0 +1,47 @@
|
||||
var Bizgaze;(function(n){let t;(function(t){let i;(function(t){let i;(function(t){let i;(function(t){class i extends Unibase.Platform.Core.BaseComponent{cssFiles(){throw new Error("Method not implemented.");}jsFiles(){return["apps/transact/managers/inventory/itemmanager.js"]}html(){throw new Error("Method not implemented.");}load(){throw new Error("Method not implemented.");}init(n){var t=this;if(Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.length>0)for(let n of Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters)n.Key==="hf_"+Unibase.Themes.Providers.DetailHelper.installedAppId+"_itemid"&&n.Value!=null&&(t.itemid=Number(n.Value));this.render(n);$("#txtMilage_Recommended_Number").keypress(function(n){if(n.which!=8&&n.which!=0&&(n.which<48||n.which>57))return!1});$("#txtMilage_Duration_Number").keypress(function(n){if(n.which!=8&&n.which!=0&&(n.which<48||n.which>57))return!1});$("#btnMileageSettings").click(function(){$("#btnMileageSettings").prop("checked")==!0?$(".div_mileage").removeClass("hidden"):($(".div_mileage").addClass("hidden"),$("#txtMilage_Recommended_Number").val(0),$("#cmbMileage_Duration_Tenure").val(0),$("#txtMilage_Duration_Number").val(0),t.saveMileage())});$("#btnMileageSettingsSave").click(function(){t.saveMileage()});this.loadMileage()}render(n){var i=this,t;$("."+n).empty();t=`<div class="card"><div class="bg-white card-header">
|
||||
<div class="pull-right">
|
||||
<label class="switch pull-right"><input class="WarrantySettings" type="checkbox" id="btnMileageSettings"><span></span></label>
|
||||
</div>
|
||||
<strong class="biz-highlight-bg-color">Mileage Settings</strong>
|
||||
</div>
|
||||
<div class="card-body div_mileage"><div class="row">
|
||||
<div class="col-sm-5">
|
||||
<div class="form-group floating-label-form-group floating-label-form-group-with-value">
|
||||
<label> milage as per the manufacturer</label>
|
||||
<input id="txtMilage_Recommended_Number" value="0" placeholder="milage as per the manufacturer" class="form-control required input-lg" type="text">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-1 m-t">
|
||||
<h3 class="text-center">
|
||||
OR
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-3">
|
||||
<div class="form-group floating-label-form-group floating-label-form-group-with-value">
|
||||
<label> Max Duration </label>
|
||||
<input id="txtMilage_Duration_Number" value="0" placeholder="Max Duration" class="form-control required input-lg" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-3">
|
||||
<div class="form-group m-t-lg ">
|
||||
<label class="control-label">
|
||||
Tenure
|
||||
</label>
|
||||
<select id="cmbMileage_Duration_Tenure" class="form-control inline" style="width: 100px;">
|
||||
|
||||
<option value="1">Days</option>
|
||||
<option value="2">Month</option>
|
||||
<option value="3">Year</option>
|
||||
</select>
|
||||
</div>
|
||||
</div></div>
|
||||
<div class="text-right">
|
||||
<button id="btnMileageSettingsSave" class="btn btn-info">
|
||||
Save settings
|
||||
</button>
|
||||
|
||||
|
||||
</div>
|
||||
</div>`;$("."+n).append(t)}loadMileage(){var t=this;Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/transact/managers/inventory/itemmanager.js",function(){n.Apps.Transact.Managers.ItemManager.Instance().getItemWarranty(t.itemid).then(function(n){for(let t=0;t<n.result.length;t++)n.result[t].SettingName=="BizgazeTransact_Items_Milage_HasMilage"&&(n.result[t].SettingValue=="False"?$("#btnMileageSettings").prop("checked",!1):$("#btnMileageSettings").prop("checked",!0)),n.result[t].SettingName=="BizgazeTransact_Items_Milage_Recommended_Number"&&$("#txtMilage_Recommended_Number").val(n.result[t].SettingValue),n.result[t].SettingName=="BizgazeTransact_Items_Milage_Duration_Number"&&$("#txtMilage_Duration_Number").val(n.result[t].SettingValue),n.result[t].SettingName=="BizgazeTransact_Items_Milage_Duration_Tenure"&&$("#cmbMileage_Duration_Tenure").val(n.result[t].SettingValue);$("#btnMileageSettings").prop("checked")==!1?$(".div_mileage").addClass("hidden"):$(".div_mileage").removeClass("hidden")})})}saveMileage(){var t=this,i=t.itemid,r=$("#btnMileageSettings").prop("checked"),u=$("#txtMilage_Recommended_Number").val(),f=$("#txtMilage_Duration_Number").val(),e=$("#cmbMileage_Duration_Tenure").val(),o={ItemId:i,Milage_HasMilage:r,Milage_Recommended_Number:u,Milage_Duration_Number:f,Milage_Duration_Tenure:e};Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/transact/managers/inventory/itemmanager.js",function(){n.Apps.Transact.Managers.ItemManager.Instance().saveMileage(o).then(function(n){var t=Unibase.Themes.Compact.Components.Details.Instance(),i=$("._bizgaze_detail_container:visible").attr("id"),r=Unibase.Themes.Providers.DetailHelper.installedAppId,u=t.unibase_core_activeportletid;t.loadWidgets(r,u,"#"+i+"");MessageHelper.Instance().showSuccess(n.message,"")})})}static Instance(){return this._instance===undefined&&(this._instance=new i),this._instance}}t.Mileagesetting=i})(i=t.ItemDetails||(t.ItemDetails={}))})(i=t.Controles||(t.Controles={}))})(i=t.Transact||(t.Transact={}))})(t=n.Apps||(n.Apps={}))})(Bizgaze||(Bizgaze={}));
|
||||
Reference in New Issue
Block a user