Built files from Bizgaze WebServer
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

item.component.min.js 26KB

1
  1. var Unibase;(function(n){let t;(function(t){let i;(function(t){class i extends n.Platform.Core.BaseComponent{constructor(){super(...arguments);this.rowIndex=0;this.deletedItems=[];this.itemIds=[];this.SplitedInvoiceItemList=[];this.deleted_invoiceItems=[];this.container=""}init(t,r){var u=i.Instance();u.loadControlSettings(r.ControlJsonText,r.FormPropertyId);u.loadPropertySettings(r.PropertySettings,r.FormPropertyId);n.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("platform/controls/itemdetails/item.mrp.js",function(){})}loadControl(t){$("#"+t).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>');$("#btnInvoiceItem").off().click(function(){i.instance.AddRow()});i.instance.container=t;n.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("tenants/themes/default/components/details/details.js",function(){})}loadControlSettings(){return null}loadPropertySettings(){return null}bindEditFormDetails(){return null}AddRow(){var n={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:!1,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(n)}addDataRow(t){var p,s,tt,w,o,nt,l,y,u,f,ft,et,r;n.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("tenants/themes/default/components/details/details.js",function(){});this.rowIndex=$(".InvoiceItems").find(".item-addedrow").length+1;p="";t.packSize==0&&(t.packSize=1);t.packCount==0&&(t.packCount=1);t.quantity==0&&(t.quantity=t.packCount*t.packs*t.packSize);s=t.unitPrice;t.unitPrice==0&&(s=t.listPrice);tt=0;($("#hfInv_Invoicetype").val()=="PurchaseReturn"||$("#hfInv_Invoicetype").val()=="SalesReturn")&&(t.invoiceallocations=null);$("#hfInv_IsRetun").val()==1&&(t.invoiceItemId=0);w="";s==0&&(w="bg-danger");var b="",k="bg-light",a=n.Themes.Providers.Detail_Settings.Instance().RecordId;(a==0||a==undefined)&&$("#hfInv_IsRetun").val()==1&&t.itemId!=0&&($("#hfInv_Invoicetype").val()=="Sales"||$("#hfInv_Invoicetype").val()=="PurchaseReturn")&&(t.availQty==0?(t.quantity=0,b="text-danger",k="bg-danger"):t.availQty<t.quantity&&(t.quantity=t.availQty));o="";($("#hfDcId").val()!="0"||$("#hfDcId").val()=="")&&a==0&&(o="readonly");var d=!1,v="",g="",e="";!1&&d==!1&&(o="readonly",v="readonly",g="readonly",e="disabled");$("#hfInv_Invoicetype").val()=="Sales"&&!1&&d==!1&&(e="readonly");t.inventoryTypeId=="2"&&(o="",v="");var it="",rt="",ut="",h="",c=0;if(t.addlDiscountPercent>0?(c=t.addlDiscountPercent,rt="active",h="%"):t.addlDiscountValue>0&&t.DiscountGroupId>0?(c=t.addlDiscountValue,ut="active",h="Mul"):(c=t.addlDiscountValue,it="active",h="Val"),nt="floating-label-form-group",t.invoiceItemId!=0&&(nt=""),l="",t.invoiceItemId!=0&&(l="mt-5"),t.orderItemId!=0&&(l="mt-10"),t.inventoryTypeId!=5&&t.inventoryTypeId!=6&&t.inventoryTypeId!=7){y="";t.IsBoMItem==!0&&t.IsBoMItem!=undefined&&(y="hidden");u='<div id="div_itemAddedRow_'+this.rowIndex+'" class="item-row item-addedrow '+p+' form-group"><div class="row '+y+" divItemRow_"+t.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="'+t.orderItemId+'" /><input type="hidden" class="dcItemId" value="'+t.dcItemId+'" /><input type="hidden" class="selectedInvoiceItemId" value="'+t.invoiceItemId+'" /><input type="hidden" class="refInvoiceItemId" value="'+t.RefInvoiceItemId+'" /><input type="hidden" class="selectedItemId" id="hf_txtitem_'+this.rowIndex+'" value="'+t.itemId+'" /><input type="hidden" id="selectedItemId" value="'+t.itemId+'" /><input type="hidden" class="hfMrpId" value="'+t.MrpId+'" /><input type="hidden" class="offerapplied" value="0" /><input type="hidden" class="refNo" value="'+t.refNo+'"/><input type="hidden" class="description" value="'+t.description+'"/><input type="hidden" class="IsExchangeItem" value="'+t.ExchangeItem+'" /><input type="hidden" class="maxQty" value="'+t.maxQty+'" /><input type="hidden" class="hfAccountId" value="'+t.accountId+'"/><input type="hidden" class="hfItemTaxAdjsutmentVal" value="'+t.taxAdjustment+'" /><input type="hidden" class="hfItemAssesableAdjustmentVal" value="'+t.assesableAdjustment+'" /><input type="hidden" class="hfoldItemId" value="'+t.itemId+'"/><input type="hidden" class="hf_IsFoc" value="'+t.IsFoc+'"/>';t.IsFoc==!0&&(u+='<input type="hidden" class="hfOfferedItemId" value="'+t.OfferItemId+'"/>');u+='<div class="'+l+'"><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>';t.invoiceItemId!=0?(f=t.itemSKU+" - "+t.itemName,t.ExchangeItem&&(f="(Exchange) "+t.itemSKU+" - "+t.itemName),u+='<a class="default prodName-link mt-10 ItemName" href="javascript:;">'+f+"<\/a>"):(f="",t.ExchangeItem?f="(Exchange) "+t.itemName:f!=""&&t.itemSKU!=""?(f=t.itemSKU+"-"+t.itemName,u+='<a class="default prodName-link mt-10 ItemName" href="javascript:;">'+f+"<\/a>"):f!=""?(f=t.itemName,u+='<a class="default prodName-link mt-10 ItemName" href="javascript:;">'+f+"<\/a>"):u+='<select class="form-control prodName" value="" id="txt_item_'+this.rowIndex+'" placeholder=" Select the item to Invoice" style="width:100%;" id="txtItem"><\/select>');u+='<\/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 '+b+' form-control" placeholder="0.00" value="'+t.quantity+'" '+o+' /><\/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>';ft="";u+='<input type="text" class="prodPrice text-center form-control" placeholder="0.00" value="'+s+'" '+v+" />";u+='<\/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="'+t.DiscountGroupId+'" /><input type="hidden" id="hfProdDiscountGroupName" value="'+t.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="'+c+'" '+g+'><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="'+t.Adjustment+'" /><input type="hidden" class="hfAssesableAdjustment" value="" /><input type="hidden" class="hfTaxAdjustment" value="" />';$("#hfInv_Invoicetype").val()=="Purchase"||$("#hfInv_Invoicetype").val()=="PurchaseReturn"||$("#hfInv_Invoicetype").val()=="DebitNote"?(u+='<a href="javascript:;" class=Adjustmentrow><input type="text" class="hfRowTotalwithAdjustment form-control txtRowTotalwithAdjustment text-right" value="0" style="color:#5ba8fb;cursor:pointer" disabled/><\/a>',u+='<a href="javascript:;" class="hidden" onclick="javascript:_bizgazetransact_invoice_edit.editInvItemTaxAllocs('+t.invoiceItemId+","+t.taxGroupId+","+t.itemId+","+t.orderItemId+')"><input type="text" style="color:#5ba8fb;text-decoration:underline;cursor:pointer" class="hfRowTotal form-control txtRowTotal text-right" value="0" /><\/a>'):u+='<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>';u+='<\/div><\/div><div class="hidden div_MoreDetails clear mt-5 '+k+'"><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">';u+=t.taxGroupId!=0?'<select type="text" data-isdynamic="false" class="form-control ui-autocomplete prodTax required '+e+'" value="'+t.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="'+t.taxGroupId+'"/><input type="hidden" class="txtProdTax hidden" value="'+t.taxGroupName+'"/>':'<select type="text" data-isdynamic="false" class="form-control text-control required select2-hidden-accessible prodTax required '+e+'" 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=""/>';u+='<\/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>';u+=t.accountId!=0?'<select data-isdynamic="false" class="form-control txt_Account required '+e+'" data-placeholder="Account Number" placeholder="Account" data-label="Account" value="'+t.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="'+t.accountId+'" /><input type="hidden" id="txt_AccountName_'+this.rowIndex+'" class="txt_AccountName" value="'+t.accountName+'"/>':'<select data-isdynamic="false" class="form-control text-control required select2-hidden-accessible txt_Account required '+e+'" 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=""/>';u+='<\/div><\/div><div class="col-sm-3 mt-40 text-right"><label for="from_lbl_Avalilability" id="lbl_Avalilability"><b>Availability: &ensp;&ensp;<\/b><\/label><span class=" prodAvail">'+t.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="'+t.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(u);r=$(".item-addedrow:last");$("#spn_InvoiceItem_"+this.rowIndex).click(function(){i.Instance().loadMrp(r)});i.instance.itemsAutoComplete(r);$(".inv_txtaddldiscount").keypress(function(n){n.which>47&&n.which<58||n.which==46||n.which==8||n.preventDefault()}).on("paste",function(n){n.preventDefault()});$(".prodQuantity").keypress(function(n){n.which>47&&n.which<58||n.which==46||n.which==8||n.preventDefault()}).on("paste",function(n){n.preventDefault()});$(".prodPrice").keypress(function(n){n.which>47&&n.which<58||n.which==46||n.which==8||n.preventDefault()}).on("paste",function(n){n.preventDefault()});i.Instance().RemoveItem(r);r.find(".btnInvoice_DiscType option[value='"+h+"']").prop("selected",!0);r.find(".prodPrice,.prodQuantity,.inv_txtaddldiscount").focusin(function(){(r.find($(".prodName")).val()!=null||r.find($(".ItemName")).val()!=null)&&($(".div_MoreDetails").addClass("hidden"),r.find(".div_MoreDetails").removeClass("hidden"))});r.find(".prodName").focusin(function(){$(".divMoreDetails").addClass("hidden")});t.description!=null&&t.description!=""&&t.description!="null"&&r.find("#txt_Description").val(t.description);r.find("#inv_txtdiscount").change(function(){r.hasClass("SplitItem")||r.find(".btnInvoice_DiscType").val()=="%"&&Number(r.find("#inv_txtdiscount").val())>100&&r.find("#inv_txtdiscount").val("100")});!r.hasClass("SplitItem");t.TotalRowAmount!=0&&($("#hfInv_Invoicetype").val()=="Purchase"||$("#hfInv_Invoicetype").val()=="PurchaseReturn"||$("#hfInv_Invoicetype").val()=="DebitNote"?r.find(".hfRowTotalwithAdjustment").val():r.find(".prodTotalPrice").text(""));t.TotalDiscount!=0&&t.TotalDiscount!=undefined&&t.invoiceItemId!="0"&&($("#hfInv_Invoicetype").val()=="Purchase"||$("#hfInv_Invoicetype").val()=="SalesReturn"||$("#hfInv_Invoicetype").val()=="DebitNote")&&(et=r.find(".hfRowTotalwithAdjustment"),r.find(".AdjustmentRow").click(function(){}));t.IsFoc==!0&&(r.find(".delete").addClass("hidden"),r.find(".prodQuantity").prop("readonly","readonly"),r.find(".prodPrice").prop("readonly","readonly"),r.find("#inv_txtdiscount").prop("readonly","readonly"),r.find(".btnInvoice_DiscType").prop("disabled",!0),r.find(".prodQuantity").css("cursor","not-allowed"),r.find(".prodPrice").css("cursor","not-allowed"),r.find("#inv_txtdiscount").css("cursor","not-allowed"))}else r=$(".discount-addedrow:last"),t.inventoryTypeId==7&&(r=$(".netdiscount-addedrow:last"))}loadMrp(i){var r=this;n.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("platform/controls/itemdetails/item.mrp.js",function(){r.navigationHelper.popup(0,"",n.Forms.Controls.MRPDetails.Instance(),null,n.Platform.Helpers.Size.Large);t.MRPDetails.element=i;n.Forms.Controls.MRPDetails.Instance().init(i,"",2)})}loadTaxGroupAutoComplete(n){var s=n.find(".prodTax"),u=n.find(".hfProdTax"),f=n.find(".hf_Account"),h=n.find(".txt_Account"),t=n.find(".hf_Account").val(),i=n.find(".hfProdTax").val(),e=n.find(".txtProdTax").val(),o=n.find(".txt_AccountName").val(),r=_appsettings.server_url()+"/apis/v4/unibase/platform/forms/getformsautocomplete";AutoCompleteHelper.getHelper().Create("#txt_prodTax_"+this.rowIndex,u,r,function(n){var t=n});r=_appsettings.server_url()+"/apis/v4/unibase/platform/forms/getformsautocomplete";AutoCompleteHelper.getHelper().Create("#txt_Account_"+this.rowIndex,f,r,function(n){var t=n});i!=0&&($("#hf_TaxGroupId").val(i),$("#ddl_TaxGroupId option[value='"+i+"']").attr("selected","selected").length==0?$("#ddl_TaxGroupId").append(new Option(e,i,!0)):$("#ddl_TaxGroupId option[value='"+i+"']").attr("selected","selected"));t!=0&&($("#hf_AccountId").val(t),$("#ddl_AccountId option[value='"+t+"']").attr("selected","selected").length==0?$("#ddl_AccountId").append(new Option(o,t,!0)):$("#ddl_AccountId option[value='"+t+"']").attr("selected","selected"))}update_total(){var y=0,a=0,pt=0,ut=0,e=0,u=0,ft=0,oi=0,si=0,wt=0,w,b,o,t,s,kt,r,h,c,v,et,l,ot,d,st,g,dt,ht,gt,nt,ri,ct,lt,k,n,f,ei,at,vt,rt,yt;$(".expenserow-total").each(function(){var n=Number($(this).html());wt+=n});var p=0,bt=0;if($(".discount-row-total").each(function(){var n=Number($(this).html());p+=n}),$(".netdiscount-row-total").each(function(){var n=Number($(this).html());bt+=n}),w=0,b=0,$(".hfRowTotal").each(function(){var n=$(this).parents(".item-row"),i,h,t,y;if(!n.hasClass("SplitItem")){i=Number($(this).val());isNaN(i)||(b+=Number(i));var u=0,r=0,f=Number(n.find(".prodQuantity").val()),s=Number(n.find(".prodPrice").val()),e=Number(n.find(".exciseAmount").val());if(isNaN(e)&&(e=0),h=i-e,n.find(".btnInvoice_DiscType option:selected").text().trim()=="Val"&&n.find(".inv_txtaddldiscount").val()!=""&&n.find(".inv_txtaddldiscount").val()!=undefined)r=Number(n.find(".inv_txtaddldiscount").val());else if(n.find(".btnInvoice_DiscType option:selected").text().trim()=="%"&&n.find(".inv_txtaddldiscount").val()!=""&&n.find(".inv_txtaddldiscount").val()!=undefined)u=Number(n.find(".inv_txtaddldiscount").val());else if(n.find(".btnInvoice_DiscType option:selected").text().trim()=="Mul")if(n.find("#hfProdDiscountList").val()!=""||n.find("#hfProdDiscountApplyTypes").val()!=""){var c=n.find("#hfProdDiscountList").val().toString().split(","),l=n.find("#hfProdDiscountApplyTypes").val().toString().split(","),v=Number(s)*Number(f),o=Number(s)*Number(f);$.each(c,function(n){var i=c[n],u=l[n],t=0;u=="NET"||u=="1"?(t=Number(v)*Number(i)/100,o-=Number(t)):(t=Number(o)*Number(i)/100,o-=Number(t));r+=Number(t)});n.find(".inv_txtaddldiscount").val(r)}else r=Number(n.find(".inv_txtaddldiscount").val());isNaN(u)||(oi+=Number(u));isNaN(r)||(si+=Number(r));t=0;t=Number(h)*Number(u)/100+Number(f)*Number(r);w+=t;y=Number(i)-Number(t);a+=Number(t);n.find(".hfDiscountedAmount").val(t);$("#hfInv_Invoicetype").val()=="Purchase"||$("#hfInv_Invoicetype").val()=="PurchaseReturn"||$("#hfInv_Invoicetype").val()=="DebitNote"?n.find(".txtRowTotalwithAdjustment").val(i-t):n.find(".prodTotalPrice").html((i-t).toString())}}),this.SplitedInvoiceItemList.length>0)for(n=0;n<this.SplitedInvoiceItemList.length;n++){var hi=Number(this.SplitedInvoiceItemList[n].quantity*this.SplitedInvoiceItemList[n].unitPrice),r=0,ci=hi-Number(this.SplitedInvoiceItemList[n].exciseAmount);r=Number(ci)*Number(this.SplitedInvoiceItemList[n].addlDiscountPercent)/100+Number(this.SplitedInvoiceItemList[n].quantity)*Number(this.SplitedInvoiceItemList[n].addlDiscountValue);r=Number(r);b+=Number(this.SplitedInvoiceItemList[n].quantity*this.SplitedInvoiceItemList[n].unitPrice);w+=r;a+=r}if(o=0,p!=0&&(o=100*Number(p)/Number(b),o=Number(o),$("#hfOverallDiscountPercent").val(o)),t=[],$(".hfRowTotal").each(function(n){var i=$(this).parents(".item-row"),f,b,s,a,h,c,v,g,p,nt,n,ut,w;if(!i.hasClass("SplitItem")){f=Number($(this).val());b=i.find(".prodQuantity").val();isNaN(f)||(pt+=Number(f));r=Number(i.find(".hfDiscountedAmount").val())+Number(f)*Number(o)/100;s=f-r;s=Number(s);a=i.find(".hfProdTaxPercent").val();a!=undefined&&(h=a.toString().split(","));var k=Number(i.find(".hfItemAssesableAdjustmentVal").val()),d=Number(i.find(".hfItemTaxAdjsutmentVal").val());if(isNaN(d)||(e+=Number(d)),isNaN(k)||(u+=Number(k)),c=0,v=0,$("#hfId_IsTaxInclusive").val()=="true"){for(n=0;n<h.length;n++)g=h[n],p=Number(g.split(":")),isNaN(p[1])||(c+=Number(p[1]));nt=Number(Number(s)*100/(100+Number(c)));v=Number(s)-Number(nt)}if(h!=undefined)for(n=0;n<h.length;n++){var et=h[n],tt=et.split(":"),it=tt[0],rt=Number(tt[1]),l=0;$("#hfId_IsTaxInclusive").val()=="true"?l=Number(rt*v/c):(ut=Number(s)*Number(rt)/100,l=Number(ut));w=!1;$.map(t,function(n,i){n.LedgerId==it&&(w=!0,t[i].TaxAmount+=l)});w||t.push({LedgerId:it,TaxAmount:l})}y+=Number(f);ft+=Number(b)}}),this.SplitedInvoiceItemList.length>0)for(n=0;n<this.SplitedInvoiceItemList.length;n++){if(s=Number(this.SplitedInvoiceItemList[n].quantity*this.SplitedInvoiceItemList[n].unitPrice),kt=Number(this.SplitedInvoiceItemList[n].quantity),isNaN(s)||(pt+=Number(s)),r=Number(this.SplitedInvoiceItemList[n].addlDiscountValue)+Number(s)*Number(this.SplitedInvoiceItemList[n].addlDiscountPercent)/100,h=s-r,h=Number(h),c="",v=this,this.SplitedInvoiceItemList[n].TaxPercent==undefined||this.SplitedInvoiceItemList[n].TaxPercent==0?(et="",$(".SplitItem").each(function(){$(this).find(".selectedItemId").val()==v.SplitedInvoiceItemList[n].itemId&&(et=$(this),c=et.find(".hfProdTaxPercent").val())})):c=v.SplitedInvoiceItemList[n].TaxPercent,c!=undefined&&c!=""&&(l=c.split(",")),ot=v.SplitedInvoiceItemList[n].assesableAdjustment,k=v.SplitedInvoiceItemList[n].taxAdjustment,isNaN(k)||(e+=Number(k)),isNaN(ot)||(u+=Number(ot)),d=0,st=0,$("#hfId_IsTaxInclusive").val()=="true"){for(g=0;g<l.length;g++)dt=l[g],ht=dt.split(":"),isNaN(ht[1])||(d+=Number(ht[1]));gt=Number(Number(h)*100/(100+Number(d)));st=Number(h)-Number(gt)}if(l!=undefined)for(nt=0;nt<l.length;nt++){var li=l[nt],ni=li.split(":"),ti=ni[0],ii=ni[1],tt=0;$("#hfId_IsTaxInclusive").val()=="true"?tt=Number(ii*st/d):(ri=Number(h)*Number(ii)/100,tt=Number(ri));ct=!1;$.map(t,function(n,i){n.LedgerId==ti&&(ct=!0,t[i].TaxAmount+=tt)});ct||t.push({LedgerId:ti,TaxAmount:tt})}y+=Number(s);ft+=Number(kt)}for(lt=0,k=0,n=0;n<t.length;n++)isNaN(t[n].TaxAmount)||(lt+=Number(t[n].TaxAmount));isNaN(e)||(e=e);u=isNaN(u)?0:u;isNaN(u)||(y+=Number(u));ut=Number(lt)+Number(e);a+=p;var it=ut,ui=y,fi=0;isNaN(Number($("#txt_AssessableAdjustment").val()))||(fi=Number($("#txt_AssessableAdjustment").val()));f=ui-a+fi;f=f;ei=0;at=0;isNaN(Number($("#txt_TaxAdjustment").val()))||(at=Number($("#txt_TaxAdjustment").val()));it=Number(it)+Number(at);$("#totalTax").html(it);$("#grosstotal").html(ui);$("#totalItemDiscount").html(w);$("#totalDiscount").html(a);$("#totalinvoiceqty").html(ft);vt=0;isNaN(Number($("#txtOverallExpenseAmount").val()))||(vt=Number($("#txtOverallExpenseAmount").val()),$("#totalexpense").text(vt));rt=0;isNaN(Number($("#txt_Adjustment").val()))||(rt=Number($("#txt_Adjustment").val()),$("#span_Adjustment").text(rt));yt=Number(f)+Number(wt)-Number(ei)-Number(bt)+Number(rt);$("#hfId_IsTaxInclusive").val()=="false"&&(yt+=Number(it));$("#hfId_IsTaxInclusive").val()=="true"&&(f=Number(f)-Number(ut));$("#subtotal").html(f);$(".nettotal").html(yt);i.Instance().totalAdjustment()}totalAdjustment(){if($("#chk_AutoAdjustment").is(":checked")){var r=$(".nettotal").text(),t=r.split("."),n=0,i=0;isNaN(Number($("#txt_Adjustment").val()))||(n=Number($("#txt_Adjustment").val()));Number(t[1])>0&&(Number(t[1])>=50?(i=(100-Number(t[1]))/100,n+=i,$("#txt_Adjustment").val(Number(n).toFixed(2)).blur()):(i=Number(t[1])/100,n-=i,$("#txt_Adjustment").val(Number(n).toFixed(2)).blur()))}}itemsAutoComplete(t){n.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("tenants/themes/default/components/details/details.js",function(){});var e=t.find(".prodName"),o=t.find(".orderItemId"),s=t.find(".dcItemId"),r=t.find(".selectedItemId");r.val()!=0&&r.val()!=""&&(this.itemIds.push(r.val()),t.find(".hfoldItemId").val(r.val()));this.itemIds=[];var h=r,c=$("#hf_"+$("#hfLayout_InstalledPageId").val()+"_OrderId").val(),l=$("#hf_"+$("#hfLayout_InstalledPageId").val()+"_DcId").val(),u=$("#hf_"+$("#hfLayout_InstalledPageId").val()+"_InvoiceId").val();(u==undefined||u=="null")&&(u=0);var f="",f=_appsettings.server_url()+"/apis/v4/unibase/transact/items/getitems/itemids/,/lobid/100284890000001";AutoCompleteHelper.getHelper().Create("#txt_item_"+this.rowIndex,"#hf_txtitem_"+this.rowIndex,f,function(n){var t=n;i.Instance().update_total()});t.find(".div_SplitInvoiceItem").removeClass("hidden");i.instance.loadTaxGroupAutoComplete(t)}RemoveItem(n){var t=n.find(".rowIndex").val();n.find(".delete").on("click",function(){var i=n.find(".delete"),r=i.parents(".item-row").find(".selectedInvoiceItemId").val(),t;i.parents(".item-row").remove();t=1;$(".InvoiceItems").find(".item-addedrow").each(function(){$(this).find(".rowIndex").val(t);$(this).find(".selectedItemId").attr("id","hf_txtitem_"+t);$(this).find(".prodName").attr("id","txt_item_"+t);$(this).attr("id","div_itemAddedRow_"+t);t++})})}deleteRow(n,t){var r=this.deletedItems.push(t);i.instance.deleteInvoiceItem(r)}deleteInvoiceItem(n){for(var t=0;t<n.length;t++);}static Instance(){return this.instance===undefined&&(this.instance=new i),this.instance}}t.ItemDetails=i})(i=t.Controls||(t.Controls={}))})(t=n.Forms||(n.Forms={}))})(Unibase||(Unibase={}));