text: (window.webpackJsonp=window.webpackJsonp||[]).push([[232],{1307:function(t,n,a){"use strict";a.r(n);var s=a(2),e=a.n(s),i=a(0);e.a.component(i.HasError.name,i.HasError);var r={created:function(){this.purchaseDetails(),this.$store.dispatch("general_setting")},data:function(){return{sale:"",details:"",error:"",loading:!0,base_url:this.$store.state.image_base_link}},methods:{purchaseDetails:function(){var t=this;axios.get("/sale/view/"+this.$route.params.id).then((function(n){console.log(n),"SUCCESS"==n.data.status?(t.sale=n.data.sale,t.details=n.data.items,t.loading=!1):t.$toasted.show("some thing want to wrong",{type:"error",position:"top-center",duration:5e3})})).catch((function(n){console.log(n),t.$toasted.show("some thing want to wrong",{type:"error",position:"top-center",duration:4e3})}))},formatDate:function(t){console.log(t);var n=t.split(" ")[0].split("-");return"".concat(n[2],"-").concat(n[1],"-").concat(n[0])},print:function(t){window.open("/api/print/sale/invoice/"+t,"_blank")},back:function(){window.history.back()},totalQuantity:function(){var t=0;return this.details.forEach((function(n){1==n.status&&(t+=parseInt(n.qty))})),t},saleAmount:function(){var t=0;return this.details.forEach((function(n){1==n.status&&(t+=parseInt(n.price)*parseInt(n.qty))})),t},exchangeAmount:function(){var t=0;return this.details.forEach((function(n){2==n.status&&(t+=parseInt(n.price)*parseInt(n.qty))})),t}},computed:{general_setting:function(){return this.$store.getters.general_setting}}},o=(a(784),a(1)),l=Object(o.a)(r,(function(){var t=this,n=t.$createElement,a=t._self._c||n;return a("div",[a("admin-main"),t._v(" "),a("div",{staticClass:"content-wrapper"},[a("section",{staticClass:"content-header"}),t._v(" "),a("section",{staticClass:"content"},[a("div",{staticClass:"container"},[a("div",{staticClass:"row justify-content-center"},[a("div",{staticClass:"col-lg-11"},[a("div",{staticClass:"box box-primary"},[a("div",{staticClass:"box-header"}),t._v(" "),a("div",{staticClass:"box-body"},[a("div",{staticClass:"row print_info_container"},[a("div",{staticClass:"col-md-1 col-sm-1"}),t._v(" "),a("div",{staticClass:"col-md-3 col-sm-3 description"},[1==t.sale.sale_type?a("div",[a("p",[t._v("Name: "+t._s(t.sale.name?t.sale.name:"customer"))]),t._v(" "),a("p",[t._v("\n                        Mobile No: "),a("strong",[t._v(" "+t._s(t.sale.mobile_no)+" ")])]),t._v(" "),a("p",{staticClass:"address_line"},[t._v("Address: "+t._s(t.sale.address))]),t._v(" "),a("p",[t._v("\n                        Invoice No:\n                        "),a("strong",[t._v(" "+t._s("S-"+t.sale.id))])])]):t._e(),t._v(" "),2==t.sale.sale_type?a("div",[a("p",[t._v("Name: "+t._s(t.sale.company?t.sale.company.name:"company"))]),t._v(" "),a("p",[t._v("\n                        Mobile No: "),a("strong",[t._v(" "+t._s(t.sale.company.phone?t.sale.company.phone:"phone  not added")+" ")])]),t._v(" "),a("p",{staticClass:"address_line"},[t._v("Address: "+t._s(t.sale.company.address?t.sale.company.address:"address not added"))]),t._v(" "),a("p",[t._v("\n                        Invoice No:\n                        "),a("strong",[t._v(" "+t._s("S-"+t.sale.id))])])]):t._e()]),t._v(" "),a("div",{staticClass:"col-md-3 col-sm-3 logo"},[a("img",{staticClass:"m_logo",attrs:{src:t.base_url+t.general_setting.logo,alt:"logo"}})]),t._v(" "),a("div",{staticClass:"col-md-4 col-sm-4 address",staticStyle:{"margin-left":"27px"}},[a("p",{staticClass:"address_line",domProps:{innerHTML:t._s(t.general_setting.invoice_address_details)}}),t._v(" "),a("p",[t._v("\n                      Date:"),a("strong",[t._v(" "+t._s(t.sale.created_at))])])]),t._v(" "),a("div",{staticClass:"col-md-1 col-sm-1"})]),t._v(" "),a("div",{staticClass:"row"},[a("div",{staticClass:"col-lg-1"}),t._v(" "),t.loading?a("h1",[a("i",{staticClass:"fa fa-spin fa-spinner"})]):a("div",{staticClass:"col-lg-10"},[a("table",{staticClass:"table"},[t._m(0),t._v(" "),a("tbody",[t._l(t.details,(function(n,s){return a("tr",{key:s},[a("td",[t._v(t._s(s+1))]),t._v(" "),a("td",[t._v("\n                            "+t._s(n.product.name)+"\n                            "),2==n.status?a("small",{staticClass:"badge"},[t._v("\n                              - exchange")]):t._e()]),t._v(" "),a("td",[t._v(t._s(n.product.product_code))]),t._v(" "),a("td",[t._v(t._s(n.qty))]),t._v(" "),a("td",[t._v(t._s(n.price))]),t._v(" "),a("td",[a("span",{class:{"text-danger":2==n.status}},[t._v(t._s(n.total))])])])})),t._v(" "),2==t.sale.status?a("tr",[a("td",{attrs:{colspan:"4"}}),t._v(" "),t._m(1),t._v(" "),a("td",[a("b",[t._v(t._s(t.saleAmount()))])])]):t._e(),t._v(" "),2==t.sale.status?a("tr",[a("td",{attrs:{colspan:"4"}}),t._v(" "),t._m(2),t._v(" "),a("td",[a("b",[t._v(t._s(t.exchangeAmount()))])])]):t._e(),t._v(" "),a("tr",[a("td",{attrs:{colspan:"3"}}),t._v(" "),a("td",[a("strong",[t._v(" = "+t._s(t.totalQuantity()))])]),t._v(" "),t._m(3),t._v(" "),a("td",[a("b",[t._v(t._s(t.sale.total))])])]),t._v(" "),a("tr",[a("td",{attrs:{colspan:"4"}}),t._v(" "),t._m(4),t._v(" "),a("td",[a("b",[t._v(t._s(t.sale.discount))])])]),t._v(" "),a("tr",[a("td",{attrs:{colspan:"4"}}),t._v(" "),t._m(5),t._v(" "),a("td",[a("b",[t._v(t._s(t.sale.paid))])])]),t._v(" "),a("tr",[a("td",{attrs:{colspan:"4"}}),t._v(" "),t._m(6),t._v(" "),a("td",[a("b",[t._v(t._s(parseInt(t.sale.total)-parseInt(t.sale.paid)-parseInt(t.sale.discount)))])])])],2)])])]),t._v(" "),a("div",{directives:[{name:"show",rawName:"v-show",value:2==t.sale.status,expression:"sale.status==2"}],staticClass:"row exchange-memo"},[a("img",{attrs:{src:t.base_url+"images/static/exchange.png",alt:""}})]),t._v(" "),t._m(7),t._v(" "),a("div",{staticClass:"bottomBtn"},[a("button",{staticClass:"btn btn-success print",on:{click:function(n){return t.print(t.sale.id)}}},[a("i",{staticClass:"fa fa-print"})]),t._v(" "),a("button",{staticClass:"btn btn-warning back",on:{click:t.back}},[a("i",{staticClass:"fa fa-arrow-circle-right"})])])])])])])])])])],1)}),[function(){var t=this,n=t.$createElement,a=t._self._c||n;return a("thead",[a("tr",[a("th",[t._v("#")]),t._v(" "),a("th",[t._v("Product")]),t._v(" "),a("th",[t._v("Product_code")]),t._v(" "),a("th",[t._v("Quntity")]),t._v(" "),a("th",[t._v("Price")]),t._v(" "),a("th",[t._v("Total")])])])},function(){var t=this.$createElement,n=this._self._c||t;return n("td",[n("b",[this._v("Sale Amount")])])},function(){var t=this.$createElement,n=this._self._c||t;return n("td",[n("b",[this._v("Exchnage Amount")])])},function(){var t=this.$createElement,n=this._self._c||t;return n("td",[n("b",[this._v("Total Amount")])])},function(){var t=this.$createElement,n=this._self._c||t;return n("td",[n("b",[this._v("Discount")])])},function(){var t=this.$createElement,n=this._self._c||t;return n("td",[n("b",[this._v("Paid")])])},function(){var t=this.$createElement,n=this._self._c||t;return n("td",[n("b",[this._v("Amount Due")])])},function(){var t=this.$createElement,n=this._self._c||t;return n("div",{staticClass:"row"},[n("div",{staticClass:"col-lg-2",staticStyle:{"margin-left":"27px","text-align":"center"}},[n("h5",{staticStyle:{"border-top":"2px dotted #000","margin-top":"30px"}},[n("strong",[this._v("Accounts")])])])])}],!1,null,"105847b6",null);n.default=l.exports},220:function(t,n,a){var s=a(785);"string"==typeof s&&(s=[[t.i,s,""]]);var e={hmr:!0,transform:void 0,insertInto:void 0};a(5)(s,e);s.locals&&(t.exports=s.locals)},784:function(t,n,a){"use strict";var s=a(220);a.n(s).a},785:function(t,n,a){(t.exports=a(4)(!1)).push([t.i,"\n.mb-2[data-v-105847b6] {\r\n  margin-bottom: 5px !important;\n}\n.bottomBtn[data-v-105847b6] {\r\n  margin-top: 15px;\r\n  margin-left: 20px;\n}\n.head_title[data-v-105847b6] {\r\n  margin-left: 27px;\r\n  margin-top: -12px;\n}\n.address_line[data-v-105847b6] {\r\n  line-height: 15px;\n}\np[data-v-105847b6] {\r\n  line-height: 11px;\r\n  font-size: 14px;\n}\n.m_logo[data-v-105847b6] {\r\n  margin-left: 25px;\r\n  margin-top: -21px;\r\n  height: 80px;\n}\n.m_title[data-v-105847b6] {\r\n  margin-top: -15px;\r\n  font-size: 11px;\n}\ntable[data-v-105847b6] {\r\n  margin-top: 10px;\n}\n@media print {\n.address_line[data-v-105847b6] {\r\n  line-height: 15px;\r\n  text-align: left;\n}\ntable[data-v-105847b6] {\r\n    margin-top: 0px !important;\n}\n.m_title[data-v-105847b6] {\r\n    margin-top: -15px;\r\n    font-size: 10px;\n}\n.navbar[data-v-105847b6] {\r\n    display: none;\n}\n.print_info_container[data-v-105847b6] {\r\n    display: flex;\r\n    flex-direction: row;\r\n    position: relative;\r\n    width: 100%;\r\n    padding: 10px 10px !important;\r\n    margin-top: -15px;\n}\n.col-sm-1[data-v-105847b6] {\r\n    display: none;\n}\np[data-v-105847b6] {\r\n    line-height: 8px;\r\n    font-size: 14px;\n}\n.logo[data-v-105847b6] {\r\n    width: 40% !important;\n}\n.description[data-v-105847b6] {\r\n    width: 40% !important;\n}\n.col-lg-2[data-v-105847b6] {\r\n    width: 20% !important;\r\n    margin-top: 20px !important;\n}\n.invoice-header[data-v-105847b6] {\r\n    display: block;\n}\n.box[data-v-105847b6] {\r\n    border-top: none;\n}\nfooter[data-v-105847b6] {\r\n    border-top: none !important;\n}\n.bottomBtn[data-v-105847b6] {\r\n    display: none;\n}\n.address[data-v-105847b6] {\r\n    text-align: right;\n}\n}\n.exchange-memo[data-v-105847b6] {\r\n    position: absolute;\r\n    left: 25%;\r\n    top: 43%;\n}\r\n",""])}}]);