(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-065ca95f"],{2909:function(t,e,r){"use strict";function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,i=new Array(e);r<e;r++)i[r]=t[r];return i}function a(t){if(Array.isArray(t))return i(t)}function n(t){if("undefined"!==typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function o(t,e){if(t){if("string"===typeof t)return i(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(t,e):void 0}}function s(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function c(t){return a(t)||n(t)||o(t)||s()}r.d(e,"a",(function(){return c}))},6804:function(t,e,r){"use strict";r.r(e);var i=function(){var t=this,e=t._self._c;return e("div",[e("breadcrumbs",{staticClass:"mb-3",attrs:{breadcrumbs:t.breadcrumbs}}),e("v-container",{staticClass:"pt-0",attrs:{fluid:""}},[e("v-card",{attrs:{flat:""}},[e("v-toolbar",{staticClass:"primary lighten-2",attrs:{flat:"",dark:""}},[e("v-toolbar-title",{staticClass:"font-weight-light"},[t._v(t._s(t.$t("message.interestBilling")))])],1),e("v-toolbar",{attrs:{dense:"",flat:"",color:"grey lighten-2"}},[e("v-spacer"),t.form.fetching?[e("v-btn",{attrs:{depressed:"",color:"transparent",loading:t.form.fetching}})]:[t.allowedTo("save")&&"0"==this.closingStatus?e("v-btn",{attrs:{color:"info",depressed:"",loading:"save"==t.form.action,disabled:"save"==t.form.action},on:{click:function(e){t.showGenerateBillingConfirmDialog=!0},keydown:function(e){if(!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter"))return null;e.preventDefault()}}},[t._v(t._s(t.$t("message.generateBilling")))]):t._e()]],2),"1"==this.closingStatus?e("v-layout",{attrs:{row:"",wrap:""}},[e("v-flex",[e("v-container",{staticClass:"pa-0 px-3",attrs:{fluid:""}},[e("v-alert",{attrs:{value:!0,type:"error"}},[t._v("\n              This financial month has already been closed. You are not\n              allowed to create new, or to edit transaction for this month.\n              Please contact your administrator if further action is required.\n            ")])],1)],1)],1):t._e(),e("v-layout",{attrs:{row:"",wrap:""}},[e("v-flex",{attrs:{xl8:"",lg8:"",md8:"",sm12:""}},[e("v-container",{staticClass:"pa-3"},[e("v-layout",{attrs:{column:"",wrap:""}},[t.canEdit("fromUnit")?e("from-unit-lookup",t._b({on:{input:function(e){return t.resetItemRecords()}},model:{value:t.record.from_unit,callback:function(e){t.$set(t.record,"from_unit",e)},expression:"record.from_unit"}},"from-unit-lookup",{label:t.$t("message.fromUnit"),itemOptions:t.fromUnitOptions,dense:!0,box:!0,returnObject:!0,error:t.getValue(t.errorMessages,"")},!1)):t._e(),t.canEdit("toUnit")?e("to-unit-lookup",t._b({on:{input:function(e){return t.resetItemRecords()}},model:{value:t.record.to_unit,callback:function(e){t.$set(t.record,"to_unit",e)},expression:"record.to_unit"}},"to-unit-lookup",{label:t.$t("message.toUnit"),itemOptions:t.toUnitOptions,dense:!0,box:!0,returnObject:!0,error:t.getValue(t.errorMessages,"")},!1)):t._e(),e("v-autocomplete",{attrs:{label:t.$t("message.billingCharges"),placeholder:" ",box:"",items:t.itemChargeItemOptions,loading:t.loadingChargeItemOptions,"search-input":t.searchChargeItemOptions,clearable:"",dense:"","item-value":"id","item-text":"name","error-messages":t.getValue(t.errorMessages,"charge")},on:{"update:searchInput":function(e){t.searchChargeItemOptions=e},"update:search-input":function(e){t.searchChargeItemOptions=e},change:function(e){return t.resetItemRecords()}},model:{value:t.record.charge,callback:function(e){t.$set(t.record,"charge",e)},expression:"record.charge"}}),e("v-radio-group",{staticClass:"pa-0",attrs:{readonly:!t.canEdit("billTo"),row:"","hide-details":"","error-messages":t.getValue(t.errorMessages,"bill_to")},on:{change:function(e){return t.resetItemRecords()}},model:{value:t.record.bill_to,callback:function(e){t.$set(t.record,"bill_to",e)},expression:"record.bill_to"}},[e("v-radio",{attrs:{label:"Owner",value:"OWNER"}}),e("v-radio",{attrs:{label:"Tenant",value:"TENANT"}}),e("template",{slot:"label"},[e("span",{staticClass:"caption"},[t._v(t._s(t.$t("message.billTo")+" *"))])])],2),e("v-radio-group",{staticClass:"pa-0",attrs:{readonly:!t.canEdit("Status"),row:"","hide-details":"","error-messages":t.getValue(t.errorMessages,"tenancy_status")},on:{change:function(e){return t.resetItemRecords()}},model:{value:t.record.tenancy_status,callback:function(e){t.$set(t.record,"tenancy_status",e)},expression:"record.tenancy_status"}},[e("v-radio",{attrs:{label:"All",value:"ALL"}}),e("v-radio",{attrs:{label:"Active",value:"ACTIVE"}}),e("v-radio",{attrs:{label:"Inactive",value:"INACTIVE"}}),e("template",{slot:"label"},[e("span",{staticClass:"caption"},[t._v(t._s(t.$t("message.status")+" *"))])])],2)],1)],1)],1),e("v-flex",{attrs:{xl4:"",lg4:"",md4:"",sm12:""}},[e("v-container",{staticClass:"pa-3"},[e("v-layout",{attrs:{column:"",wrap:""}},[e("v-menu",{attrs:{"close-on-content-click":!1,"nudge-right":40,lazy:"",transition:"scale-transition","offset-y":"","full-width":"","min-width":"290px"},model:{value:t.record.posting_date_picker,callback:function(e){t.$set(t.record,"posting_date_picker",e)},expression:"record.posting_date_picker"}},[e("v-text-field",{attrs:{slot:"activator",value:t.getDateFromISO(t.record.posting_date),label:t.$t("message.invoiceDate")+" *",placeholder:" ","append-icon":"event",box:"",readonly:"",clearable:"","error-messages":t.getValue(t.errorMessages,"posting_date")},on:{input:function(e){t.record.posting_date=""}},slot:"activator"}),e("v-date-picker",{attrs:{color:"primary lighten-2"},on:{input:function(e){t.record.posting_date_picker=!1,t.resetItemRecords(),t.getMonthlyArClosingStatus(e,!0)}},model:{value:t.record.posting_date_model,callback:function(e){t.$set(t.record,"posting_date_model",e)},expression:"record.posting_date_model"}})],1),e("v-menu",{attrs:{"close-on-content-click":!1,"nudge-right":40,lazy:"",transition:"scale-transition","offset-y":"","full-width":"","min-width":"290px"},model:{value:t.record.as_to_date_picker,callback:function(e){t.$set(t.record,"as_to_date_picker",e)},expression:"record.as_to_date_picker"}},[e("v-text-field",{attrs:{slot:"activator",value:t.getDateFromISO(t.record.as_to_date),label:t.$t("message.asToDate"),placeholder:" ","append-icon":"event",box:"",readonly:"",clearable:"","error-messages":t.getValue(t.errorMessages,"as_to_date")},on:{input:function(e){t.record.as_to_date=""}},slot:"activator"}),e("v-date-picker",{attrs:{color:"primary lighten-2"},on:{input:function(e){t.record.as_to_date_picker=!1,t.resetItemRecords()}},model:{value:t.record.as_to_date_model,callback:function(e){t.$set(t.record,"as_to_date_model",e)},expression:"record.as_to_date_model"}})],1),e("v-container",{attrs:{"pa-0":"","grid-list-md":""}},[e("v-layout",{attrs:{row:"",wrap:""}},[e("v-flex",{attrs:{sm12:"",xs12:""}},[e("v-data-table",{attrs:{headers:t.summaryHeaders,items:t.itemSummary,"hide-actions":""},scopedSlots:t._u([{key:"headers",fn:function(r){return[e("tr",[t._l(r.headers,(function(r){return e("th",{key:r.text},[t._v("\n                              "+t._s(r.text)+"\n                            ")])})),e("th",{staticStyle:{width:"1%"}})],2)]}},{key:"items",fn:function(r){return[e("tr",[e("td",{staticClass:"py-3",staticStyle:{"vertical-align":"top"}},[t._v("\n                              "+t._s(t.getValue(r.item,"charge_code"))+"\n                            ")]),e("td",{staticClass:"py-3",staticStyle:{"vertical-align":"top"}},[t._v("\n                              "+t._s(t.getValue(r.item,"amount"))+"\n                            ")]),e("td",{staticClass:"py-3",staticStyle:{"vertical-align":"top"}},[t._v("\n                              "+t._s(t.getValue(r.item,"tax_amount"))+"\n                            ")]),e("td",{staticClass:"py-3",staticStyle:{"vertical-align":"top"}},[t._v("\n                              "+t._s(t.getValue(r.item,"total_amount"))+"\n                            ")])])]}}])})],1)],1)],1)],1)],1)],1)],1),e("v-toolbar",{attrs:{dense:"",flat:"",color:"grey lighten-2"}},[e("v-spacer"),[e("v-btn",{attrs:{color:"info",depressed:"",loading:t.searching},on:{click:function(e){return t.getBillingItem()}}},[t._v(t._s(t.$t("message.search"))+"\n            ")])]],2),e("v-layout",{attrs:{row:"",wrap:""}},[e("v-flex",[e("v-container",{staticClass:"pa-0 px-3",attrs:{fluid:""}},[e("v-data-table",{attrs:{headers:t.headers,items:t.itemRecords,"rows-per-page-items":[100,250,500]},scopedSlots:t._u([{key:"headers",fn:function(r){return[e("tr",[t._l(r.headers,(function(r){return e("th",{key:r.text},[t._v("\n                    "+t._s(r.text)+"\n                  ")])})),e("th",{staticStyle:{width:"1%"}})],2),e("tr",[e("td",{staticClass:"py-3",staticStyle:{"vertical-align":"top",width:"69%"}}),e("td",{staticClass:"py-3",staticStyle:{"vertical-align":"top",width:"10%"}}),e("td",{staticClass:"py-3",staticStyle:{"vertical-align":"top",width:"10%"}}),e("td",{staticClass:"py-3",staticStyle:{"vertical-align":"top",width:"10%"}},[e("v-text-field",{attrs:{placeholder:" ",suffix:"day(s)",box:"","background-color":"transparent"},on:{input:function(e){return t.updateGracePeriod(e,!0)}},model:{value:t.gracePeriod,callback:function(e){t.gracePeriod=e},expression:"gracePeriod"}})],1),e("td",{staticStyle:{width:"1%"}})])]}},{key:"items",fn:function(r){return[e("tr",[e("td",{staticClass:"py-3",staticStyle:{"vertical-align":"top",width:"69%"}},[e("div",[t._v(t._s(t.getValue(r.item,"unit_no")))]),e("div",[t._v(t._s(t.getValue(r.item,"name")))])]),e("td",{staticClass:"py-3",staticStyle:{"vertical-align":"top",width:"10%"}},[e("v-text-field",{attrs:{value:t.formatNumber(t.getValue(r.item,"amount")).format("0,0.00"),placeholder:" ",box:"","background-color":"transparent",readonly:""}})],1),e("td",{staticClass:"py-3",staticStyle:{"vertical-align":"top",width:"10%"}},[e("v-text-field",{attrs:{value:t.formatNumber(t.getValue(r.item,"tax_amount")).format("0,0.00"),placeholder:" ",box:"","background-color":"transparent",readonly:""}})],1),e("td",{staticClass:"py-3",staticStyle:{"vertical-align":"top",width:"10%"}},[e("v-text-field",{attrs:{value:t.formatNumber(t.getValue(r.item,"grace_period")).format("0"),placeholder:" ",suffix:"day(s)",box:"","background-color":"transparent",readonly:""}})],1),e("td",{staticClass:"py-3",staticStyle:{"vertical-align":"top",width:"1%"}},["view"!=t.mode?e("v-btn",{attrs:{flat:"",icon:"",color:"pink"},on:{click:function(e){return t.onDeleteClick(r.item)}}},[e("v-icon",[t._v("delete")])],1):t._e()],1)])]}}])})],1)],1)],1)],1)],1),e("snackbar",{attrs:{snackbar:t.snackbar}}),e("v-dialog",{attrs:{width:"500"},model:{value:t.showGenerateBillingConfirmDialog,callback:function(e){t.showGenerateBillingConfirmDialog=e},expression:"showGenerateBillingConfirmDialog"}},[e("v-card",[e("v-card-title",{staticClass:"headline primary lighten-2",attrs:{"primary-title":""}},[t._v("\n        "+t._s(t.$t("message.generateBilling"))+"\n      ")]),e("v-card-actions",[e("v-btn",{attrs:{depressed:""},on:{click:function(e){t.showGenerateBillingConfirmDialog=!1}}},[t._v("\n          "+t._s(t.$t("message.cancel"))+"\n        ")]),e("v-spacer"),e("v-btn",{attrs:{color:"primary",depressed:""},on:{click:t.saveData}},[t._v("\n          "+t._s(t.$t("message.confirm"))+"\n        ")])],1)],1)],1),e("v-dialog",{attrs:{persistent:"","max-width":"290"},model:{value:t.generateSuccessDialog,callback:function(e){t.generateSuccessDialog=e},expression:"generateSuccessDialog"}},[e("v-card",[e("v-card-text",[t._v("Invoice Successfully Generated")]),e("v-card-actions",[e("v-spacer"),e("v-btn",{attrs:{color:"primary",text:""},on:{click:function(e){return t.echoSuccess("generate")}}},[t._v("\n          OK\n        ")])],1)],1)],1),e("v-dialog",{attrs:{persistent:"","max-width":"290"},model:{value:t.progressBox,callback:function(e){t.progressBox=e},expression:"progressBox"}},[e("v-card",[e("v-container",[t._v("\n            Please wait\n            "),e("v-progress-linear",{attrs:{color:"deep-purple accent-4",indeterminate:"",rounded:"",height:"6"}})],1)],1)],1)],1)},a=[],n=(r("8e6e"),r("456d"),r("ac6a"),r("5df3"),r("4f7f"),r("2909")),o=(r("6b54"),r("a481"),r("7f7f"),r("ade3")),s=r("365c"),c=r("2f62"),l=r("4da1"),d=r("323e"),u=r.n(d),m=(r("7fb5"),r("1dce")),g=r("c1df"),h=r.n(g),f=r("45a3"),p=r("5e44"),_=r("8106"),v=r("aa27");function b(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,i)}return r}function y(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?b(Object(r),!0).forEach((function(e){Object(o["a"])(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):b(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var O=r("4328"),w={mixins:[m["validationMixin"]],validations:{},constants:{},created:function(){var t=this;window.Echo.channel("generate-invoice."+this.uuid).listen(".GenerateInvoice",(function(e){t.form.fetching=!1,t.progressBox=!1,t.generateSuccessDialog=!0})),this.record=Object.assign({},this.defaultRecord),"new"==this.recordId&&(this.mode="new"),this.getChargeItemOptions()},components:{Breadcrumbs:p["a"],Snackbar:_["a"],ConfirmDialog:f["a"],FromUnitLookup:v["a"],ToUnitLookup:v["a"]},computed:y(y({},Object(c["b"])(["adminScope","mySession"])),{},{breadcrumbs:function(){var t=[{text:this.$t("message.interestBilling"),disabled:!1,to:{name:"admin.financial-ar.billing.interest-billing"}}];return t.push({text:(this.recordId,"New"),disabled:!0}),t},locked:function(){return this.record.locked},uuid:function(){return this.$uuid.v1().substring(0,13)},itemChargeItemOptions:function(){return this.entryChargeItemOptions.map((function(t){var e=t.code+" - "+t.name;return Object.assign({},t,{name:e})}))}}),watch:{$route:function(t,e){this.recordId="new",this.record=Object.assign({},this.defaultRecord),"new"==this.recordId&&(this.mode="new")},searchChargeItemOptions:function(t){this.itemChargeItemOptions.length>0||this.loadingChargeItemOptions||(this.loadingChargeItemOptions=!0,this.getChargeItemOptions())},"record.billing_period_from_model":function(t){t&&(this.record.billing_period_from=h()(t).format())},"record.billing_period_to_model":function(t){t&&(this.record.billing_period_to=h()(t).format())},"record.invoice_date_model":function(t){t&&(this.record.invoice_date=h()(t).format())},"record.posting_date_model":function(t){t&&(this.record.posting_date=h()(t).format())},"record.as_to_date_model":function(t){t&&(this.record.as_to_date=h()(t).format())}},methods:{getValue:function(t,e){return Object(l["j"])(t,e)},getDateTimeFromISO:function(t,e){return Object(l["g"])(t,e)},getDateFromISO:function(t,e){return Object(l["e"])(t,e)},convertDateToISO:function(t,e){return Object(l["a"])(t,e)},getDateFromUnixTime:function(t,e){return Object(l["f"])(t,e)},formatNumber:function(t,e){return Object(l["c"])(t,e)},removeFormatNumber:function(t){return Object(l["l"])(t)},allowedTo:function(t){switch(t){case"add":return!this.$can.not("add","acl.admin.financial-ar.billings.interest-billing");case"delete":if(this.$can.not("add","acl.admin.financial-ar.billings.interest-billing")&&this.$can.not("delete","acl.admin.financial-ar.billings.interest-billing"))return!1;if("new"==this.mode)return!1;if("new"!=this.recordId)return!this.record.locked;break;case"save":if(this.$can.not("add","acl.admin.financial-ar.billings.interest-billing")&&this.$can.not("edit","acl.admin.financial-ar.billings.interest-billing"))return!1;if("new"==this.mode||"edit"==this.mode)return!0;break;case"edit":return(!this.$can.not("add","acl.admin.financial-ar.billings.interest-billing")||!this.$can.not("edit","acl.admin.financial-ar.billings.interest-billing"))&&("new"!=this.recordId&&"edit"!=this.mode);case"cancel":if("new"!=this.recordId&&"edit"==this.mode)return!0;break}return!1},canEdit:function(t){var e=!1;switch(e="edit"==this.mode||"new"==this.mode,t){default:break}return e},onCancel:function(){this.errorMessages=null,this.mode="view"},onDeleteClick:function(t){this.itemRecords.splice(this.itemRecords.indexOf(t),1),this.itemSummary=this.getTotal(this.itemRecords)},getDateInput:function(t){return t?h()(t).unix():""},saveData:function(){var t=this;u.a.start(),this.form.loading=!0,this.form.fetching=!0,this.form.action="save",this.errorMessages=null,this.showGenerateBillingConfirmDialog=!1,this.progressBox=!0,this.record.project_id||(this.record.project_id=this.adminScope.projectId),this.record.company_id||(this.record.company_id=this.adminScope.companyId),this.record.my_username=this.mySession.username,"NONE"==this.record.merge_invoice&&(this.itemRecords=this.resetUniqueId(this.itemRecords)),"MONTH"==this.record.merge_invoice&&(this.itemRecords=this.getAdditionalUniqueId(this.itemRecords)),this.record.invoice_items=this.itemRecords.length>0?this.itemRecords:[],this.record.uuid=this.uuid;var e="admin/financial/ar/billing/interest-billing";s["a"].post(e,this.record).then((function(e){t.snackbar.message=Object(l["j"])(e,"data.message"),t.snackbar.type="success",t.snackbar.show=!1,t.mode="edit",t.record=Object.assign({},t.defaultRecord),t.itemRecords=[],t.itemSummary=[],t.uniqueid=null,t.$router.replace({name:"admin.financial-ar.billing.interest-billing",params:{invoiceId:"new"}})})).catch((function(e){t.snackbar.message=Object(l["j"])(e,"response.data.message"),t.snackbar.type="error",t.snackbar.show=!0,t.errorMessages=Object(l["j"])(e,"response.data.errors")})).then((function(){u.a.done(),t.form.loading=!1,t.form.action=null,t.showGenerateBillingConfirmDialog=!1}))},getChargeItemOptions:function(){var t=this;s["a"].get("admin/lookup/interest-charge-item/",{params:{project_id:this.adminScope.projectId,company_id:this.adminScope.companyId}}).then((function(e){var r=e.data.data;t.entryChargeItemOptions=r})).catch((function(t){})).finally((function(){return t.loadingChargeItemOptions=!1}))},getBillingItem:function(){var t=this;u.a.start(),this.form.loading=!0,this.form.fetching=!0,this.errorMessages=null,this.searching=!0,this.record.invoice_date="",this.record.billing_period_from="",this.record.billing_period_to="",this.prorate="",this.gracePeriod="",this.lpiGracePeriod="",this.interest="";var e=Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),r=h()(new Date);r=r.valueOf(),this.uniqueid=e+r,s["a"].get("admin/financial/ar/billing/interest-billing/search",{params:{from_unit:this.record.from_unit,to_unit:this.record.to_unit,charge:this.record.charge,bill_to:this.record.bill_to,tenancy_status:this.record.tenancy_status,posting_date:this.record.posting_date,as_to_date:this.record.as_to_date,period:this.record.period,project_id:this.adminScope.projectId,company_id:this.adminScope.companyId},paramsSerializer:function(t){return O.stringify(t,{indices:!1})}}).then((function(e){var r=e.data.data;t.itemRecords=r,t.itemRecords=t.getUniqueId(t.itemRecords),t.itemRecords=t.reformatPaidAmount(t.itemRecords),t.itemRecords=t.reformatTaxPaidAmount(t.itemRecords),t.itemSummary=t.getTotal(t.itemRecords)})).catch((function(e){t.errorMessages=Object(l["j"])(e,"response.data.errors")})).then((function(){u.a.done(),t.form.fetching=!1,t.form.loading=!1,t.searching=!1})).finally()},getUniqueId:function(t){var e=this,r=t.map((function(t){t.uniqueid=e.uniqueid;var r=Date.now()+Math.random().toString();return t.uuidchecker=r,t}));return r},getAdditionalUniqueId:function(t){var e=t.map((function(t){return t.uniqueid=t.uniqueid+t.invoice_date,t}));return e},resetUniqueId:function(t){var e=t.map((function(t){var e=Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),r=h()(new Date);return r=r.valueOf(),t.uniqueid=e+r,t}));return e},reformatPaidAmount:function(t){var e=t.map((function(t){return t.amount=Object(l["c"])(t.amount).format("0,0.00"),t}));return e},reformatTaxPaidAmount:function(t){var e=t.map((function(t){return t.tax_amount=Object(l["c"])(t.tax_amount).format("0,0.00"),t}));return e},getTotal:function(t){var e=Object(n["a"])(new Set(t.map((function(t){return t.charge_id})))),r=[];return e.forEach((function(e,i){var a=0,n=0,o=null;t.forEach((function(t){e==t.charge_id&&(a+=Object(l["l"])(t.amount),n+=Object(l["l"])(t.tax_amount),o=t.charge_code)})),r.push({charge_id:e,charge_code:o,amount:Object(l["c"])(a).format("0,0.00"),tax_amount:Object(l["c"])(n).format("0,0.00"),total_amount:Object(l["c"])(a+n).format("0,0.00")})})),r},updateInterest:function(t){var e=this;this.interest=Object(l["l"])(t),this.itemRecords.forEach((function(t){t.interest=e.interest}))},updateGracePeriod:function(t){var e=this;this.gracePeriod=Object(l["l"])(t),this.itemRecords.forEach((function(t){t.grace_period=e.gracePeriod}))},updateInvoiceDate:function(t){var e=this;this.record.invoice_date=h()(t).unix(),this.itemRecords.forEach((function(t){t.invoice_date=e.record.invoice_date}))},updateBillingPeriodFrom:function(t){var e=this;this.record.billing_period_from=h()(t).unix(),this.itemRecords.forEach((function(t){t.billing_period_from=e.record.billing_period_from,e.getProrateAmount(t)}))},updateBillingPeriodTo:function(t){var e=this;this.record.billing_period_to=h()(t).unix(),this.itemRecords.forEach((function(t){t.billing_period_to=e.record.billing_period_to,e.getProrateAmount(t)}))},prorateAmount:function(){var t=this;this.itemRecords.forEach((function(e){t.getProrateAmount(e)}))},getProrateAmount:function(t){if(this.prorate){var e=h()(Object(l["f"])(t.billing_period_to)),r=h()(Object(l["f"])(t.billing_period_from)),i=r.daysInMonth(),a=h.a.duration(e.diff(r)),n=a.asDays()+1,o=t.orig_amount;t.amount=o/i*n}else t.amount=t.orig_amount;this.itemSummary=this.getTotal(this.itemRecords)},getAmount:function(t){var e=this,r=Object(l["l"])(t.current_reading)-Object(l["l"])(t.old_reading);s["a"].get("admin/financial/ar/billing/interest-billing/calculate-amount",{params:{usage:r,tax_type:t.tax_type,tax_rate:t.tax_rate,minimum_payment:t.minimum_payment,charge:this.record.charge,project_id:this.adminScope.projectId,company_id:this.adminScope.companyId},paramsSerializer:function(t){return O.stringify(t,{indices:!1})}}).then((function(r){var i=r.data.data;t.amount=Object(l["c"])(Object(l["j"])(i,"amount")).format("0,0.00"),t.tax_amount=Object(l["c"])(Object(l["j"])(i,"tax_amount")).format("0,0.00"),e.itemSummary=e.getTotal(e.itemRecords)})).catch((function(t){})).finally()},resetItemRecords:function(){this.itemRecords=[],this.itemSummary=[],this.record.invoice_date="",this.record.billing_period_from="",this.record.billing_period_to="",this.prorate="",this.gracePeriod="",this.lpiGracePeriod="",this.interest=""},getMonthlyArClosingStatus:function(t){var e=this;s["a"].get("admin/lookup/get-ar-monthly-closing-status",{params:{date:t,project_id:this.adminScope.projectId,company_id:this.adminScope.companyId}}).then((function(t){var r=t.data.data;e.closingStatus=r})).catch((function(t){})).finally()},echoSuccess:function(t){this.generateSuccessDialog=!1,this.$router.go()}},data:function(){return{recordId:this.$route.params.invoiceId,record:{},itemRecords:[],itemSummary:[],charges:[],uniqueid:null,prorate:!1,gracePeriod:null,interest:null,closingStatus:"0",defaultRecord:{period:1,merge_invoice:"ALL",invoice_date:"",billing_period_from:"",billing_period_to:"",tenancy_status:"ALL"},fromUnitOptions:[],toUnitOptions:[],mode:"edit",showConfirmDeleteRecord:!1,searching:!1,showGenerateBillingConfirmDialog:!1,generateSuccessDialog:!1,progressBox:!1,form:{fetching:!1,loading:!1,action:null},snackbar:{show:!1,type:null,message:null},errorMessages:null,entryChargeItemOptions:[],loadingChargeItemOptions:!1,searchChargeItemOptions:null,headers:[{text:this.$t("message.unitNo")+"/"+this.$t("message.name"),align:"left",width:"69%"},{text:this.$t("message.amount"),align:"left",width:"10%"},{text:this.$t("message.taxAmount"),align:"left",width:"10%"},{text:this.$t("message.gracePeriod"),align:"left",width:"10%"}],summaryHeaders:[{text:this.$t("message.chargeCode"),align:"left"},{text:this.$t("message.amount"),align:"left"},{text:this.$t("message.taxAmount"),align:"left"},{text:this.$t("message.totalAmount"),align:"left"},{}]}}},x=w,k=r("2877"),S=Object(k["a"])(x,i,a,!1,null,null,null);e["default"]=S.exports}}]);