1 //<script type="text/javascript">
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
5 Roo.namespace('Pman.Dialog');
7 Pman.Dialog.XtupleSalesOrder = {
10 '58ec392a138714456f83d1288f553099' :"tracknum",
11 '42f6d99a2dddc4858882ed8e9a210b52' :"Invoice #",
12 '249ff431aa95198ad6814dd1d2799883' :"Select taxtype",
13 'fce9a6a1bd2a2050eb86d33103f46fd3' :"Invoices",
14 'a2fdeac60e3c5b6c51a92e027fb9d533' :"Target Delivery",
15 '96b0141273eabab320119c467cdcaf17' :"Total",
16 'd682c376c82f68bc65dcd05570d04dfc' :"Payments / Refunds / Credit Memos",
17 '75ba8d70e3692ba200f0e0df37b4d2ae' :"IP address",
18 '9f4f3d35db49c5c2bba70a321a42fa87' :"Find Products",
19 '9d4ba8f5211a3ba238b2032be5991c14' :"Disc%",
20 'e12167aa0a7698e6ebc92b4ce3909b53' :"To",
21 'c4a0f4ddf926328daa2a350db9f9ca00' :"Qty Changed",
22 '99575a08540e6ee585a7b389e8bde351' :"GL Tx",
23 'ec211f7c20af43e742bf2570c3cb84f9' :"Add",
24 'f84e65035f5d2d4a090b8a626c822321' :"List Price",
25 'fc44040a63559bee1157010d4c602422' :"Select location",
26 '62f0de97dd70387d493350e45bfa5583' :"Send Delivery Email",
27 'cc7819055cde3194bb3b136bad5cf58d' :" ",
28 '806dca90dbeda894ffb258939f9fef9a' :"Fill empty Ship To",
29 'fce6d3795b41b54dc0dab82df50517c1' :"Select custinfo",
30 'd323a19bad62ff427d0b75dc52674c81' :"#Ret",
31 'c5eae6ea505388a73962c635ac821fba' :"SubTotal",
32 'f2a6c498fb90ee345d997f888fce3b18' :"Delete",
33 '418c5509e2171d55b0aee5c2ea4442b5' :"action",
34 '51e07f52ae2192d23a1b43922e5beb90' :"#TX ship",
35 '607ff05a0e4c02c54b2262cd2e381aff' :"Reserve Stock / Shipments",
36 '689202409e48743b914713f96d93947c' :"Value",
37 'd9db367d7e9d6a3d3ca0346dfa1ff9d2' :"Item Description",
38 '16d2b386b2034b9488996466aaae0b57' :"History",
39 'dd7bf230fde8d4836917806aff6a6b27' :"Address",
40 '986b90fb419e5349dd59b691b0e0e9f6' :"Customer PO#",
41 '7d74f3b92b19da5e606d737d339a9679' :"Item",
42 'c5c8ac6bbc6d7f5c95d0a888527554d3' :"Order Details",
43 'fd216b286b94577ac68c112c0dcaf341' :"TX#",
44 '068f80c7519d0528fb08e82137a72131' :"Products",
45 'b166cb3a96bdb966f3288b8599594d0d' :"Sell @",
46 '1243daf593fa297e07ab03bf06d925af' :"Searching...",
47 '151ccf95db9b81c11bb20fbc302af4b6' :"Select terms",
48 '7eb17faabef94701775df7154f30684b' :"#avail",
49 'f31bbdd1b3e85bccd652680e16935819' :"Source",
50 '086247a9b57fde6eefee2a0c4752242d' :"Automatic",
51 '0a90b1bc4078f74b6f0d117ec7df65af' :"Credit",
52 '27f2870eaa01c99fc83105240ad15f7f' :"Delete All",
53 '5f0c1431b38e3d279bf105d48824b7f3' :"Select ship to",
54 '26453198f2ddac444702879a8f6d61a5' :"Auto Reverse",
55 '780c462e85ba4399a5d42e88f69a15ca' :"Billing",
56 '81dffdb31b9576e343d3f7ffcf721d7e' :"Cost of goods",
57 '813f81532d71077e497863ec9faf16c7' :"Confirm Shipment",
58 '46fc12727bf2c5cc79988ab857ad73b4' :"Print Shipping / Commercial Invoice",
59 '8156649b9de8783c15c822b592c3bac6' :"Reverse Selected",
60 '8c6aab77edc5b8e589b36bcf989683e4' :"Print Picking Slip",
61 '69193f49683ba5a928ae8a27328105ba' :"Print Aus - GST included Invoice",
62 '13dba24862cf9128167a59100e154c8d' :"Print",
63 '4b5a5a93e13bd338d40cf4bae2ca51cb' :"Void Credit Memo",
64 'b80f4ed22929b09103f0c5666ad7a7e1' :"Run Apply Fifo on order",
65 '009534719f8c8221440a5629f497a784' :"Debit",
66 '1abe972d603f3bd61eefc9ac39fb7522' :"#TX Tot",
67 '7b09a122e58c067939744c4a96ff2d77' :"Select salesrep",
68 '56d56144d4e4a42ce450446518c4fc00' :"#Diff",
69 '03ab340b3f99e03cff9e84314ead38c0' :"Qty",
70 'f4c6f851b00d5518bf888815de279aba' :"Notes",
71 'c9cc8cce247e49bae79f15173ce97354' :"Save",
72 '386c339d37e737a436499d423a77df0c' :"Currency",
73 'f4757c5aca5e4410b63c6ec4cd0f2363' :"shiphead",
74 'f97f673be4e5f66aca62b35280d8bcde' :"Print Standard Invoice",
75 'acc95aeaee48871da70cc3bce664728c' :"Select shiptoinfo",
76 'ce26601dac0dea138b7295f02b7620a7' :"Customer",
77 'd335d558a8386d20318888b1f034103d' :"Unshipped Total",
78 '2925dda0ec274c20c0a30d8720eb830b' :"Select curr_name",
79 '72d6d7a1885885bb55a565fd1070581a' :"Import",
80 '9aa6071f39d387792476bd70fed66735' :"Void / Unconfirm",
81 '6f1bf85c9ebb3c7fa26251e1e335e032' :"Terms",
82 '53896265ad28c11cb4997b3c3e3e122d' :"#Ship",
83 '5da618e8e4b89c66fe86e32cdafde142' :"From",
84 '158e64bcd08067d26e9c27679eeced88' :"No Items",
85 'd179a904ac10a39ab574fe803cc29fa3' :"Run Void flagger",
86 'f3d90c6982143029487fb00d4ef19526' :"#invoiced",
87 '80092f7900d59aab765d0ddd35dc7231' :"Add Shipment",
88 'a240fa27925a635b08dc28c9e4f9216d' :"Order",
89 '01d35df7886d24900b1ecb65da6bf21d' :"Receive Payment",
90 'f817f797c422f7ac3404b6223db1a1ee' :"invdetail",
91 '50104a28589c5b6099d3580861c2551a' :"Shipments / Invoices",
92 'e23841a1d7427d8a9297142145dff049' :"Select shipto",
93 '9f1a342d0197aac60ed73e921dc4c1f5' :"Price Details",
94 '2142511303396bd51e0cc25ea8ffe47f' :"Void Payment",
95 '88408722ed9d719c44087292bf8a06cf' :"Prices with GST",
96 '236119342501b1e596bc82013c9cfc42' :"SubTotal w/GST",
97 '4b78ac8eb158840e9638a3aeb26c4a9d' :"Tax",
98 'cb02c723b8a159fea3cd7913d3df7fbc' :"Doc#",
99 '6a813cbab5d0c9d33b1a471839935d88' :"Cust#",
100 'b8feb9ee933bc5cc05615860322e9e7a' :"Post Invoice",
101 '70c6ddcd97af88d0aaac48268c459727' :"Download (as xls)",
102 '66b2bba3de9b8c5d6fb94e9458f1b7f5' :"Show Inventory History",
103 '57cdc7bcd2ca327f3267e2f5ecfa8c6d' :"Edit / Create Sales Order",
104 '48e91c2f1cb7b90612ccae2502c7327f' :"Shipment Comments",
105 '47cb03899dc494703b52c37240fa4c17' :"Stock Tx",
106 '72bb7a9ea8714c52b0c0b8369d6a8dc3' :"Issue Date",
107 'e5d63551ca2d2842661e49a25fd12a67' :"Edit Customer",
108 '7608203603437f0513ba8203a2d39a4f' :"Item Code",
109 '08bd40c7543007ad06e4fce31618f6ec' :"Account",
110 'e963218370d6410e1ee0f8e6128c12d4' :"shipdate",
111 '0ee182201463a0ea31cb073b227fbbbe' :"Print Chinese Invoice With GST in line item",
112 '089ba2b5edc96565fc22c584ecfbb1a6' :"Displaying events{0} - {1} of {2}",
113 '0bcef9c45bd8a48eda1b26eb0c61c869' :"%",
114 '81ceb48a978444906d80119200aa358d' :"Void",
115 'a763436d2b30d54e4aff264b1636827a' :"Discount (Pretax)",
116 '4721299f56b6b7d43591156d1d3f3e82' :"List Price w/GST",
117 'f4ac45b9eb622dcb26c0d4fc1c93b27c' :"Order Comments",
118 '7a113dee68a51f4c5f71264fd0ce3781' :"Item#",
119 'a860ed9926b241b7d4dca2d00610ab2c' :"Outstanding",
120 '290612199861c31d1036b185b4e69b75' :"Summary",
121 '786410e93beb0193d89f8608c54feb4b' :"Select item",
122 'b1bc248a7ff2b2e95569f56de68615df' :"number",
123 '07ca5050e697392c9ed47e6453f1453f' :"Completed",
124 '6b15347cbd1bf352b547741a7525c1b4' :"#shipped",
125 'b3c65c9f85b429821cf931b38386a64d' :"Select Tax Type",
126 '5e33fc1550a56738da96fbaaf57e72f0' :"#TX ret",
127 '16cd452dda9d4398bf6240603eee40a9' :"Posted",
128 'b2f40690858b404ed10e62bdf422c704' :"Amount",
129 'e87de1a5d238411ab34a292be599e9f4' :"Apply To All",
130 '40e6e8652d174c7ceef48df46f9cf25a' :"From Location",
131 '9122d60c0550be8ab070b96d8bbc6358' :"Sell @w/GST",
132 '78ca8a8170f2065057507ddcde63d9ca' :"Tax Zone",
133 '757989a16207ab23076685118640adf3' :"Item Cost",
134 '160ab8f9d6c5d2819fff11dea08d4ef8' :"Download Excel",
135 '0ee72ad23c24d7cfc5c13311abdc3f72' :"Staff I.C.",
136 '511b6a78f5503881ba10ff93b7205ade' :"Create CM reversal",
137 '74002cb040b036511b8d031da591364a' :"Ship to",
138 'c6b4fd215b0cdcb7426519edc0ece828' :"Print Bambini Pro Forma Invoice",
139 'b98c34417c412e0c87faa828f26b9123' :"Uninvoiced Total",
140 'a0d036a1d6a00180df168fa86143e5f8' :"No invdetail found",
141 'de3d17fb46f44fdf066581fbb5fe6113' :"Select Staff",
142 'fbb9d6ec5325d0fe63c19431856a0802' :"Select cntct",
143 'c3ce05eb16c5e0075b4a247b2c4b7bba' :"Bill To (select)",
144 'ec53a8c4f07baed5d8825072c89799be' :"Status",
145 '25d81668fca34c83d0720cc6365d62d6' :"Pre Tax discount",
146 'b25f6c965342495f74899e183efe20a4' :"Void / Unpost",
147 '58733ee735e3160c5c9fa5739fb4d056' :"Unposted",
148 '3ec365dd533ddb7ef3d1c111186ce872' :"Details",
149 'c04b33241cc5478500daf178e3720b63' :"No coitem found",
150 'ea9cf7e47ff33b2be14e6dd07cbcefc6' :"Shipping",
151 '871080cb9d00a8bda1b9f1db3c164341' :"Unit Cost",
152 '820dbd2b8f606aff866c0bbfb6b737c1' :"Changed",
153 '7ce96513eec175e6123b56573750b0dd' :"#reserved",
154 'a0ec87054b5e5b7847d0d8780a01a3d5' :"Sum",
155 '26e09a1ee1517389c7b07f42df65561a' :"Ordered",
156 'bdd31bfe5374e3cdc19a10020eae4b49' :"Add Invoice",
157 '801ab24683a4a8c433c6eb40c48bcd9d' :"Download",
158 '44749712dbec183e983dcd78a7736c41' :"Date",
159 '37656f0f6cf5e5befb1ec7abd3db5804' :"shipvia",
160 '4a2a14210d78f0d82db75d0264030169' :"Supply From",
161 '052fbb9431206b4755090dc53fcef300' :"Void Refund",
162 'c4b515058fab313f403ae427ce7e32b3' :"Update Location to match S/O",
163 '87813307f6e7498b30c5b3d9b2f65f56' :"Displaying invdetail{0} - {1} of {2}",
164 '3a6a3353e3b44ad5359c8e3178b66a54' :"invcdate",
165 '4b84bd35233c0d3d3c36b9a6ce6e0745' :"Order Items",
166 '13abfee28b4564e3fb059420fbedbec5' :"Taxed",
167 '94f475efc6722fd13ab78411c1ef7bd7' :"Sales Rep",
168 'bb4af85913879b95661b81570a2c2e83' :"Discount (Posttax)",
169 '526db6366257755024ed2556000871bc' :"Issue Refund",
170 '594f5bdc5e1519ce9934d276e5bf081f' :"No events found",
171 'd0cc96be641673ad48fc74374fda8137' :"Displaying coitem{0} - {1} of {2}",
172 'ce8ae9da5b7cd6c3df2929543a9af92d' :"Email",
173 'b6dad11e8e2203819164d64fc82b40f1' :"Discount after Tax Description",
174 'ea4788705e6873b424c65e91c2846b19' :"Cancel",
175 '1b7132f58f9ee9de75e5778ff04f7303' :"Print Delivery Note",
176 '4ee972120bcda675f75222c87cb9d356' :"Who",
177 'a0947dda65e4112f49260243804b6528' :"Xfer all stock to HK",
178 '1d144309cbdf2536723621bf0eac9f33' :"or enter Address",
179 '3d96cc39e5517a284e203ffc8cafcf51' :"Print Bambini Pronto Invoice",
180 '9c9745a343efeacc9efe9b7222b27afb' :"Ref#",
181 'c43b0fbe81e21c0a874a155ce528eebf' :"Apply % Discount of : ",
182 'e8586011952b0d098b0e568f20ca2b1f' :"Select Currency",
183 'fa1cfdb383ea976facbdb20d40d2f811' :"Duplicate Selected",
184 '6ac26fe4e9a39ac45fffe6d6920dac3a' :"Print Chinese Invoice",
185 '182875b6c36a761f1e459624c1d93638' :"Profit",
186 '3ffaf70863d6f46e2719050a37d9ef86' :"Order#",
187 '8fb8fbc1c0bc53b2d01121344410e444' :"Split sales",
188 '09466661df2abefeecf849e52fce8fb4' :"Total "
194 show : function(data, cb)
202 this.dialog.show(this.data._el);
205 this.form.setValues(data);
206 this.form.fireEvent('actioncomplete', this.form, { type: 'setdata', data: data });
214 this.dialog = Roo.factory({
220 title : _this._strings['57cdc7bcd2ca327f3267e2f5ecfa8c6d'] /* Edit / Create Sales Order */,
224 xtype : 'LayoutDialog',
227 this.layout.getRegion('center').showPanel(0);
231 alwaysShowTabs : true,
235 xtype : 'LayoutRegion',
243 '|xns' : 'Roo.Toolbar',
247 cls : 'x-btn-text-icon',
248 icon : rootURL + '/Pman/templates/images/spreadsheet.gif',
249 text : _this._strings['160ab8f9d6c5d2819fff11dea08d4ef8'] /* Download Excel */,
251 '|xns' : 'Roo.Toolbar',
256 var id = 1* _this.form.findField('cohead_id').getValue();
258 Roo.MessageBox.alert("Error", "Save Sales order first");
262 // check current status of shipment..
265 url : baseURL + '/Roo/cohead',
271 success : function() {
282 cls : 'x-btn-text-icon',
283 icon : rootURL + '/Pman/templates/images/pdf.gif',
284 text : _this._strings['13dba24862cf9128167a59100e154c8d'] /* Print */,
286 '|xns' : 'Roo.Toolbar',
291 var id = 1* _this.form.findField('cohead_id').getValue();
293 Roo.MessageBox.alert("Error", "Save Sales order first");
297 // check current status of shipment..
300 url : baseURL + '/Roo/cohead',
306 success : function() {
317 cls : 'x-btn-text-icon',
319 icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
320 text : _this._strings['80092f7900d59aab765d0ddd35dc7231'] /* Add Shipment */,
322 '|xns' : 'Roo.Toolbar',
325 click : function (_self, e)
328 _this.addShipmentBtn.fireEvent('click');
334 cls : 'x-btn-text-icon',
335 icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
336 text : _this._strings['e5d63551ca2d2842661e49a25fd12a67'] /* Edit Customer */,
338 '|xns' : 'Roo.Toolbar',
341 click : function (_self, e)
344 Pman.Dialog.XtupleCustomer.show({
345 cust_id : _this.form.findField('cohead_cust_id').getValue()
351 cls : 'x-btn-text-icon',
353 icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
354 text : _this._strings['bdd31bfe5374e3cdc19a10020eae4b49'] /* Add Invoice */,
356 '|xns' : 'Roo.Toolbar',
359 click : function (_self, e)
362 _this.addInvoiceBtn.fireEvent('click');
368 text : _this._strings['81ceb48a978444906d80119200aa358d'] /* Void */,
370 '|xns' : 'Roo.Toolbar',
373 click : function (_self, e)
376 cohead_id : _this.form.findField('cohead_id').getValue()
383 url: baseURL + '/Roo/cohead',
389 if ( _this.data.cohead_status == 'X') {
390 _this.form.load({ method: 'GET', params: { '_id' : _this.data.cohead_id }});
402 if (_this.data.cohead_status == 'X') {
408 Roo.MessageBox.confirm("Confirm", "Are you sure you want to void this?", function(r) {
420 render : function (_self, e)
422 _this.voidBtn = _self;
427 text : _this._strings['07ca5050e697392c9ed47e6453f1453f'] /* Completed */,
429 '|xns' : 'Roo.Toolbar',
432 click : function (_self, e)
434 var p = { cohead_id : _this.form.findField('cohead_id').getValue() };
437 if (_this.data.cohead_status == 'C') {
445 url: baseURL + '/Roo/cohead',
453 _this.form.load({ method: 'GET', params: { '_id' : _this.data.cohead_id }});
463 render : function (_self)
465 _this.closeBtn = _self;
474 text : _this._strings['511b6a78f5503881ba10ff93b7205ade'] /* Create CM reversal */,
479 click : function (_self, e)
481 var id = _this.form.findField('cohead_id').getValue() * 1;
484 Roo.MessageBox.alert('Error', 'Error occour on getting the sales order id');
488 Roo.MessageBox.confirm("Confirm", "Are you sure to create a credit memo reversal?",
496 url: baseURL+ '/Roo/cohead',
501 success : function() {
502 _this.form.load({ method: 'GET', params: { '_id' : id }});
508 render : function (_self)
510 _this.reversalBtn = _self;
515 text : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
520 click : function (_self, e)
522 if (_this.grid) _this.grid.stopEditing();
528 text : _this._strings['c9cc8cce247e49bae79f15173ce97354'] /* Save */,
533 click : function (_self, e)
537 if (_this.grid) _this.grid.stopEditing();
539 _this.form.doAction("submit");
542 render : function (_self)
544 _this.saveBtn = _self;
552 title : _this._strings['c5c8ac6bbc6d7f5c95d0a888527554d3'] /* Order Details */,
555 xtype : 'ContentPanel',
557 activate : function (_self)
559 // we need to reload to find out the subtotal.
560 if (!_this.data || !_this.data.cohead_id) {
565 url : baseURL + '/Roo/cohead',
567 _id : _this.data.cohead_id
569 success : function(res) {
570 _this.form.findField('cohead_subtotal').setValue(res.data.cohead_subtotal);
571 _this.form.findField('cohead_tax').setValue(res.data.cohead_tax);
572 _this.form.findField('cohead_uninvoiced').setValue(res.data.cohead_uninvoiced);
573 _this.form.findField('cohead_unshipped').setValue(res.data.cohead_unshipped);
574 _this.form.findField('cohead_pretax_discount').setValue(res.data.cohead_pretax_discount);
575 _this.form.findField('cohead_total').recalc();
576 _this.form.findField('cohead_misc').recalc();
584 style : 'margin:10px;',
585 url : baseURL + '/Roo/cohead.php',
590 actioncomplete : function(_self,action)
592 if (action.type == 'setdata') {
593 // clear the stock level cache...
594 _this.stockcache = [];
596 _this.form.findField('billto_email').setValue('');
598 _this.reversalBtn.hide();
600 if (_this.data.cohead_id) {
601 this.load({ method: 'GET', params: { '_id' : _this.data.cohead_id }});
605 _this.dialog.setTitle("Edit New Sales Order");
607 _this.closeBtn.hide();
608 _this.voidBtn.hide();
609 _this.saveBtn.show();
611 if(_this.data.cohead_billto_cntct_id_cntct_id){
612 _this.form.findField('billto_address').update();
614 _this.form.setValues({
\r
615 cohead_billto_cntct_id: _this.data.cohead_billto_cntct_id_cntct_id,
\r
616 cohead_billto_cntct_id_cntct_name : _this.data.cohead_billto_cntct_id_cntct_name,
\r
625 if (action.type == 'load') {
628 _this.data = action.result.data;
630 if (!_this.data.cohead_shipto_id && _this.data.shipto_id*1 > 0) {
631 _this.form.findField('cohead_shipto_id').setValue(_this.data.shipto_id);
632 _this.form.findField('cohead_shipto_id_shipto_name').setValue(_this.data.cohead_shipto_cntct_id_cntct_name);
637 _this.dataloading = true;
638 if (_this.data.cohead_shipto_cntct_id == _this.data.cohead_billto_cntct_id) {
639 this.findField('_shipto_same').setValue(1);
640 Roo.log("set shipto 1");
642 this.findField('_shipto_same').setValue(0);
643 Roo.log("set shipto 0");
645 _this.dataloading = false;
648 this.findField('billto_address').update();
649 this.findField('shipto_address').update();
650 _this.dialog.setTitle("Edit Sales Order - " + this.findField('cohead_number').getValue());
653 if (_this.data.cohead_status == 'C') {
654 _this.closeBtn.show();
655 _this.closeBtn.setText('Re-open');
656 _this.voidBtn.hide();
657 _this.saveBtn.hide();
658 _this.reversalBtn.show();
659 } else if (_this.data.cohead_status == 'X') {
660 _this.closeBtn.hide();
661 _this.voidBtn.show();
662 _this.voidBtn.setText("Un-void / Re-open");
663 _this.saveBtn.hide();
666 _this.closeBtn.show();
667 _this.closeBtn.setText('Complete and Close');
668 _this.voidBtn.setText("Void");
669 _this.voidBtn.show();
670 _this.saveBtn.show();
673 _this.form.findField('cohead_misc_per').update();
675 // finally override the value for discount...
676 if ((''+ _this.data.cohead_misc_descrip).length) {
677 _this.form.findField('cohead_misc_descrip').setValue(_this.data.cohead_misc_descrip);
680 // update the stockcache...
683 url : baseURL + '/Roo/cohead',
686 _stockLevel : _this.data.cohead_id
688 success : function(res)
690 for (var i in res.data) {
692 if(typeof(_this.stockcache[res.data[i].item]) == 'undefined'){
693 _this.stockcache[res.data[i].item] = res.data[i];
701 if (action.type =='submit') {
704 var id = _this.form.findField('cohead_id').getValue() * 1;
707 _this.data.cohead_id = action.result.data.cohead_id;
708 this.load({ method: 'GET', params: { '_id' : _this.data.cohead_id }});
714 if (_this.callback) {
715 _this.callback.call(_this, _this.form.getValues());
721 actionfailed : function (_self, action)
723 if (action.failureType == 'client') {
724 Roo.MessageBox.alert("Error", "Fill in all the required fields");
726 if (action.failureType == 'server') {
728 Roo.MessageBox.alert("Error", action.result.errorMsg);
730 _this.dialog.layout.getRegion('center').showPanel(0);
732 rendered : function (form)
746 legend : _this._strings['a240fa27925a635b08dc28c9e4f9216d'] /* Order */,
747 style : 'width:420px',
768 emptyText : _this._strings['086247a9b57fde6eefee2a0c4752242d'] /* Automatic */,
769 fieldLabel : _this._strings['3ffaf70863d6f46e2719050a37d9ef86'] /* Order# */,
770 name : 'cohead_number',
779 style : 'float:left',
787 fieldLabel : _this._strings['6a813cbab5d0c9d33b1a471839935d88'] /* Cust# */,
788 name : 'cohead_cust_id_cust_number',
801 fieldLabel : _this._strings['ce26601dac0dea138b7295f02b7620a7'] /* Customer */,
802 forceSelection : true,
803 hiddenName : 'cohead_cust_id',
805 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
807 name : 'cohead_cust_id_cust_name',
809 qtip : _this._strings['fce6d3795b41b54dc0dab82df50517c1'] /* Select custinfo */,
810 queryParam : 'query[cust_name]',
812 selectOnFocus : true,
813 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{cust_name}</b> </div>',
814 triggerAction : 'all',
816 valueField : 'cust_id',
823 fieldLabel : _this._strings['986b90fb419e5349dd59b691b0e0e9f6'] /* Customer PO# */,
824 name : 'cohead_custponumber',
832 fieldLabel : _this._strings['26e09a1ee1517389c7b07f42df65561a'] /* Ordered */,
834 name : 'cohead_orderdate',
849 fieldLabel : _this._strings['a2fdeac60e3c5b6c51a92e027fb9d533'] /* Target Delivery */,
851 name : 'cohead_targetdate',
864 boxLabel : 'same as order',
866 name : '_same_as_order',
871 check : function (_self, checked)
874 _this.form.findField('cohead_targetdate').setValue(_this.form.findField('cohead_orderdate').getValue());
885 displayField : 'location_name',
887 emptyText : _this._strings['4a2a14210d78f0d82db75d0264030169'] /* Supply From */,
888 fieldLabel : _this._strings['4a2a14210d78f0d82db75d0264030169'] /* Supply From */,
889 forceSelection : true,
890 hiddenName : 'cohead_location_src',
892 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
894 name : 'cohead_location_src_location_name',
896 qtip : _this._strings['151ccf95db9b81c11bb20fbc302af4b6'] /* Select terms */,
897 queryParam : 'query[location_name]',
898 selectOnFocus : true,
899 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{location_name}</b> {location_descrip} </div>',
900 triggerAction : 'all',
902 valueField : 'location_id',
909 sortInfo : { direction : 'ASC', field: 'location_name' },
914 beforeload : function (_self, o){
915 o.params = o.params || {};
917 o.params.location_netable = 1;
918 o.params.location_restrict = 0;
919 o.params._notinternalcompany = 1;
924 url : baseURL + '/Roo/location.php',
930 fields : [{"name":"location_id","type":"int"},"location_name"],
933 totalProperty : 'total',
946 legend : _this._strings['3ec365dd533ddb7ef3d1c111186ce872'] /* Details */,
947 style : 'width:420px',
961 displayField : 'terms_descrip',
963 emptyText : _this._strings['151ccf95db9b81c11bb20fbc302af4b6'] /* Select terms */,
964 fieldLabel : _this._strings['6f1bf85c9ebb3c7fa26251e1e335e032'] /* Terms */,
965 forceSelection : true,
966 hiddenName : 'cohead_terms_id',
968 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
970 name : 'cohead_terms_id_terms_descrip',
972 qtip : _this._strings['151ccf95db9b81c11bb20fbc302af4b6'] /* Select terms */,
973 queryParam : 'query[terms_descrip]',
974 selectOnFocus : true,
975 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{terms_descrip}</b> </div>',
976 triggerAction : 'all',
978 valueField : 'terms_id',
985 sortInfo : { direction : 'ASC', field: 'terms_descrip' },
990 beforeload : function (_self, o){
991 o.params = o.params || {};
997 url : baseURL + '/Roo/terms.php',
1003 fields : [{"name":"terms_id","type":"int"},"terms_descrip"],
1006 totalProperty : 'total',
1008 '|xns' : 'Roo.data',
1009 xtype : 'JsonReader'
1016 displayField : 'salesrep_name',
1018 emptyText : _this._strings['7b09a122e58c067939744c4a96ff2d77'] /* Select salesrep */,
1019 fieldLabel : _this._strings['94f475efc6722fd13ab78411c1ef7bd7'] /* Sales Rep */,
1020 forceSelection : true,
1021 hiddenName : 'cohead_display_salesrep_id',
1023 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
1025 name : 'cohead_display_salesrep_id_salesrep_name',
1027 qtip : _this._strings['7b09a122e58c067939744c4a96ff2d77'] /* Select salesrep */,
1028 queryParam : 'query[salesrep_name]',
1029 selectOnFocus : true,
1030 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{salesrep_name}</b> </div>',
1031 triggerAction : 'all',
1033 valueField : 'salesrep_id',
1036 '|xns' : 'Roo.form',
1040 sortInfo : { direction : 'ASC', field: 'salesrep_name' },
1042 '|xns' : 'Roo.data',
1045 beforeload : function (_self, o){
1046 o.params = o.params || {};
1052 url : baseURL + '/Roo/salesrep.php',
1054 '|xns' : 'Roo.data',
1058 fields : [{"name":"salesrep_id","type":"int"},"salesrep_name"],
1061 totalProperty : 'total',
1063 '|xns' : 'Roo.data',
1064 xtype : 'JsonReader'
1071 displayField : 'salesrep_name',
1073 emptyText : _this._strings['de3d17fb46f44fdf066581fbb5fe6113'] /* Select Staff */,
1074 fieldLabel : _this._strings['0ee72ad23c24d7cfc5c13311abdc3f72'] /* Staff I.C. */,
1075 forceSelection : true,
1076 hiddenName : 'cohead_salesrep_id',
1078 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
1080 name : 'cohead_salesrep_id_salesrep_name',
1082 qtip : _this._strings['7b09a122e58c067939744c4a96ff2d77'] /* Select salesrep */,
1083 queryParam : 'query[salesrep_name]',
1084 selectOnFocus : true,
1085 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{salesrep_name}</b> </div>',
1086 triggerAction : 'all',
1088 valueField : 'salesrep_id',
1091 '|xns' : 'Roo.form',
1095 sortInfo : { direction : 'ASC', field: 'salesrep_name' },
1097 '|xns' : 'Roo.data',
1100 beforeload : function (_self, o){
1101 o.params = o.params || {};
1107 url : baseURL + '/Roo/salesrep.php',
1109 '|xns' : 'Roo.data',
1113 fields : [{"name":"salesrep_id","type":"int"},"salesrep_name"],
1116 totalProperty : 'total',
1118 '|xns' : 'Roo.data',
1119 xtype : 'JsonReader'
1124 fieldLabel : _this._strings['f4ac45b9eb622dcb26c0d4fc1c93b27c'] /* Order Comments */,
1126 name : 'cohead_ordercomments',
1129 '|xns' : 'Roo.form',
1137 legend : _this._strings['780c462e85ba4399a5d42e88f69a15ca'] /* Billing */,
1138 style : 'width:420px',
1140 '|xns' : 'Roo.form',
1147 '|xns' : 'Roo.form',
1153 displayField : 'cntct_name',
1155 emptyText : _this._strings['fbb9d6ec5325d0fe63c19431856a0802'] /* Select cntct */,
1156 fieldLabel : _this._strings['c3ce05eb16c5e0075b4a247b2c4b7bba'] /* Bill To (select) */,
1157 forceSelection : true,
1158 hiddenName : 'cohead_billto_cntct_id',
1160 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
1162 name : 'cohead_billto_cntct_id_cntct_name',
1164 qtip : _this._strings['fbb9d6ec5325d0fe63c19431856a0802'] /* Select cntct */,
1165 queryParam : 'query[cntct_name]',
1166 selectOnFocus : true,
1167 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{cntct_name}</b> {cntct_addr_id_addr_line1}</div>',
1168 triggerAction : 'all',
1170 valueField : 'cntct_id',
1173 '|xns' : 'Roo.form',
1176 add : function (combo)
1179 Pman.Dialog.XtupleQuickContact.show(
1182 customer_id : _this.form.findField('cohead_cust_id').getValue()
1187 for(var i in data) {
1189 _this.data['cohead_billto_cntct_id_' + i] = data[i];
1192 _this.form.findField('billto_address').update();
1193 // fill in the select box..
1194 _this.form.setValues( {
1195 cohead_billto_cntct_id : data.cntct_id,
1196 cohead_billto_cntct_id_cntct_name : data.cntct_first_name + ' '+
1197 data.cntct_last_name
1202 // Pman.Dialog.XtupleCustomer.show(
1203 //{ cust_id : _this.form.findField('cohead_cust_id').getValue() },
1205 // refresh the data in the pulldown..
1209 beforeselect : function (combo, record, index)
1211 // set _this.data values ..
1213 // just add everything...
1214 for(var i in record.data) {
1215 _this.data['cohead_billto_cntct_id_' + i] = record.data[i];
1218 _this.form.findField('billto_address').update();
1226 sortInfo : { direction : 'ASC', field: 'cntct_name' },
1228 '|xns' : 'Roo.data',
1231 beforeload : function (_self, o){
1232 o.params = o.params || {};
1234 o.params._customer_id = _this.data.cohead_cust_id;
1239 url : baseURL + '/Roo/cntct.php',
1241 '|xns' : 'Roo.data',
1245 fields : [{"name":"cntct_id","type":"int"},"cntct_name"],
1248 totalProperty : 'total',
1250 '|xns' : 'Roo.data',
1251 xtype : 'JsonReader'
1256 fieldLabel : _this._strings['1d144309cbdf2536723621bf0eac9f33'] /* or enter Address */,
1257 name : 'billto_address',
1259 update : function() {
1261 var c = ['first_name', 'last_name' ] ;
1262 var a = [ 'line1', 'line2', 'line3', 'city', 'state', 'country' ];
1264 Roo.each(c, function(e) {
1265 if (_this.data['cohead_billto_cntct_id_cntct_' +e].length) {
1266 v.push(_this.data['cohead_billto_cntct_id_cntct_' +e]);
1269 Roo.each(a, function(e) {
1270 if (_this.data['cohead_billto_cntct_id_cntct_addr_id_addr_' +e].length) {
1271 v.push(_this.data['cohead_billto_cntct_id_cntct_addr_id_addr_' +e]);
1275 this.setValue(v.join("\n"));
1277 if(_this.data.cohead_billto_cntct_id_cntct_email.length){
1278 _this.form.findField('billto_email').setValue(_this.data.cohead_billto_cntct_id_cntct_email);
1282 '|xns' : 'Roo.form',
1285 render : function (_self)
1291 this.el.on('click', function() {
1292 var id = _this.form.findField('cohead_billto_cntct_id').getValue();
1293 Pman.Dialog.XtupleQuickContact.show(
1296 customer_id : _this.form.findField('cohead_cust_id').getValue()
1301 for(var i in data) {
1303 _this.data['cohead_billto_cntct_id_' + i] = data[i];
1306 _this.form.findField('billto_address').update();
1307 // fill in the select box..
1308 _this.form.setValues( {
1309 cohead_billto_cntct_id : data.cntct_id,
1310 cohead_billto_cntct_id_cntct_name : data.cntct_first_name + ' '+
1311 data.cntct_last_name
1320 Roo.log("Click text");
1328 fieldLabel : _this._strings['ce8ae9da5b7cd6c3df2929543a9af92d'] /* Email */,
1329 name : 'billto_email',
1330 valueRenderer : function(v)
1333 return v ? String.format('<a href="mailto:{0}" target="_blank">{0}</a>',v) : '';
1336 '|xns' : 'Roo.form',
1337 xtype : 'DisplayField'
1346 style : 'margin-left:10px',
1349 '|xns' : 'Roo.form',
1354 legend : _this._strings['9f1a342d0197aac60ed73e921dc4c1f5'] /* Price Details */,
1355 style : 'width:420px',
1357 '|xns' : 'Roo.form',
1361 labelAlign : 'right',
1365 '|xns' : 'Roo.form',
1370 labelSeparator : ' ',
1373 '|xns' : 'Roo.form',
1378 displayField : 'curr_name',
1380 emptyText : _this._strings['2925dda0ec274c20c0a30d8720eb830b'] /* Select curr_name */,
1381 fieldLabel : _this._strings['386c339d37e737a436499d423a77df0c'] /* Currency */,
1382 forceSelection : true,
1383 hiddenName : 'cohead_curr_id',
1385 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
1387 name : 'cohead_curr_id_curr_name',
1389 qtip : _this._strings['e8586011952b0d098b0e568f20ca2b1f'] /* Select Currency */,
1390 queryParam : 'query[curr_name]',
1391 selectOnFocus : true,
1392 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{curr_name}</b> </div>',
1393 triggerAction : 'all',
1395 valueField : 'curr_id',
1398 '|xns' : 'Roo.form',
1401 beforequery : function (combo, query, forceAll, cancel, e)
1403 Roo.log('beforequery');
1405 if (_this.form.findField('cohead_number').getValue().length) {
1406 Roo.MessageBox.alert("Error", "You can not change the currency of this order");
1408 query.cancel = true;
1416 sortInfo : { direction : 'ASC', field: 'curr_symbol' },
1418 '|xns' : 'Roo.data',
1421 beforeload : function (_self, o){
1422 o.params = o.params || {};
1429 url : baseURL + '/Roo/curr_symbol.php',
1431 '|xns' : 'Roo.data',
1435 fields : [{"name":"curr_id","type":"int"},"curr_symbol"],
1438 totalProperty : 'total',
1440 '|xns' : 'Roo.data',
1441 xtype : 'JsonReader'
1446 allowDecimals : true,
1447 cls : 'roo-align-right',
1448 decimalPrecision : 3,
1449 fieldLabel : _this._strings['068f80c7519d0528fb08e82137a72131'] /* Products */,
1450 name : 'cohead_subtotal',
1454 '|xns' : 'Roo.form',
1455 xtype : 'NumberField'
1461 labelSeparator : ' ',
1464 '|xns' : 'Roo.form',
1469 displayField : 'taxzone_descrip',
1471 emptyText : _this._strings['249ff431aa95198ad6814dd1d2799883'] /* Select taxtype */,
1472 fieldLabel : _this._strings['78ca8a8170f2065057507ddcde63d9ca'] /* Tax Zone */,
1473 forceSelection : true,
1474 hiddenName : 'cohead_taxzone_id',
1476 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
1478 name : 'cohead_taxzone_id_taxzone_descrip',
1480 qtip : _this._strings['249ff431aa95198ad6814dd1d2799883'] /* Select taxtype */,
1481 queryParam : 'query[taxzone_descrip]',
1482 selectOnFocus : true,
1483 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{taxzone_descrip}</b> </div>',
1484 triggerAction : 'all',
1486 valueField : 'taxzone_id',
1489 '|xns' : 'Roo.form',
1492 select : function (combo, record, index)
1494 _this.form.findField('cohead_tax').setValue(
1495 parseFloat(record.data.taxzone_rate) *
1496 parseFloat(_this.form.findField('cohead_subtotal').getValue())
1498 _this.form.findField('cohead_total').recalc();
1503 sortInfo : { direction : 'ASC', field: 'taxzone_descrip' },
1505 '|xns' : 'Roo.data',
1508 beforeload : function (_self, o){
1509 o.params = o.params || {};
1512 o.params.with_date = _this.form.findField('cohead_orderdate').getValue().format('Y-m-d');
1513 Roo.log("with date?" + o.params.with_date);
1520 url : baseURL + '/Roo/taxzone.php',
1522 '|xns' : 'Roo.data',
1526 fields : [{"name":"taxzone_id","type":"int"},"taxzone_descrip"],
1529 totalProperty : 'total',
1531 '|xns' : 'Roo.data',
1532 xtype : 'JsonReader'
1537 allowDecimals : true,
1538 cls : 'roo-align-right',
1539 decimalPrecision : 3,
1540 fieldLabel : _this._strings['4b78ac8eb158840e9638a3aeb26c4a9d'] /* Tax */,
1541 name : 'cohead_tax',
1545 '|xns' : 'Roo.form',
1546 xtype : 'NumberField'
1551 allowDecimals : true,
1552 cls : 'roo-align-right',
1553 decimalPrecision : 3,
1554 fieldLabel : _this._strings['25d81668fca34c83d0720cc6365d62d6'] /* Pre Tax discount */,
1555 name : 'cohead_pretax_discount',
1559 '|xns' : 'Roo.form',
1560 xtype : 'NumberField'
1564 labelSeparator : ' ',
1567 '|xns' : 'Roo.form',
1571 fieldLabel : _this._strings['b6dad11e8e2203819164d64fc82b40f1'] /* Discount after Tax Description */,
1572 name : 'cohead_misc_descrip',
1575 '|xns' : 'Roo.form',
1579 allowDecimals : true,
1580 cls : 'roo-align-right',
1581 decimalPrecision : 1,
1582 fieldLabel : _this._strings['0bcef9c45bd8a48eda1b26eb0c61c869'] /* % */,
1583 name : 'cohead_misc_per',
1584 update : function() {
1585 var m = _this.form.findField('cohead_misc_per');
1586 var pv = parseFloat(_this.form.findField('cohead_subtotal').getValue());
1587 var tax = parseFloat(_this.form.findField('cohead_tax').getValue());
1588 var pd = parseFloat(_this.form.findField('cohead_pretax_discount').getValue());
1590 var discount = parseFloat(_this.form.findField('cohead_posttax_discount').getValue());
1592 if (discount > 0.0) {
1600 var val = ((discount) / (pv + tax + pd)) * -100;
1602 //Roo.log("update discount?" + val);
1603 this.setValue(val.toFixed(1));
1606 _this.form.findField('cohead_misc_descrip').setValue("Discount of " + val.toFixed(1)+'%');
1614 '|xns' : 'Roo.form',
1615 xtype : 'NumberField',
1617 keyup : function (_self, e)
1619 var pv = parseFloat(_this.form.findField('cohead_subtotal').getValue());
1620 var tax = parseFloat(_this.form.findField('cohead_tax').getValue());
1621 var pd = parseFloat(_this.form.findField('cohead_pretax_discount').getValue());
1623 var n = this.getValue();
1624 var discount = parseFloat(n * (pv + tax + pd) * 0.01);
1626 _this.form.findField('cohead_posttax_discount').setValue(discount);
1628 _this.form.findField('cohead_total').recalc();
1629 _this.form.findField('cohead_misc').recalc();
1630 var val = discount * -1.0;
1632 _this.form.findField('cohead_misc_descrip').setValue("Discount of " + val.toFixed(1)+'%');
1640 allowDecimals : true,
1641 cls : 'roo-align-right',
1642 decimalPrecision : 3,
1643 fieldLabel : _this._strings['cc7819055cde3194bb3b136bad5cf58d'] /* */,
1644 name : 'cohead_posttax_discount',
1647 '|xns' : 'Roo.form',
1648 xtype : 'NumberField',
1650 keyup : function (_self, e)
1652 _this.form.findField('cohead_misc_per').update();
1653 _this.form.findField('cohead_total').recalc();
1654 _this.form.findField('cohead_misc').recalc();
1661 allowDecimals : true,
1662 cls : 'roo-align-right',
1663 decimalPrecision : 3,
1664 fieldLabel : _this._strings['96b0141273eabab320119c467cdcaf17'] /* Total */,
1665 name : 'cohead_total',
1667 recalc : function() {
1668 var d = _this.form.getValues();
1670 parseFloat(d.cohead_subtotal) +
1671 parseFloat(d.cohead_pretax_discount) +
1672 parseFloat(d.cohead_posttax_discount) +
1673 parseFloat(d.cohead_tax) +
1674 parseFloat(d.cohead_freight));
1678 '|xns' : 'Roo.form',
1679 xtype : 'NumberField'
1682 allowDecimals : true,
1683 cls : 'roo-align-right',
1684 decimalPrecision : 3,
1685 fieldLabel : _this._strings['ea9cf7e47ff33b2be14e6dd07cbcefc6'] /* Shipping */,
1686 name : 'cohead_freight',
1689 '|xns' : 'Roo.form',
1690 xtype : 'NumberField',
1692 keyup : function (_self, e)
1694 _this.form.findField('cohead_total').recalc();
1699 allowDecimals : true,
1700 cls : 'roo-align-right',
1701 decimalPrecision : 3,
1702 fieldLabel : _this._strings['d335d558a8386d20318888b1f034103d'] /* Unshipped Total */,
1703 name : 'cohead_unshipped',
1707 '|xns' : 'Roo.form',
1708 xtype : 'NumberField'
1711 allowDecimals : true,
1712 cls : 'roo-align-right',
1713 decimalPrecision : 3,
1714 fieldLabel : _this._strings['b98c34417c412e0c87faa828f26b9123'] /* Uninvoiced Total */,
1715 name : 'cohead_uninvoiced',
1719 '|xns' : 'Roo.form',
1720 xtype : 'NumberField'
1727 legend : _this._strings['ea9cf7e47ff33b2be14e6dd07cbcefc6'] /* Shipping */,
1728 style : 'width:420px',
1730 '|xns' : 'Roo.form',
1737 '|xns' : 'Roo.form',
1741 labelSeparator : ' ',
1743 '|xns' : 'Roo.form',
1747 boxLabel : 'Same as Billing',
1748 name : '_shipto_same',
1750 '|xns' : 'Roo.form',
1753 check : function (_self, checked)
1759 if (_this.dataloading) {
1767 // copy the cohead_billto_cntct_id
1768 for (var i in _this.data) {
1769 if (!i.match(/^cohead_billto_cntct_id/)) {
1772 var ni = i.replace(/^cohead_billto_cntct_id/, 'cohead_shipto_cntct_id');
1773 _this.data[ni] = _this.data[i];
1775 _this.form.findField('shipto_address').update();
1776 _this.form.setValues( {
1777 cohead_shipto_cntct_id : _this.data.cohead_shipto_cntct_id,
1778 cohead_shipto_cntct_id_cntct_name : _this.data.cohead_shipto_cntct_id_cntct_first_name + ' ' +
1779 _this.data.cohead_shipto_cntct_id_cntct_last_name
1786 for (var i in _this.data) {
1787 if (!i.match(/^cohead_billto_cntct_id/)) {
1790 var ni = i.replace(/^cohead_billto_cntct_id/, 'cohead_shipto_cntct_id');
1792 _this.data[ni] = '';
1794 _this.form.findField('shipto_address').update();
1796 _this.form.setValues( {
1797 cohead_shipto_cntct_id : '',
1798 cohead_shipto_cntct_id_cntct_name : ''
1812 displayField : 'cntct_name',
1814 emptyText : _this._strings['5f0c1431b38e3d279bf105d48824b7f3'] /* Select ship to */,
1815 fieldLabel : _this._strings['74002cb040b036511b8d031da591364a'] /* Ship to */,
1816 forceSelection : true,
1817 hiddenName : 'cohead_shipto_cntct_id',
1819 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
1821 name : 'cohead_shipto_cntct_id_cntct_name',
1823 qtip : _this._strings['acc95aeaee48871da70cc3bce664728c'] /* Select shiptoinfo */,
1824 queryParam : 'query[cntct_name]',
1825 selectOnFocus : true,
1826 tpl : '<div class=\"x-grid-cell-text x-btn button\">{cntct_name} - <b>{cntct_addr_id_addr_line1}</b> </div>',
1827 triggerAction : 'all',
1829 valueField : 'cntct_id',
1832 '|xns' : 'Roo.form',
1835 add : function (combo)
1837 Pman.Dialog.XtupleQuickContact.show(
1840 customer_id : _this.form.findField('cohead_cust_id').getValue()
1845 for(var i in data) {
1847 _this.data['cohead_shipto_cntct_id_' + i] = data[i];
1850 _this.form.findField('shipto_address').update();
1851 // fill in the select box..
1852 _this.form.setValues( {
1853 cohead_shipto_cntct_id : data.cntct_id,
1854 cohead_shipto_cntct_id_cntct_name : data.cntct_first_name + ' '+
1855 data.cntct_last_name
1861 beforeselect : function (combo, record, index)
1864 // just add everything...
1865 for(var i in record.data) {
1866 //Roo.log('cohead_shipto_cntct_id_' + i +' =' + record.data[i]);
1867 _this.data['cohead_shipto_cntct_id_' + i] = record.data[i];
1870 _this.form.findField('shipto_address').update();
1877 sortInfo : { direction : 'ASC', field: 'cntct_name' },
1879 '|xns' : 'Roo.data',
1882 beforeload : function (_self, o){
1883 o.params = o.params || {};
1885 o.params._customer_id = _this.data.cohead_cust_id;
1890 url : baseURL + '/Roo/cntct.php',
1892 '|xns' : 'Roo.data',
1896 fields : [{"name":"cntct_id","type":"int"},"cntct_name"],
1899 totalProperty : 'total',
1901 '|xns' : 'Roo.data',
1902 xtype : 'JsonReader'
1907 fieldLabel : _this._strings['dd7bf230fde8d4836917806aff6a6b27'] /* Address */,
1908 name : 'shipto_address',
1910 update : function() {
1912 var c = ['first_name', 'last_name' ] ;
1913 var a = [ 'line1', 'line2', 'line3', 'city', 'state', 'country' ];
1916 if (_this.data['cohead_shipto_vend_name'] && _this.data['cohead_shipto_vend_name'].length) {
1917 v.push(_this.data['cohead_shipto_vend_name']);
1919 if (_this.data['cohead_shipto_vendaddr_code'] && _this.data['cohead_shipto_vendaddr_code'].length) {
1920 v.push(_this.data['cohead_shipto_vendaddr_code']);
1922 Roo.each(c, function(e) {
1923 if (_this.data['cohead_shipto_cntct_id_cntct_' +e] &&
1924 _this.data['cohead_shipto_cntct_id_cntct_' +e].length) {
1925 v.push(_this.data['cohead_shipto_cntct_id_cntct_' +e]);
1928 Roo.each(a, function(e) {
1929 if (_this.data['cohead_shipto_cntct_id_cntct_addr_id_addr_' +e] &&
1930 _this.data['cohead_shipto_cntct_id_cntct_addr_id_addr_' +e].length) {
1931 v.push(_this.data['cohead_shipto_cntct_id_cntct_addr_id_addr_' +e]);
1935 this.setValue(v.join("\n"));
1939 '|xns' : 'Roo.form',
1942 render : function (_self)
1948 this.el.on('click', function() {
1949 var id = _this.form.findField('cohead_shipto_cntct_id').getValue();
1950 Pman.Dialog.XtupleQuickContact.show(
1953 customer_id : _this.form.findField('cohead_cust_id').getValue()
1958 for(var i in data) {
1960 _this.data['cohead_shipto_cntct_id_' + i] = data[i];
1963 _this.form.findField('shipto_address').update();
1964 // fill in the select box..
1965 _this.form.setValues( {
1966 cohead_shipto_cntct_id : data.cntct_id,
1967 cohead_shipto_cntct_id_cntct_name : data.cntct_first_name + ' '+
1968 data.cntct_last_name
1977 // Roo.log("Click text");
1985 fieldLabel : _this._strings['48e91c2f1cb7b90612ccae2502c7327f'] /* Shipment Comments */,
1986 name : 'cohead_shipcomments',
1989 '|xns' : 'Roo.form',
2001 '|xns' : 'Roo.form',
2005 name : 'cohead_shipto_id',
2007 '|xns' : 'Roo.form',
2011 name : 'cohead_shipto_id_shipto_name',
2013 '|xns' : 'Roo.form',
2017 name : 'cohead_max_linenumber',
2019 '|xns' : 'Roo.form',
2023 name : 'cohead_cust_id',
2025 '|xns' : 'Roo.form',
2029 name : 'cohead_misc',
2030 recalc : function() {
2031 var d = _this.form.getValues();
2033 parseFloat(d.cohead_pretax_discount) +
2034 parseFloat(d.cohead_posttax_discount) );
2037 '|xns' : 'Roo.form',
2041 name : 'taxzone_rate',
2043 '|xns' : 'Roo.form',
2052 fitContainer : true,
2055 tableName : 'coitem',
2056 title : _this._strings['4b84bd35233c0d3d3c36b9a6ce6e0745'] /* Order Items */,
2059 xtype : 'GridPanel',
2061 activate : function() {
2064 try { if (MODULE.isBuilder) {
2068 var id = _this.form.findField('cohead_id').getValue() * 1;
2070 Roo.MessageBox.alert("Save First", "Save the order first, before adding items");
2071 _this.dialog.layout.getRegion('center').showPanel(0);
2076 _this.grid.footer.onClick('first');
2078 //if (_this.form.findField('cohead_cust_id_cust_name').getValue() == 'Bloom and Grow HK') {
2079 // _this.xferAll.show();
2082 // _this.xferAll.hide();
2087 deactivate : function (_self)
2090 _this.grid.stopEditing();
2095 autoExpandColumn : 'item_descrip1',
2097 loadAvail : function() {
2100 this.ds.each(function(r) {
2102 if(!r.data.item_number.length){
2106 if(typeof(_this.stockcache[r.data.item_number]) != 'undefined'){
2108 r.set('avail_qty', _this.stockcache[r.data.item_number].qty);
2109 if (r.data.coitem_unitcost_in_order_cur * 1.0 < 0.1) {
2110 r.set('coitem_unitcost_in_order_cur', _this.stockcache[r.data.item_number].unitcost);
2118 item : r.data.item_number,
2119 loc: r.data.coitem_location_src_location_name,
2120 id: r.data.coitem_linenumber + (r.data.coitem_subnumber ? ('.' + r.data.coitem_subnumber) : '')
2124 url : baseURL + '/Roo/itemloc',
2127 _availqty : Roo.encode(q),
2128 curr_name : _this.form.findField('cohead_curr_id').el.dom.value
2130 success : function(res)
2132 for (var i in res.data) {
2133 _this.stockcache[res.data[i].item] = res.data[i];
2135 r.set('avail_qty', _this.stockcache[r.data.item_number].qty);
2136 if (r.data.coitem_unitcost_in_order_cur * 1.0 < 0.1) {
2137 r.set('coitem_unitcost_in_order_cur', _this.stockcache[r.data.item_number].unitcost);
2139 //_this.grid.ds.fireEvent("update", _this.grid.ds, r, Roo.data.Record.EDIT);
2149 '|xns' : 'Roo.grid',
2150 xtype : 'EditorGrid',
2152 afteredit : function (e)
2154 Roo.log('afteredit:' + e.record.data.coitem_linenumber);
2157 // if ( e.record && e.record.data.coitem_id) {
2158 // as we disable update to the display on the ajax callback to
2159 // allow editing flow to continue, and not refresh - we can only update
2160 // these values after something has actually been edited.
2161 // e.record.set('coitem_id', e.record.data.coitem_id);
2162 // e.record.set('coitem_status', e.record.data.coitem_status);
2165 if (e.field == 'item_number' || e.originalValue == e.value) {
2166 // afterselect handles this...
2169 if (e.field == 'item_descrip1') {
2170 e.record.set('coitem_memo', e.value);
2172 var rate = _this.form.findField('taxzone_rate').getValue();
2174 case 'coitem_linedisc':
2176 var cp = parseFloat(e.record.data.coitem_custprice);
2178 if (isNaN(cp) || cp == 0.0) {
2182 var dis = parseFloat(e.value);
2190 Math.max(0,cp * ((100.0 - parseInt(e.value))/ 100.0) )
2193 // donot need to set the subtotal here, coz we will render it automatically
2195 // 'coitem_subtotal',
2196 // e.record.data.coitem_price * 1.0 * e.record.data.coitem_qtyord
2200 case 'coitem_price': // SELL@ price
2202 var cp = parseFloat(e.record.data.coitem_custprice);
2203 // list price is < price -- update it..
2204 if (isNaN(cp) || cp == 0.0 || cp < e.value) {
2205 e.record.set('coitem_custprice', e.value);
2208 // update the discount calc.
2210 e.record.set('coitem_linedisc', Math.max(0, 100.0 - (( e.value / cp) * 100.0)));
2212 // donot need to set the subtotal here, coz we will render it automatically
2214 // 'coitem_subtotal',
2215 // e.record.data.coitem_price * 1.0 * e.record.data.coitem_qtyord
2219 case 'coitem_custprice':
2220 // modified customer price...
2221 // just modify the discount.. -- leave the entered price the same..
2222 var sp = parseFloat(e.record.data.coitem_price);
2223 var cp = parseFloat(e.value);
2224 if (isNaN(cp) || cp == 0.0 || cp < e.value) {
2228 e.record.set('coitem_linedisc', Math.max(0, 100.0 - (( sp / cp) * 100.0)));
2232 case 'coitem_custprice_tax':
2233 var cp = parseFloat(e.value / ( 1 + rate * 1 ));
2234 var sp = parseFloat(e.record.data.coitem_price);
2236 if (isNaN(cp) || cp == 0.0) {
2239 e.record.set('coitem_custprice', cp);
2240 e.record.set('coitem_linedisc', Math.max(0, 100.0 - (( sp / cp) * 100.0)));
2244 case 'coitem_price_tax':
2246 var cp = parseFloat(e.record.data.coitem_custprice);
2247 var sp = parseFloat(e.value / ( 1 + rate * 1 ));
2248 if (isNaN(cp) || cp == 0.0 || cp < sp) {
2249 e.record.set('coitem_custprice', sp);
2252 e.record.set('coitem_price', sp);
2253 e.record.set('coitem_linedisc', Math.max(0, 100.0 - (( sp / cp) * 100.0)));
2262 var doupdate = function() {
2263 if (!e.record.updatePending) {
2264 Roo.log('doupdate...' + e.record.data.coitem_linenumber);
2269 Roo.log('doupdate pending...' + e.record.data.coitem_linenumber);
2270 // wait until it's not peding an update..
2271 doupdate.defer(500);
2274 if(e.record.data.coitem_id * 1 < 1 && !e.record.isInserting){ // insert
2275 e.record.isInserting = 1;
2276 e.record.isUpdating = 0;
2282 if(!e.record.isInserting && !e.record.isUpdating){
2283 e.record.isUpdating = 1;
2288 if(!e.record.updatePending){
2289 e.record.updatePending = 1;
2293 Roo.log("got to end without doing an update?" + e.record.data.coitem_linenumber);
2296 beforeedit : function (e)
2298 // we can only edit if nothing is assigned to shipping or invoices..
2302 if (rec.data.coitem_qtyshipped > 0 || rec.data.cobill_billed > 0 || (rec.data.shipitem_shipped - rec.data.coitem_qtyshipped) > 0 ) {
2303 Roo.MessageBox.alert("Error", "That item has been shipped, has a draft shipment or invoices - void the shipments/invoices first");
2308 if (rec.data.coitem_subnumber * 1 > 0) {
2309 Roo.log("Edit container event");
2310 Roo.log(e); // if it's a tab..
2314 // allow editing of source / destination..
2315 case 'coitem_shipto_id':
2316 case 'coitem_location_src':
2321 Roo.MessageBox.alert("Error", "That is a kit item, edit the container.");
2325 // zero off values..
2326 //if (e.field == 'coitem_qtyord' && rec.data.coitem_qtyord == 0) {
2329 // if (e.field == 'coitem_custprice' && rec.data.coitem_qtyord == 0.0) {
2333 if (rec.data.item_type == 'K' && e.field == 'item_number') {
2334 // you can not change the product type on kits' as it messing things up..
2335 Roo.MessageBox.alert("Error", "That is a kit item,if you need to change it, delete it first.");
2341 celldblclick : function (_self, rowIndex, columnIndex, e)
2343 var rec = this.ds.getAt(rowIndex);
2344 var di = this.cm.getDataIndex(columnIndex);
2345 if (di != 'avail_qty') {
2349 Pman.Dialog.XtupleInvHistory.show({
2350 itemsite_item_id_item_number : rec.data.item_number,
2351 // itemsite_item_id_item_descript1 : rec.data.item_descrip1,
2352 location_name : rec.data.coitem_location_src_location_name,
2353 location_descrip : rec.data.coitem_location_src_location_descrip,
2355 invhist_transdate : _this.form.findField('cohead_targetdate').getValue()
2362 //_this.dialog = Pman.Dialog.FILL_IN
2364 if (_this.panel.active) {
2365 this.footer.onClick('first');
2368 rowclass : function (gridview, rowcfg)
2370 if (rowcfg.record.data.coitem_status == 'C' &&
2371 rowcfg.record.data.shipitem_shipped * 1 < 1) {
2373 rowcfg.rowClass = 'strikethrough';
2375 if (rowcfg.record.data.coitem_status == 'X' ) {
2377 rowcfg.rowClass = 'strikethrough';
2380 if (!rowcfg.record.data.coitem_id) {
2381 rowcfg.rowClass = 'dragon-not-saved';
2391 emptyMsg : _this._strings['158e64bcd08067d26e9c27679eeced88'] /* No Items */,
2393 updateSummary : function() {
2396 url : baseURL + '/Roo/Coitem',
2400 coitem_cohead_id : _this.form.findField('cohead_id').getValue()
2402 success : function(d) {
2404 f.displayEl.update(String.format(
2405 "{0} items | Subtotal: {2} | Tax: {3} | List Discount {4} | Total : {1}{5}",
2407 _this.form.findField('cohead_curr_id').el.dom.value,
2410 d.data.total_list_discount,
2419 xtype : 'PagingToolbar',
2422 text : _this._strings['806dca90dbeda894ffb258939f9fef9a'] /* Fill empty Ship To */,
2424 '|xns' : 'Roo.Toolbar',
2427 click : function (_self, e)
2430 url : baseURL + '/Roo/Cohead',
2433 _fill_shipto : _this.form.findField('cohead_id').getValue()
2435 success : function() {
2436 _this.grid.footer.onClick('first');
2443 text : _this._strings['c4b515058fab313f403ae427ce7e32b3'] /* Update Location to match S/O */,
2445 '|xns' : 'Roo.Toolbar',
2448 click : function (_self, e)
2450 Roo.MessageBox.confirm("Confirm", "Are you sure?<BR>"+
2451 "This will set all the locations to match the Sales Order - and remove all old locations.",
2458 url : baseURL + '/Roo/Cohead',
2461 _fill_location : _this.form.findField('cohead_id').getValue(),
2462 _location_id : _this.form.findField('cohead_location_src').getValue()
2464 success : function() {
2465 _this.grid.footer.onClick('first');
2474 enableToggle : true,
2476 text : _this._strings['88408722ed9d719c44087292bf8a06cf'] /* Prices with GST */,
2478 '|xns' : 'Roo.Toolbar',
2481 render : function (_self)
2483 _this.showgstBtn = _self;
2485 toggle : function (_self, pressed)
2487 this.setText(pressed ? "Prices exc GST" : "Prices with GST");
2488 var cm = _this.grid.getColumnModel();
2490 cm.setHidden(cm.getIndexByDataIndex('coitem_price_tax'), pressed ? false : true);
2491 cm.setHidden(cm.getIndexByDataIndex('coitem_custprice_tax'), pressed ? false : true);
2492 cm.setHidden(cm.getIndexByDataIndex('coitem_subtotal_tax'), pressed ? false : true);
2494 cm.setHidden(cm.getIndexByDataIndex('coitem_price'), pressed ? true : false);
2495 cm.setHidden(cm.getIndexByDataIndex('coitem_custprice'), pressed ? true : false);
2496 cm.setHidden(cm.getIndexByDataIndex('coitem_subtotal'), pressed ? true : false);
2509 cls : 'x-btn-text-icon',
2510 icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
2511 text : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'] /* Add */,
2513 '|xns' : 'Roo.Toolbar',
2519 Roo.log("add presed");
2522 var grid = _this.grid;
2524 grid.ds.each(function(r) {
2525 if (r.data.coitem_qtyord < 1) {
2526 Roo.MessageBox.alert("Error", "you must fill in a quantity for " + r.data.item_number);
2538 var last = _this.form.findField('cohead_max_linenumber').getValue();
2545 _this.form.findField('cohead_max_linenumber').setValue(last);
2547 // this should be getting the previous row..??
2548 var ct = _this.grid.ds.getCount();
2549 var lastrow = ct ? _this.grid.ds.getAt(ct-1) : false;
2551 function lastor(k,d,kk) {
2552 var def = d ? _this.form.findField(k).el.dom.value : _this.form.findField(k).getValue();
2553 return lastrow ? lastrow.data[kk] : def;
2556 // uses form defaults or last row value.
2557 var nr = _this.grid.ds.reader.newRow({
2558 coitem_linenumber : last,
2562 coitem_cohead_id : _this.form.findField('cohead_id').getValue(),
2563 coitem_qtyshipped : 0,
2564 coitem_location_src : lastor('cohead_location_src',false, 'coitem_location_src'),
2565 coitem_location_src_location_name : lastor('cohead_location_src',true, 'coitem_location_src_location_name'),
2566 coitem_shipto_id : lastor('cohead_shipto_id',false, 'coitem_shipto_id'),
2567 coitem_shipto_id_shipto_name : lastor('cohead_shipto_id_shipto_name', false, 'coitem_shipto_id_shipto_name'),
2568 coitem_unitcost_in_order_cur : 0,
2569 coitem_taxtype_id : _this.data.default_taxtype_id,
2570 coitem_taxtype_id_taxtype_name : 'Taxable',
2576 grid.ds.insert(grid.ds.getCount(), nr);
2577 grid.startEditing(grid.ds.getCount()-1, 1); // type..
2578 nr.updatePending = 0;
2583 render : function (_self)
2585 _this.addItemBtn = _self;
2590 cls : 'x-btn-text-icon',
2591 icon : rootURL + '/Pman/templates/images/search.gif',
2592 text : _this._strings['9f4f3d35db49c5c2bba70a321a42fa87'] /* Find Products */,
2594 '|xns' : 'Roo.Toolbar',
2597 click : function (_self, e)
2599 var last = _this.form.findField('cohead_max_linenumber').getValue();
\r
2601 _this.form.findField('cohead_max_linenumber').setValue(last);
2603 var ct = _this.grid.ds.getCount();
\r
2604 var lastrow = ct ? _this.grid.ds.getAt(ct-1) : false;
\r
2606 function lastor(k,d,kk) {
\r
2607 var def = d ? _this.form.findField(k).el.dom.value : _this.form.findField(k).getValue();
\r
2608 return lastrow ? lastrow.data[kk] : def;
\r
2611 var cohead_cust_id = _this.form.findField('cohead_cust_id').getValue();
2612 var cohead_id = _this.form.findField('cohead_id').getValue();
2614 Pman.Dialog.XtupleSalesProductList.show( {cohead_cust_id : cohead_cust_id, cohead_id : cohead_id} , function(res) {
2616 _this.grid.stopEditing();
2618 if (_this.grid.ds.getCount() > 0) {
2619 var lr = _this.grid.ds.getAt(_this.grid.ds.getCount()-1);
2620 if (!lr.data.coitem_itemsite_id) {
2621 lr.set('coitem_itemsite_id', res.item_itemsite_id_itemsite_id);
2622 lr.set('item_number', res.item_number);
2623 lr.set('item_descrip1', res.item_descrip1);
2624 lr.set('coitem_listprice', res.item_price);
2625 lr.set('coitem_price', res.item_price);
2626 lr.set('coitem_custprice', res.item_price);
2633 var nr = _this.grid.ds.reader.newRow({
2634 coitem_linenumber : last,
2635 coitem_itemsite_id : res.item_itemsite_id_itemsite_id,
2636 item_number : res.item_number,
2637 item_descrip1 : res.item_descrip1,
2639 coitem_cohead_id : _this.form.findField('cohead_id').getValue(),
2640 coitem_qtyshipped : 0,
2641 coitem_listprice : res.item_price,
2642 coitem_price : res.item_price,
2643 coitem_custprice : res.item_price,
2645 coitem_location_src : lastor('cohead_location_src',false, 'coitem_location_src'),
2646 coitem_location_src_location_name : lastor('cohead_location_src',true, 'coitem_location_src_location_name'),
2647 coitem_shipto_id : lastor('cohead_shipto_id',false, 'coitem_shipto_id'),
2648 coitem_shipto_id_shipto_name : lastor('cohead_shipto_id_shipto_name', false, 'coitem_shipto_id_shipto_name')
2651 _this.grid.ds.insert(_this.grid.ds.getCount(), nr);
2658 cls : 'x-btn-text-icon',
2660 icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
2661 text : _this._strings['a0947dda65e4112f49260243804b6528'] /* Xfer all stock to HK */,
2663 '|xns' : 'Roo.Toolbar',
2670 url : baseURL + '/Roo/coitem',
2671 mask : 'Loading Data',
2675 _hk_xfer :_this.form.findField('cohead_id').getValue()
2677 success : function() {
2678 _this.grid.ds.load({});
2683 render : function (_self)
2685 _this.xferAll = _self;
2690 text : _this._strings['66b2bba3de9b8c5d6fb94e9458f1b7f5'] /* Show Inventory History */,
2692 '|xns' : 'Roo.Toolbar',
2695 click : function (_self, e)
2697 var c = _this.grid.getSelectionModel().getSelectedCell();
2699 Roo.MessageBox.alert("Error", "Select item to show history (you can also double click on the #avail number) ");
2703 var rec = _this.grid.ds.getAt(c[0]);
2705 Pman.Dialog.XtupleInvHistory.show({
2706 itemsite_item_id_item_number : rec.data.item_number,
2707 // itemsite_item_id_item_descript1 : rec.data.item_descrip1,
2708 location_name : rec.data.coitem_location_src_location_name,
2709 location_descrip : rec.data.coitem_location_src_location_descrip,
2712 invhist_transdate : _this.form.findField('cohead_targetdate').getValue()
2721 '|xns' : 'Roo.Toolbar',
2725 text : _this._strings['c43b0fbe81e21c0a874a155ce528eebf'] /* Apply % Discount of : */,
2727 '|xns' : 'Roo.Toolbar',
2733 '|xns' : 'Roo.form',
2734 xtype : 'TextField',
2736 render : function (_self)
2738 _this._applyDiscount = _self;
2743 text : _this._strings['e87de1a5d238411ab34a292be599e9f4'] /* Apply To All */,
2745 '|xns' : 'Roo.Toolbar',
2748 click : function (_self, e)
2750 var val = parseFloat(_this._applyDiscount.getValue());
2752 var factor = (100.0 - val)/100.0;
2754 _this.grid.ds.each(function(rec) {
2755 if (rec.data.coitem_qtyshipped > 0 || rec.data.cobill_billed > 0) {
2759 rec.set('coitem_price', rec.data.coitem_custprice * factor);
2760 rec.set('coitem_linedisc', val);
2761 rec.set('coitem_subtotal', rec.data.coitem_price & rec.data.ordqty);
2771 text : _this._strings['72d6d7a1885885bb55a565fd1070581a'] /* Import */,
2773 '|xns' : 'Roo.Toolbar',
2776 click : function (_self, e)
2779 if (!(1* _this.form.findField('cohead_id').getValue())) {
2780 Roo.MessageBox.alert("Error", "save the order first");
2784 Pman.Dialog.Image.show(
2787 _url : baseURL+'/Xtuple/Import/SalesOrder',
2788 onid : _this.form.findField('cohead_id').getValue()
2793 Roo.MessageBox.alert("Notice", "Uploaded");
2794 _this.grid.footer.onClick('first');
2803 '|xns' : 'Roo.Toolbar',
2807 cls : 'x-btn-text-icon',
2808 icon : rootURL + '/Pman/templates/images/trash.gif',
2809 text : _this._strings['f2a6c498fb90ee345d997f888fce3b18'] /* Delete */,
2811 '|xns' : 'Roo.Toolbar',
2816 _this.grid.stopEditing();
2817 // check that no shipments or invoices are done..
2818 var rc = _this.grid.getSelectionModel().getSelectedCell();
2820 var rec = _this.grid.ds.getAt(rc[0]);
2822 if (rec.data.coitem_qtyshipped > 0 || rec.data.cobill_billed > 0) {
2823 Roo.MessageBox.alert("Error", "That item has been shipped or invoices - void the shipments/invoices first");
2826 if (rec.data.coitem_subnumber*1 > 0) {
2827 Roo.MessageBox.alert("Error", "Delete the kit item that that belongs to.");
2830 if (!rec.data.coitem_id) {
2831 _this.grid.ds.remove(rec);
2838 url : baseURL + '/Roo/coitem',
2841 _delete : rec.data.coitem_id
2844 success : function() {
2845 if (rec.data.item_type == 'K') {
2846 _this.grid.ds.load({});
2849 _this.grid.ds.remove(rec);
2854 if (rec.data_qtyord * 1 < 1) {
2858 Roo.MessageBox.confirm("Confirm", "Are you sure you want to delete that line?", function(r)
2873 cls : 'x-btn-text-icon',
2874 icon : rootURL + '/Pman/templates/images/trash.gif',
2875 text : _this._strings['27f2870eaa01c99fc83105240ad15f7f'] /* Delete All */,
2877 '|xns' : 'Roo.Toolbar',
2882 _this.grid.stopEditing();
2883 // check that no shipments or invoices are done..
2885 _this.grid.ds.each(function(rec) {
2889 if (rec.data.coitem_qtyshipped > 0 || rec.data.cobill_billed > 0) {
2890 //Roo.MessageBox.alert("Error", "That item has been shipped or invoices - void the shipments/invoices first");
2893 if (rec.data.item_type == 'K') {
2897 if (rec.data.coitem_subnumber*1 > 0) {
2898 //Roo.MessageBox.alert("Error", "Delete the kit item that that belongs to.");
2901 if (!rec.data.coitem_id) {
2902 _this.grid.ds.remove(rec);
2905 ids.push(rec.data.coitem_id);
2911 url : baseURL + '/Roo/coitem',
2914 _delete : ids.join(',')
2917 success : function() {
2919 _this.grid.footer.onClick('first');
2924 // if (rec.data_qtyord * 1 < 1) {
2928 Roo.MessageBox.confirm("Confirm", "Are you sure you want to delete everything?", function(r)
2946 sortInfo : { field : 'coitem_linenumber,coitem_subnumber', direction: 'ASC' },
2948 '|xns' : 'Roo.data',
2951 beforeload : function (_self,o) {
2958 if (!_this.data || !_this.data.cohead_id) {
2961 o.params = o.params || {};
2963 o.params.coitem_cohead_id = _this.data.cohead_id;
2964 o.params._without_list_discount =1;
2965 //o.params.limit = 999;
2969 load : function (_self, records, options)
2971 // need to fetch availablity from master data..
2972 // build a list of what to ask..
2974 // query: ITEM CODE - LOCATION
2975 _this.grid.footer.updateSummary();
2976 _this.grid.loadAvail.defer(100, _this.grid);
2982 update : function (_self, rec, operation)
2985 if (operation != Roo.data.Record.COMMIT) {
2989 // row has been updated..
2990 // if the qty + item has been filled in, we should try and save it..
2993 var setRecord = function(){
2995 Roo.log("Clearing update?" + rec.data.coitem_linenumber);
2996 rec.updatePending = 0;
2997 if(rec.isInserting){
2998 rec.isInserting = 0;
3004 if (!(rec.data.coitem_itemsite_id * 1) || !(rec.data.coitem_qtyord*1)) {
3008 var doCommit = function() {
3009 Roo.log("Sending data?" + rec.data.coitem_linenumber);
3012 url : baseURL+'/Roo/coitem',
3015 success: function(res)
3018 var row = _this.grid.ds.indexOf(rec);
3019 Roo.get(_this.grid.view.getRow(row)).removeClass('dragon-not-saved');
3025 Roo.log("GOT success: " + rec.data.coitem_linenumber);
3026 //Roo.log("GOT success");
3027 // update the data...
3029 if (rec.data.item_type == 'K') {
3031 _this.grid.ds.load({});
3036 // why is this here.??
3038 if (_this.grid.activeEditor) {
3044 rec.set('coitem_id', res.data.coitem_id);
3045 rec.set('coitem_status', res.data.coitem_status);
3049 delete rec.modified;
3051 _this.grid.footer.updateSummary();
3052 _this.grid.loadAvail();
3058 failure : function(res)
3061 Roo.MessageBox.alert("Error", res.errorMsg ? res.errorMsg : "Error updating");
3077 url : baseURL + '/Roo/coitem.php',
3079 '|xns' : 'Roo.data',
3083 builderCfg : '{\"cols\":[{\"table\":\"coitem\",\"column\":\"coitem_linenumber\",\"columnshort\":\"coitem_linenumber\",\"ctype\":\"int4\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Item#\"},{\"table\":\"coitem\",\"column\":\"coitem_itemsite_id\",\"columnshort\":\"coitem_itemsite_id\",\"ctype\":\"int4\",\"desc\":\"\",\"maps_to\":\"itemsite_id\",\"deps\":[{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_item_id\",\"columnshort\":\"itemsite_item_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_warehous_id\",\"columnshort\":\"itemsite_warehous_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_qtyonhand\",\"columnshort\":\"itemsite_qtyonhand\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_reorderlevel\",\"columnshort\":\"itemsite_reorderlevel\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_ordertoqty\",\"columnshort\":\"itemsite_ordertoqty\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_cyclecountfreq\",\"columnshort\":\"itemsite_cyclecountfreq\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_datelastcount\",\"columnshort\":\"itemsite_datelastcount\",\"ctype\":\"date\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_datelastused\",\"columnshort\":\"itemsite_datelastused\",\"ctype\":\"date\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_loccntrl\",\"columnshort\":\"itemsite_loccntrl\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_safetystock\",\"columnshort\":\"itemsite_safetystock\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_minordqty\",\"columnshort\":\"itemsite_minordqty\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_multordqty\",\"columnshort\":\"itemsite_multordqty\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_leadtime\",\"columnshort\":\"itemsite_leadtime\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_abcclass\",\"columnshort\":\"itemsite_abcclass\",\"ctype\":\"bpchar\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_issuemethod\",\"columnshort\":\"itemsite_issuemethod\",\"ctype\":\"bpchar\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_controlmethod\",\"columnshort\":\"itemsite_controlmethod\",\"ctype\":\"bpchar\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_active\",\"columnshort\":\"itemsite_active\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_plancode_id\",\"columnshort\":\"itemsite_plancode_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_costcat_id\",\"columnshort\":\"itemsite_costcat_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_eventfence\",\"columnshort\":\"itemsite_eventfence\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_sold\",\"columnshort\":\"itemsite_sold\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_stocked\",\"columnshort\":\"itemsite_stocked\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_freeze\",\"columnshort\":\"itemsite_freeze\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_location_id\",\"columnshort\":\"itemsite_location_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_useparams\",\"columnshort\":\"itemsite_useparams\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_useparamsmanual\",\"columnshort\":\"itemsite_useparamsmanual\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_soldranking\",\"columnshort\":\"itemsite_soldranking\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_createpr\",\"columnshort\":\"itemsite_createpr\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_location\",\"columnshort\":\"itemsite_location\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_location_comments\",\"columnshort\":\"itemsite_location_comments\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_notes\",\"columnshort\":\"itemsite_notes\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_perishable\",\"columnshort\":\"itemsite_perishable\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_nnqoh\",\"columnshort\":\"itemsite_nnqoh\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_autoabcclass\",\"columnshort\":\"itemsite_autoabcclass\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_ordergroup\",\"columnshort\":\"itemsite_ordergroup\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_disallowblankwip\",\"columnshort\":\"itemsite_disallowblankwip\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_maxordqty\",\"columnshort\":\"itemsite_maxordqty\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_mps_timefence\",\"columnshort\":\"itemsite_mps_timefence\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_createwo\",\"columnshort\":\"itemsite_createwo\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_warrpurc\",\"columnshort\":\"itemsite_warrpurc\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_autoreg\",\"columnshort\":\"itemsite_autoreg\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_costmethod\",\"columnshort\":\"itemsite_costmethod\",\"ctype\":\"bpchar\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_value\",\"columnshort\":\"itemsite_value\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_ordergroup_first\",\"columnshort\":\"itemsite_ordergroup_first\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_supply_itemsite_id\",\"columnshort\":\"itemsite_supply_itemsite_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_planning_type\",\"columnshort\":\"itemsite_planning_type\",\"ctype\":\"bpchar\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_wosupply\",\"columnshort\":\"itemsite_wosupply\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_posupply\",\"columnshort\":\"itemsite_posupply\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_lsseq_id\",\"columnshort\":\"itemsite_lsseq_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_cosdefault\",\"columnshort\":\"itemsite_cosdefault\",\"ctype\":\"bpchar\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_createsopr\",\"columnshort\":\"itemsite_createsopr\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_createsopo\",\"columnshort\":\"itemsite_createsopo\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_dropship\",\"columnshort\":\"itemsite_dropship\",\"ctype\":\"bool\",\"desc\":\"\"}],\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"coitem\",\"column\":\"coitem_qtyord\",\"columnshort\":\"coitem_qtyord\",\"ctype\":\"numeric\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Qty\"},{\"table\":\"coitem\",\"column\":\"coitem_unitcost\",\"columnshort\":\"coitem_unitcost\",\"ctype\":\"numeric\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Unit Cost\"},{\"table\":\"coitem\",\"column\":\"coitem_price\",\"columnshort\":\"coitem_price\",\"ctype\":\"numeric\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Price\"},{\"table\":\"coitem\",\"column\":\"coitem_custprice\",\"columnshort\":\"coitem_custprice\",\"ctype\":\"numeric\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Cust Price\"},{\"table\":\"coitem\",\"column\":\"coitem_qtyreturned\",\"columnshort\":\"coitem_qtyreturned\",\"ctype\":\"numeric\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"#Returned\"},{\"table\":\"coitem\",\"column\":\"coitem_prcost\",\"columnshort\":\"coitem_prcost\",\"ctype\":\"numeric\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"prcost?\"},{\"table\":\"coitem\",\"column\":\"coitem_price_uom_id\",\"columnshort\":\"coitem_price_uom_id\",\"ctype\":\"int4\",\"desc\":\"\",\"maps_to\":\"uom_id\",\"deps\":[{\"table\":\"uom\",\"column\":\"coitem_price_uom_id_uom_name\",\"columnshort\":\"uom_name\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"uom\",\"column\":\"coitem_price_uom_id_uom_descrip\",\"columnshort\":\"uom_descrip\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"uom\",\"column\":\"coitem_price_uom_id_uom_item_weight\",\"columnshort\":\"uom_item_weight\",\"ctype\":\"bool\",\"desc\":\"\"}],\"use\":1,\"use_ex\":\"\",\"title\":\"Unit of\"},{\"table\":\"coitem\",\"column\":\"coitem_qtyreserved\",\"columnshort\":\"coitem_qtyreserved\",\"ctype\":\"numeric\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"#reserved\"}],\"cols_ex\":[\"coitem_price_uom_id_uom_descrip\"],\"table\":\"coitem\",\"xtype\":\"GridPanel\",\"|xns\":\"Roo\"}',
3086 'name': 'coitem_linenumber',
3090 'name': 'coitem_itemsite_id',
3094 'name': 'coitem_qtyord'
3097 'name': 'coitem_unitcost'
3100 'name': 'coitem_price'
3103 'name': 'coitem_custprice'
3106 'name': 'coitem_qtyreturned'
3109 'name': 'coitem_prcost'
3112 'name': 'coitem_price_uom_id',
3116 'name': 'coitem_qtyreserved'
3121 totalProperty : 'total',
3123 '|xns' : 'Roo.data',
3124 xtype : 'JsonReader'
3128 enter_is_tab : true,
3130 '|xns' : 'Roo.grid',
3131 xtype : 'CellSelectionModel',
3133 beforeeditnext : function (eventdata)
3137 // this does not work, as the reload effect cancels editng.
3138 var rec = _this.grid.ds.getAt(eventdata.cell[0]);
3139 if (rec.data.coitem_subnumber *1 < 0 ) {
3142 var r = eventdata.cell[0] + 1;
3145 if (r > _this.grid.ds.getCount()-1 ) {
3146 eventdata.cell = false;
3149 rec = _this.grid.ds.getAt(r);
3150 if (rec.data.coitem_subnumber *1 < 0 ) {
3151 eventdata.cell = [ r, eventdata.cell[1] ];
3161 tabend : function (_self)
3163 _this.addItemBtn.fireEvent('click', _this.addItemBtn);
3169 builderCfg : '{\"table\":\"coitem\",\"column\":\"coitem_linenumber\",\"columnshort\":\"coitem_linenumber\",\"ctype\":\"int4\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Item#\"}',
3170 dataIndex : 'coitem_linenumber',
3171 header : _this._strings['7a113dee68a51f4c5f71264fd0ce3781'] /* Item# */,
3172 renderer : function(v,x,r) {
3174 if (r.data.coitem_subnumber * 1 > 0) {
3175 return String.format('{0}.{1}', v,r.data.coitem_subnumber);
3177 return String.format('{0}', v);
3181 '|xns' : 'Roo.grid',
3182 xtype : 'ColumnModel'
3185 dataIndex : 'item_number',
3186 header : _this._strings['7608203603437f0513ba8203a2d39a4f'] /* Item Code */,
3187 renderer : function(v) { return String.format('{0}', v); },
3190 '|xns' : 'Roo.grid',
3191 xtype : 'ColumnModel',
3194 '|xns' : 'Roo.grid',
3195 xtype : 'GridEditor',
3198 displayField : 'itemsite_item_id_item_number',
3200 emptyText : _this._strings['786410e93beb0193d89f8608c54feb4b'] /* Select item */,
3201 forceSelection : true,
3202 hiddenName : 'itemsite_item_id_item_number',
3204 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
3206 name : 'item_number',
3208 qtip : _this._strings['786410e93beb0193d89f8608c54feb4b'] /* Select item */,
3209 queryParam : 'query[number]',
3210 selectOnFocus : true,
3211 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{itemsite_item_id_item_number}</b> ${item_price:toFixed(2)}- {itemsite_item_id_item_descrip1} </div>',
3212 triggerAction : 'all',
3214 valueField : 'item_number',
3216 '|xns' : 'Roo.form',
3219 beforeselect : function (combo, record, index)
3221 // set _this.data values ..
3222 var ar = _this.grid.activeEditor.record;
3223 // Roo.log('beforeselect');
3227 // Roo.log('beforeselect-cb');
3228 ar.set('item_descrip1', record.data.itemsite_item_id_item_descrip1);
3229 ar.set('coitem_listprice', record.data.item_listprice);
3230 ar.set('coitem_price', record.data.item_price);
3231 ar.set('coitem_custprice', record.data.item_price);
3232 ar.set('coitem_itemsite_id', record.data.itemsite_id);
3233 ar.set('item_number', record.data.itemsite_item_id_item_number);
3234 ar.set('item_type', record.data.itemsite_item_id_item_type);
3235 ar.set('avail_qty', 0);
3243 sortInfo : { direction : 'ASC', field: 'item_number' },
3245 '|xns' : 'Roo.data',
3248 beforeload : function (_self, o){
3249 o.params = o.params || {};
3250 o.params.customer_id = _this.form.findField('cohead_cust_id').getValue();
3251 o.params['query[cohead_id]'] = _this.form.findField('cohead_id').getValue();
3252 //o.params.shipto_cust_id = _this.data.cohead_cust_id;
3258 url : baseURL + '/Roo/itemsite.php',
3260 '|xns' : 'Roo.data',
3264 fields : [{"name":"item_id","type":"int"},"item_number"],
3267 totalProperty : 'total',
3269 '|xns' : 'Roo.data',
3270 xtype : 'JsonReader'
3277 dataIndex : 'coitem_location_src',
3278 header : _this._strings['5da618e8e4b89c66fe86e32cdafde142'] /* From */,
3279 renderer : function(v,x,r) {
3280 return String.format('{0}', r.data.coitem_location_src_location_name);
3284 '|xns' : 'Roo.grid',
3285 xtype : 'ColumnModel',
3288 '|xns' : 'Roo.grid',
3289 xtype : 'GridEditor',
3293 displayField : 'location_name',
3295 emptyText : _this._strings['fc44040a63559bee1157010d4c602422'] /* Select location */,
3296 forceSelection : true,
3297 hiddenName : 'coitem_location_src',
3299 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
3301 name : 'coitem_location_src_location_name',
3303 qtip : _this._strings['786410e93beb0193d89f8608c54feb4b'] /* Select item */,
3304 queryParam : 'query[location_name]',
3305 selectOnFocus : true,
3306 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b> {location_name}</b> {location_descrip}</div>',
3307 triggerAction : 'all',
3309 valueField : 'location_id',
3311 '|xns' : 'Roo.form',
3314 beforeselect : function (combo, record, index)
3316 // set _this.data values ..
3317 var ar = _this.grid.activeEditor.record;
3321 //Roo.log('beforeselect');
3325 // Roo.log('beforeselect-cb');
3326 ar.set('item_descrip1', record.data.itemsite_item_id_item_descrip1);
3327 ar.set('coitem_price', record.data.item_listprice);
3328 ar.set('coitem_custprice', record.data.item_price);
3329 ar.set('coitem_itemsite_id', record.data.itemsite_id);
3330 ar.set('item_number', record.data.itemsite_item_id_item_number);
3339 sortInfo : { direction : 'ASC', field: 'location_name' },
3341 '|xns' : 'Roo.data',
3344 beforeload : function (_self, o){
3345 o.params = o.params || {};
3347 var row = _this.grid.activeEditor.record;
3349 o.params['query[item_itemsite_id]'] = row.data.coitem_itemsite_id;
3350 // need to know the date to calc the est. delivery time..
3351 //o.params['query[avail_when]'] = _this.form.findField('cohead_targetdate').getValue().format('Y-m-d');
3352 //o.params.location_netable = 1;
3353 o.params['query[cohead_id]'] = _this.form.findField('cohead_id').getValue();
3355 o.params.location_restrict = 0;
3356 o.params._notinternalcompany = 1;
3360 // o.params.itemsite_id = _this.form.findField('cohead_cust_id').getValue();
3361 //o.params.shipto_cust_id = _this.data.cohead_cust_id;
3367 url : baseURL + '/Roo/location.php',
3369 '|xns' : 'Roo.data',
3373 fields : [{"name":"location_id","type":"int"},"location_name"],
3376 totalProperty : 'total',
3378 '|xns' : 'Roo.data',
3379 xtype : 'JsonReader'
3386 dataIndex : 'coitem_shipto_id',
3387 header : _this._strings['e12167aa0a7698e6ebc92b4ce3909b53'] /* To */,
3388 renderer : function(v,x,r) {
3389 return String.format('{0}:{1}', v, r.data.coitem_shipto_id_shipto_name);
3393 '|xns' : 'Roo.grid',
3394 xtype : 'ColumnModel',
3397 '|xns' : 'Roo.grid',
3398 xtype : 'GridEditor',
3402 displayField : 'shipto_name',
3404 emptyText : _this._strings['fbb9d6ec5325d0fe63c19431856a0802'] /* Select cntct */,
3405 forceSelection : true,
3406 hiddenName : 'cohead_shipto_id',
3408 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
3410 name : 'coitem_shipto_id_shipto_name',
3412 qtip : _this._strings['e23841a1d7427d8a9297142145dff049'] /* Select shipto */,
3413 queryParam : 'query[shipto_name]',
3414 selectOnFocus : true,
3415 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{shipto_id}:{shipto_addr_id_addr_name}</b> </div>',
3416 triggerAction : 'all',
3418 valueField : 'shipto_id',
3421 '|xns' : 'Roo.form',
3424 add : function (combo)
3427 Pman.Dialog.XtupleCustomer.show({ cust_id : _this.form.findField('cohead_cust_id').getValue() }, function(data) {
3428 // refresh the data in the pulldown..
3431 beforeselect : function (combo, record, index)
3435 for(var i = 1; i <4; i++) {
3436 _this.data['cohead_shiptoaddress'+ i] = record.data['cntct_addr_id_addr_line'+i];
3438 _this.form.findField('shipto_address').update();
3445 sortInfo : { direction : 'ASC', field: 'shipto_name' },
3447 '|xns' : 'Roo.data',
3450 beforeload : function (_self, o){
3451 o.params = o.params || {};
3452 o.params.shipto_cust_id = _this.data.cohead_cust_id;
3453 //o.params['query[with_shipinfo]'] = 1;
3459 url : baseURL + '/Roo/shiptoinfo.php',
3461 '|xns' : 'Roo.data',
3465 fields : [{"name":"cntct_id","type":"int"},"cntct_name"],
3468 totalProperty : 'total',
3470 '|xns' : 'Roo.data',
3471 xtype : 'JsonReader'
3478 builderCfg : '{\"table\":\"coitem\",\"column\":\"coitem_itemsite_id\",\"columnshort\":\"coitem_itemsite_id\",\"ctype\":\"int4\",\"desc\":\"\",\"maps_to\":\"itemsite_id\",\"deps\":[{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_item_id\",\"columnshort\":\"itemsite_item_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_warehous_id\",\"columnshort\":\"itemsite_warehous_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_qtyonhand\",\"columnshort\":\"itemsite_qtyonhand\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_reorderlevel\",\"columnshort\":\"itemsite_reorderlevel\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_ordertoqty\",\"columnshort\":\"itemsite_ordertoqty\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_cyclecountfreq\",\"columnshort\":\"itemsite_cyclecountfreq\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_datelastcount\",\"columnshort\":\"itemsite_datelastcount\",\"ctype\":\"date\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_datelastused\",\"columnshort\":\"itemsite_datelastused\",\"ctype\":\"date\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_loccntrl\",\"columnshort\":\"itemsite_loccntrl\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_safetystock\",\"columnshort\":\"itemsite_safetystock\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_minordqty\",\"columnshort\":\"itemsite_minordqty\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_multordqty\",\"columnshort\":\"itemsite_multordqty\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_leadtime\",\"columnshort\":\"itemsite_leadtime\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_abcclass\",\"columnshort\":\"itemsite_abcclass\",\"ctype\":\"bpchar\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_issuemethod\",\"columnshort\":\"itemsite_issuemethod\",\"ctype\":\"bpchar\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_controlmethod\",\"columnshort\":\"itemsite_controlmethod\",\"ctype\":\"bpchar\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_active\",\"columnshort\":\"itemsite_active\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_plancode_id\",\"columnshort\":\"itemsite_plancode_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_costcat_id\",\"columnshort\":\"itemsite_costcat_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_eventfence\",\"columnshort\":\"itemsite_eventfence\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_sold\",\"columnshort\":\"itemsite_sold\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_stocked\",\"columnshort\":\"itemsite_stocked\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_freeze\",\"columnshort\":\"itemsite_freeze\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_location_id\",\"columnshort\":\"itemsite_location_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_useparams\",\"columnshort\":\"itemsite_useparams\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_useparamsmanual\",\"columnshort\":\"itemsite_useparamsmanual\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_soldranking\",\"columnshort\":\"itemsite_soldranking\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_createpr\",\"columnshort\":\"itemsite_createpr\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_location\",\"columnshort\":\"itemsite_location\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_location_comments\",\"columnshort\":\"itemsite_location_comments\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_notes\",\"columnshort\":\"itemsite_notes\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_perishable\",\"columnshort\":\"itemsite_perishable\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_nnqoh\",\"columnshort\":\"itemsite_nnqoh\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_autoabcclass\",\"columnshort\":\"itemsite_autoabcclass\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_ordergroup\",\"columnshort\":\"itemsite_ordergroup\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_disallowblankwip\",\"columnshort\":\"itemsite_disallowblankwip\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_maxordqty\",\"columnshort\":\"itemsite_maxordqty\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_mps_timefence\",\"columnshort\":\"itemsite_mps_timefence\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_createwo\",\"columnshort\":\"itemsite_createwo\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_warrpurc\",\"columnshort\":\"itemsite_warrpurc\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_autoreg\",\"columnshort\":\"itemsite_autoreg\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_costmethod\",\"columnshort\":\"itemsite_costmethod\",\"ctype\":\"bpchar\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_value\",\"columnshort\":\"itemsite_value\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_ordergroup_first\",\"columnshort\":\"itemsite_ordergroup_first\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_supply_itemsite_id\",\"columnshort\":\"itemsite_supply_itemsite_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_planning_type\",\"columnshort\":\"itemsite_planning_type\",\"ctype\":\"bpchar\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_wosupply\",\"columnshort\":\"itemsite_wosupply\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_posupply\",\"columnshort\":\"itemsite_posupply\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_lsseq_id\",\"columnshort\":\"itemsite_lsseq_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_cosdefault\",\"columnshort\":\"itemsite_cosdefault\",\"ctype\":\"bpchar\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_createsopr\",\"columnshort\":\"itemsite_createsopr\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_createsopo\",\"columnshort\":\"itemsite_createsopo\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_dropship\",\"columnshort\":\"itemsite_dropship\",\"ctype\":\"bool\",\"desc\":\"\"}],\"use\":1,\"use_ex\":\"\",\"title\":\"\"}',
3479 dataIndex : 'item_descrip1',
3480 header : _this._strings['d9db367d7e9d6a3d3ca0346dfa1ff9d2'] /* Item Description */,
3481 renderer : function(v,x,r) {
3483 if (r.data.coitem_memo && r.data.coitem_memo.length) {
3484 return String.format('{0}', r.data.coitem_memo);
3485 if (r.data.coitem_memo != v) {
3486 r.set('item_descrip1', r.data.coitem_memo);
3490 if (v && v.length > 49) {
3491 return String.format('<span style="color:orange" qtip="line may be too long to print">{0}</span>', v);
3494 return String.format('{0}', v);
3499 '|xns' : 'Roo.grid',
3500 xtype : 'ColumnModel',
3503 '|xns' : 'Roo.grid',
3504 xtype : 'GridEditor',
3508 '|xns' : 'Roo.form',
3515 builderCfg : '{\"table\":\"coitem\",\"column\":\"coitem_unitcost\",\"columnshort\":\"coitem_unitcost\",\"ctype\":\"numeric\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Unit Cost\"}',
3516 dataIndex : 'coitem_status',
3517 header : _this._strings['ec53a8c4f07baed5d8825072c89799be'] /* Status */,
3518 renderer : function(v) { return String.format('{0}', v); },
3521 '|xns' : 'Roo.grid',
3522 xtype : 'ColumnModel'
3526 dataIndex : 'coitem_qtyord',
3527 header : _this._strings['03ab340b3f99e03cff9e84314ead38c0'] /* Qty */,
3528 renderer : function(v,x,r) {
3529 var v = parseInt(v);
3530 //var aq = parseInt(r.data.avail_qty);
3531 //aq = isNaN(aq) ? 0 : aq;
3533 var rate = _this.form.findField('taxzone_rate').getValue();
3534 r.data.coitem_subtotal = v * r.data.coitem_price;
3535 r.data.coitem_subtotal_tax = v * r.data.coitem_price * ( 1 + rate * 1);
3536 return String.format('{0}', v);
3541 '|xns' : 'Roo.grid',
3542 xtype : 'ColumnModel',
3545 '|xns' : 'Roo.grid',
3546 xtype : 'GridEditor',
3548 allowDecimals : false,
3549 decimalPrecision : 0,
3551 style : 'text-align:right',
3553 '|xns' : 'Roo.form',
3554 xtype : 'NumberField',
3556 focus : function (_self)
3558 if (this.value == 0) {
3559 this.el.dom.value = '';
3568 dataIndex : 'coitem_price',
3569 header : _this._strings['b166cb3a96bdb966f3288b8599594d0d'] /* Sell @ */,
3570 renderer : function(v,x,r) {
3572 var rate = _this.form.findField('taxzone_rate').getValue();
3573 r.data.coitem_subtotal = v * r.data.coitem_qtyord;
3574 r.data.coitem_subtotal_tax = v * ( 1 + rate * 1 ) * r.data.coitem_qtyord;
3575 r.data.coitem_price_tax = v * ( 1 + rate * 1 );
3576 if (parseInt(v) < 1) {
3577 return String.format('<b style="color:red;">{0}</b>', Roo.util.Format.number(v,3));
3581 //r.set('coitem_subtotal', v * r.data.coitem_qtyord);
3583 return String.format('{0}', Roo.util.Format.number(v,3));
3587 '|xns' : 'Roo.grid',
3588 xtype : 'ColumnModel',
3591 '|xns' : 'Roo.grid',
3592 xtype : 'GridEditor',
3594 decimalPrecision : 3,
3596 style : 'text-align:right',
3598 '|xns' : 'Roo.form',
3599 xtype : 'NumberField',
3601 focus : function (_self)
3603 if (this.value == 0.0) {
3604 this.el.dom.value = '';
3613 dataIndex : 'coitem_price_tax',
3614 header : _this._strings['9122d60c0550be8ab070b96d8bbc6358'] /* Sell @w/GST */,
3616 renderer : function(v,x,r) {
3618 if (parseInt(v) < 1) {
3619 return String.format('<b style="color:red;">{0}</b>', Roo.util.Format.number(v,3));
3622 return String.format('{0}', Roo.util.Format.number(v,3));
3626 '|xns' : 'Roo.grid',
3627 xtype : 'ColumnModel',
3630 '|xns' : 'Roo.grid',
3631 xtype : 'GridEditor',
3633 decimalPrecision : 3,
3635 style : 'text-align:right',
3637 '|xns' : 'Roo.form',
3638 xtype : 'NumberField',
3640 focus : function (_self)
3642 if (this.value == 0.0) {
3643 this.el.dom.value = '';
3652 dataIndex : 'coitem_linedisc',
3653 header : _this._strings['9d4ba8f5211a3ba238b2032be5991c14'] /* Disc% */,
3654 renderer : function(v,x,r) {
3656 // coitem_custprice = coitem_price * ((100 - coitem_disc)/ 100)
3658 // 12 * (( 100 - 0) / 100)
3659 // coitem_custprice / coitem_price = ((100 - coitem_disc)/ 100)
3660 // 100 - ((coitem_custprice / coitem_price) * 100) = coitem_disc
3661 // 100 - 97 = 100 -3
3663 // r.data.coitem_linedisc = 100 - (
3664 // (parseFloat(r.data.coitem_custprice) /
3665 // parseFloat(r.data.coitem_price)
3667 var fl = parseFloat(r.data.coitem_linedisc);
3668 if ( isNaN(fl) || fl == 0.0 || r.data.coitem_price > r.data.coitem_custprice) {
3671 return String.format('<span style="color:green">{0}%</span>', Roo.util.Format.number( r.data.coitem_linedisc,2));
3675 '|xns' : 'Roo.grid',
3676 xtype : 'ColumnModel',
3679 '|xns' : 'Roo.grid',
3680 xtype : 'GridEditor',
3682 decimalPrecision : 2,
3685 style : 'text-align:right',
3687 '|xns' : 'Roo.form',
3688 xtype : 'NumberField',
3690 focus : function (_self)
3692 if (this.value == 0.0) {
3693 this.el.dom.value = '';
3702 dataIndex : 'coitem_custprice',
3703 header : _this._strings['f84e65035f5d2d4a090b8a626c822321'] /* List Price */,
3704 renderer : function(v,x,r) {
3706 var rate = _this.form.findField('taxzone_rate').getValue();
3707 r.data.coitem_custprice_tax = v * ( 1 + rate * 1 );
3709 var tip = 'No WRP available';
3710 if ((r.data.coitem_wrpprice * 1) > 0) {
3711 tip = "WRP : " + Roo.util.Format.number(r.data.coitem_wrpprice,3);
3713 // less than zero, show as red..
3714 if (parseFloat(v) < 1) {
3715 return String.format('<b qtip="{1}" style="color:red;">{0}</b>',
3716 Roo.util.Format.number(v,3), tip);
3718 if (r.data.customer_price_each != v) {
3719 return String.format('<b qtip="{1}" style="color:pink;">{0}</b>',
3720 Roo.util.Format.number(v,3),
3721 "List Price = " + Roo.util.Format.number(r.data.customer_price_each,3)
3727 //r.data.coitem_subtotal = v * r.data.coitem_qtyord;
3729 //r.set('coitem_subtotal', v * r.data.coitem_qtyord);
3731 return String.format('<span qtip="{1}">{0}</span>', Roo.util.Format.number(v,3), tip);
3735 '|xns' : 'Roo.grid',
3736 xtype : 'ColumnModel',
3739 '|xns' : 'Roo.grid',
3740 xtype : 'GridEditor',
3742 decimalPrecision : 3,
3744 style : 'text-align:right',
3746 '|xns' : 'Roo.form',
3747 xtype : 'NumberField',
3749 focus : function (_self)
3751 if (this.value == 0.0) {
3752 this.el.dom.value = '';
3761 dataIndex : 'coitem_custprice_tax',
3762 header : _this._strings['4721299f56b6b7d43591156d1d3f3e82'] /* List Price w/GST */,
3764 renderer : function(v,x,r) {
3765 var rate = _this.form.findField('taxzone_rate').getValue();
3766 var tip = 'No WRP available';
3767 if ((r.data.coitem_wrpprice * 1) > 0) {
3768 tip = "WRP : " + Roo.util.Format.number(r.data.coitem_wrpprice,3);
3771 if (parseFloat(v) < 1) {
3772 return String.format('<b qtip="{1}" style="color:red;">{0}</b>',
3773 Roo.util.Format.number(v,3), tip);
3775 if (r.data.customer_price_each != v) {
3776 return String.format('<b qtip="{1}" style="color:pink;">{0}</b>',
3777 Roo.util.Format.number(v,3),
3778 "List Price = " + Roo.util.Format.number(r.data.customer_price_each * ( 1 + rate * 1 ),3)
3782 return String.format('<span qtip="{1}">{0}</span>', Roo.util.Format.number(v,3), tip);
3786 '|xns' : 'Roo.grid',
3787 xtype : 'ColumnModel',
3790 '|xns' : 'Roo.grid',
3791 xtype : 'GridEditor',
3793 decimalPrecision : 3,
3795 style : 'text-align:right',
3797 '|xns' : 'Roo.form',
3798 xtype : 'NumberField',
3800 focus : function (_self)
3802 if (this.value == 0.0) {
3803 this.el.dom.value = '';
3812 dataIndex : 'coitem_subtotal',
3813 header : _this._strings['c5eae6ea505388a73962c635ac821fba'] /* SubTotal */,
3814 renderer : function(v) {
3816 if (parseInt(v) < 1) {
3817 return String.format('<b style="color:red;">{0}</b>', Roo.util.Format.number(v,2));
3822 return Roo.util.Format.number( v, 2);
3826 '|xns' : 'Roo.grid',
3827 xtype : 'ColumnModel'
3831 dataIndex : 'coitem_subtotal_tax',
3832 header : _this._strings['236119342501b1e596bc82013c9cfc42'] /* SubTotal w/GST */,
3834 renderer : function(v,x,r) {
3836 if (parseInt(v) < 1) {
3837 return String.format('<b style="color:red;">{0}</b>', Roo.util.Format.number(v,2));
3840 return String.format('{0}', Roo.util.Format.number(v,2));
3844 '|xns' : 'Roo.grid',
3845 xtype : 'ColumnModel'
3849 builderCfg : '{\"table\":\"coitem\",\"column\":\"coitem_unitcost\",\"columnshort\":\"coitem_unitcost\",\"ctype\":\"numeric\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Unit Cost\"}',
3850 dataIndex : 'coitem_unitcost_in_order_cur',
3851 header : _this._strings['871080cb9d00a8bda1b9f1db3c164341'] /* Unit Cost */,
3852 renderer : function(v) { return Roo.util.Format.number( v, 2); },
3855 '|xns' : 'Roo.grid',
3856 xtype : 'ColumnModel'
3860 dataIndex : 'coitem_taxtype_id',
3861 header : _this._strings['13abfee28b4564e3fb059420fbedbec5'] /* Taxed */,
3862 renderer : function(v,x,r) { return String.format('{0}', r.data.coitem_taxtype_id_taxtype_name); },
3865 '|xns' : 'Roo.grid',
3866 xtype : 'ColumnModel',
3869 '|xns' : 'Roo.grid',
3870 xtype : 'GridEditor',
3873 displayField : 'taxtype_name',
3875 emptyText : _this._strings['b3c65c9f85b429821cf931b38386a64d'] /* Select Tax Type */,
3876 forceSelection : true,
3877 hiddenName : 'coitem_taxtype_id',
3879 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
3881 name : 'coitem_taxtype_id_taxtype_name',
3883 qtip : _this._strings['249ff431aa95198ad6814dd1d2799883'] /* Select taxtype */,
3884 queryParam : 'query[taxtype_id]',
3885 selectOnFocus : true,
3886 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{taxtype_name}</b> </div>',
3887 triggerAction : 'all',
3889 valueField : 'taxtype_id',
3892 '|xns' : 'Roo.form',
3896 sortInfo : { direction : 'ASC', field: 'taxtype_name' },
3898 '|xns' : 'Roo.data',
3901 beforeload : function (_self, o){
3902 o.params = o.params || {};
3910 url : baseURL + '/Roo/taxtype.php',
3912 '|xns' : 'Roo.data',
3916 fields : [{"name":"taxtype_id","type":"int"},"taxtype_name"],
3919 totalProperty : 'total',
3921 '|xns' : 'Roo.data',
3922 xtype : 'JsonReader'
3930 dataIndex : 'avail_qty',
3931 header : _this._strings['7eb17faabef94701775df7154f30684b'] /* #avail */,
3932 renderer : function(v,x,r) {
3934 var oq = parseInt(r.data.coitem_qtyord);
3935 var aq = parseInt(r.data.avail_qty);
3936 var sq = parseInt(r.data.coitem_qtyshipped);
3937 aq = isNaN(aq) ? 0 : aq;
3938 oq = isNaN(oq) ? 0 : oq;
3939 sq = isNaN(sq) ? 0 : sq;
3941 var unshipped = oq - sq;
3943 if ( aq < 0 || (unshipped > 0 && aq < unshipped)) {
3944 return String.format('<b style="color:red;">{0}</b>', parseInt(aq));
3947 return String.format('{0}', aq);
3952 '|xns' : 'Roo.grid',
3953 xtype : 'ColumnModel'
3957 builderCfg : '{\"table\":\"coitem\",\"column\":\"coitem_qtyreserved\",\"columnshort\":\"coitem_qtyreserved\",\"ctype\":\"numeric\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"#reserved\"}',
3958 dataIndex : 'shipitem_shipped',
3959 header : _this._strings['7ce96513eec175e6123b56573750b0dd'] /* #reserved */,
3960 renderer : function(v,x,r) {
3963 var vv = parseInt(v);
3964 vv = isNaN(vv) ? 0 : vv;
3966 var ov = parseInt(r.data.coitem_qtyord);
3967 ov = isNaN(ov) ? 0 : ov;
3969 var qs = parseInt(r.data.coitem_qtyshipped);
3970 qs = isNaN(qs) ? 0 : qs;
3975 // not enough reserved yet.
3976 return String.format('<b style="background-color:red;color:yellow">{0}</b>', vv - qs);
3979 return String.format('{0}', vv - qs);
3984 '|xns' : 'Roo.grid',
3985 xtype : 'ColumnModel'
3989 builderCfg : '{\"table\":\"coitem\",\"column\":\"coitem_qtyreserved\",\"columnshort\":\"coitem_qtyreserved\",\"ctype\":\"numeric\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"#reserved\"}',
3990 dataIndex : 'coitem_qtyshipped',
3991 header : _this._strings['6b15347cbd1bf352b547741a7525c1b4'] /* #shipped */,
3992 renderer : function(v,x,r) {
3994 var vv = parseInt(v);
3995 vv = isNaN(vv) ? 0 : vv;
3997 var ov = parseInt(r.data.coitem_qtyord);
3998 ov = isNaN(ov) ? 0 : ov;
4002 // not enought shipped.
4003 // or too many shipped.
4004 return String.format('<b style="background-color:red;color:yellow">{0}</b>', vv);
4009 return String.format('{0}', vv);
4014 '|xns' : 'Roo.grid',
4015 xtype : 'ColumnModel'
4019 dataIndex : 'cobill_billed',
4020 header : _this._strings['f3d90c6982143029487fb00d4ef19526'] /* #invoiced */,
4021 renderer : function(v,x,r) {
4023 var vv = parseInt(v);
4024 vv = isNaN(vv) ? 0 : vv;
4026 var ov = parseInt(r.data.coitem_qtyord);
4027 ov = isNaN(ov) ? 0 : ov;
4031 return String.format('<b style="background-color:red;color:yellow">{0}</b>', vv);
4033 return String.format('{0}', vv);
4038 '|xns' : 'Roo.grid',
4039 xtype : 'ColumnModel'
4046 title : _this._strings['50104a28589c5b6099d3580861c2551a'] /* Shipments / Invoices */,
4049 xtype : 'NestedLayoutPanel',
4051 activate : function (_self)
4053 _this.shipinvtab = _self;
4059 xtype : 'BorderLayout',
4064 xtype : 'LayoutRegion'
4068 title : _this._strings['607ff05a0e4c02c54b2262cd2e381aff'] /* Reserve Stock / Shipments */,
4071 xtype : 'LayoutRegion'
4076 builderCfg : '{\"cols\":[{\"table\":\"shiphead\",\"column\":\"shiphead_number\",\"columnshort\":\"shiphead_number\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"shiphead\",\"column\":\"shiphead_shipvia\",\"columnshort\":\"shiphead_shipvia\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"\"},{\"table\":\"shiphead\",\"column\":\"shiphead_shipdate\",\"columnshort\":\"shiphead_shipdate\",\"ctype\":\"date\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"shiphead\",\"column\":\"shiphead_sfstatus\",\"columnshort\":\"shiphead_sfstatus\",\"ctype\":\"bpchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"shiphead\",\"column\":\"shiphead_tracknum\",\"columnshort\":\"shiphead_tracknum\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}],\"cols_ex\":[\"shiphead_shipvia\"],\"table\":\"shiphead\",\"xtype\":\"GridPanel\",\"|xns\":\"Roo\"}',
4077 fitContainer : true,
4080 tableName : 'shiphead',
4081 title : _this._strings['f4757c5aca5e4410b63c6ec4cd0f2363'] /* shiphead */,
4084 xtype : 'GridPanel',
4086 activate : function() {
4087 _this.shippanel = this;
4088 if (_this.shipgrid) {
4089 _this.shipgrid.ds.load({});
4094 autoExpandColumn : 'shiphead_shipvia',
4095 builderCfg : '{\"cols\":[{\"table\":\"shiphead\",\"column\":\"shiphead_number\",\"columnshort\":\"shiphead_number\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"shiphead\",\"column\":\"shiphead_shipvia\",\"columnshort\":\"shiphead_shipvia\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"\"},{\"table\":\"shiphead\",\"column\":\"shiphead_shipdate\",\"columnshort\":\"shiphead_shipdate\",\"ctype\":\"date\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"shiphead\",\"column\":\"shiphead_sfstatus\",\"columnshort\":\"shiphead_sfstatus\",\"ctype\":\"bpchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"shiphead\",\"column\":\"shiphead_tracknum\",\"columnshort\":\"shiphead_tracknum\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}],\"cols_ex\":[\"shiphead_shipvia\"],\"table\":\"shiphead\",\"xtype\":\"GridPanel\",\"|xns\":\"Roo\"}',
4098 '|xns' : 'Roo.grid',
4103 _this.shipgrid = this;
4104 //_this.dialog = Pman.Dialog.FILL_IN
4105 if (_this.shippanel.active) {
4109 rowdblclick : function (_self, rowIndex, e)
4111 var rec = this.ds.getAt(rowIndex);
4112 if (!rec.json.shiphead_shipdate.length) {
4113 Roo.MessageBox.alert("Error", "You can not edit voided shipments, create a new one, and use the restore feature");
4117 Pman.Dialog.XtupleShipment.show({
4118 shiphead_id : rec.data.shiphead_id
4133 cls : 'x-btn-text-icon',
4134 icon : rootURL + '/Pman/templates/images/lock.gif',
4135 text : _this._strings['813f81532d71077e497863ec9faf16c7'] /* Confirm Shipment */,
4137 '|xns' : 'Roo.Toolbar',
4142 var sel = _this.shipgrid.getSelectionModel().getSelected();
4144 Roo.MessageBox.alert("Error", "Select a shipment");
4147 if (sel.data.shiphead_shipped) {
4148 Roo.MessageBox.alert("Error", "Shipment is already confirmed");
4153 // check current status of shipment..
4158 url : baseURL + '/Roo/shiphead',
4162 shiphead_id : sel.data.shiphead_id,
4165 success : function() {
4166 _this.shipgrid.ds.load({});
4175 cls : 'x-btn-text-icon',
4176 icon : rootURL + '/Pman/templates/images/save.gif',
4177 text : _this._strings['70c6ddcd97af88d0aaac48268c459727'] /* Download (as xls) */,
4179 '|xns' : 'Roo.Toolbar',
4184 var sel = _this.shipgrid.getSelectionModel().getSelected();
4186 Roo.MessageBox.alert("Error", "Select a shipment");
4191 // check current status of shipment..
4195 url : baseURL + '/Roo/shiphead',
4198 _download :sel.data.shiphead_id
4208 cls : 'x-btn-text-icon',
4209 icon : rootURL + '/Pman/templates/images/pdf.gif',
4210 text : _this._strings['8c6aab77edc5b8e589b36bcf989683e4'] /* Print Picking Slip */,
4212 '|xns' : 'Roo.Toolbar',
4217 var sel = _this.shipgrid.getSelectionModel().getSelected();
\r
4219 Roo.MessageBox.alert("Error", "Select a shipment");
\r
4222 // check current status of shipment..
4225 url : baseURL + '/Xtuple/Print',
4228 template : 'picking-slip',
4229 param : "shiphead_id:integer='" + sel.data.shiphead_id + "'",
4230 filename : 'picking-slip-' + sel.data.shiphead_number
4232 success : function() {
4243 cls : 'x-btn-text-icon',
4244 icon : rootURL + '/Pman/templates/images/pdf.gif',
4245 text : _this._strings['1b7132f58f9ee9de75e5778ff04f7303'] /* Print Delivery Note */,
4247 '|xns' : 'Roo.Toolbar',
4252 var sel = _this.shipgrid.getSelectionModel().getSelected();
\r
4254 Roo.MessageBox.alert("Error", "Select a shipment");
\r
4257 // check current status of shipment..
4260 url : baseURL + '/Xtuple/Print',
4263 template : 'delivery-note-',
4264 param : "shiphead_id:integer='" + sel.data.shiphead_id + "'",
4265 filename : 'delivery-note-' + sel.data.shiphead_number
4267 success : function() {
4278 cls : 'x-btn-text-icon',
4279 icon : Roo.rootURL + 'images/default/dd/email.gif',
4280 text : _this._strings['62f0de97dd70387d493350e45bfa5583'] /* Send Delivery Email */,
4282 '|xns' : 'Roo.Toolbar',
4287 var s = _this.shipgrid.getSelectionModel().getSelected();
4289 if(!s || s.data.shiphead_id * 1 < 1){
4290 Roo.MessageBox.alert('Error', 'Please select a shipment');
4296 url: baseURL+ '/Roo/shiphead',
4298 shiphead_id : s.data.shiphead_id,
4301 success : function() {
4302 Roo.MessageBox.alert('Notice', 'SENT');
4311 '|xns' : 'Roo.Toolbar',
4315 cls : 'x-btn-text-icon',
4316 icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
4317 text : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'] /* Add */,
4319 '|xns' : 'Roo.Toolbar',
4324 if (!_this.form.findField('cohead_id').getValue()) {
4325 Roo.MessageBox.alert("Error", "Save Order first");
4328 var rv = _this.form.getFieldValues();
4330 Pman.Dialog.XtupleShipmentNew.show({
4331 shiphead_order_id : rv.cohead_id,
4332 shiphead_shipdate : _this.form.findField('cohead_targetdate').getValue().format('Y-m-d')
4335 _this.shipgrid.ds.load({});
4339 render : function (_self)
4341 _this.addShipmentBtn = _self;
4346 cls : 'x-btn-text-icon',
4347 icon : rootURL + '/Pman/templates/images/trash.gif',
4348 text : _this._strings['9aa6071f39d387792476bd70fed66735'] /* Void / Unconfirm */,
4350 '|xns' : 'Roo.Toolbar',
4355 var sel = _this.shipgrid.getSelectionModel().getSelected();
4357 Roo.MessageBox.alert("Error", "Select a shipment");
4360 // check current status of shipment..
4362 var msg = sel.data.shiphead_shipped ?
4363 "Are you sure you want to un-confirm that shipment? - It will remove items from unposted invoices" :
4364 "Are you sure you want to void that shipment?";
4366 Roo.MessageBox.confirm("Are you sure", msg,
4374 url : baseURL + '/Roo/shiphead',
4378 shiphead_id : sel.data.shiphead_id,
4381 success : function() {
4382 _this.shipgrid.ds.load({});
4399 builderCfg : '{\"cols\":[{\"table\":\"shiphead\",\"column\":\"shiphead_number\",\"columnshort\":\"shiphead_number\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"shiphead\",\"column\":\"shiphead_shipvia\",\"columnshort\":\"shiphead_shipvia\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"\"},{\"table\":\"shiphead\",\"column\":\"shiphead_shipdate\",\"columnshort\":\"shiphead_shipdate\",\"ctype\":\"date\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"shiphead\",\"column\":\"shiphead_sfstatus\",\"columnshort\":\"shiphead_sfstatus\",\"ctype\":\"bpchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"shiphead\",\"column\":\"shiphead_tracknum\",\"columnshort\":\"shiphead_tracknum\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}],\"cols_ex\":[\"shiphead_shipvia\"],\"table\":\"shiphead\",\"xtype\":\"GridPanel\",\"|xns\":\"Roo\"}',
4401 sortInfo : { field : 'shiphead_shipvia', direction: 'ASC' },
4403 '|xns' : 'Roo.data',
4406 beforeload : function (_self, options)
4408 options.params = options.params || {};
4409 options.params.shiphead_order_id = _this.form.findField('cohead_id').getValue() * 1;
4410 if (options.params.shiphead_order_id < 1) {
4417 url : baseURL + '/Roo/shiphead.php',
4419 '|xns' : 'Roo.data',
4423 builderCfg : '{\"cols\":[{\"table\":\"shiphead\",\"column\":\"shiphead_number\",\"columnshort\":\"shiphead_number\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"shiphead\",\"column\":\"shiphead_shipvia\",\"columnshort\":\"shiphead_shipvia\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"\"},{\"table\":\"shiphead\",\"column\":\"shiphead_shipdate\",\"columnshort\":\"shiphead_shipdate\",\"ctype\":\"date\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"shiphead\",\"column\":\"shiphead_sfstatus\",\"columnshort\":\"shiphead_sfstatus\",\"ctype\":\"bpchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"shiphead\",\"column\":\"shiphead_tracknum\",\"columnshort\":\"shiphead_tracknum\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}],\"cols_ex\":[\"shiphead_shipvia\"],\"table\":\"shiphead\",\"xtype\":\"GridPanel\",\"|xns\":\"Roo\"}',
4426 'name': 'shiphead_number',
4430 'name': 'shiphead_shipvia',
4434 'name': 'shiphead_shipdate',
4438 'name': 'shiphead_sfstatus'
4441 'name': 'shiphead_tracknum',
4447 totalProperty : 'total',
4449 '|xns' : 'Roo.data',
4450 xtype : 'JsonReader'
4454 singleSelect : true,
4456 '|xns' : 'Roo.grid',
4457 xtype : 'RowSelectionModel'
4461 builderCfg : '{\"table\":\"shiphead\",\"column\":\"shiphead_number\",\"columnshort\":\"shiphead_number\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}',
4462 dataIndex : 'shiphead_number',
4463 header : _this._strings['b1bc248a7ff2b2e95569f56de68615df'] /* number */,
4464 renderer : function(v,x,r) {
4465 if (r.json.shiphead_shipdate.length) {
4466 return String.format('{0}', v);
4468 return String.format('<s>{0}</s>', v);
4472 '|xns' : 'Roo.grid',
4473 xtype : 'ColumnModel'
4476 dataIndex : 'shiphead_location_id_location_name',
4477 header : _this._strings['40e6e8652d174c7ceef48df46f9cf25a'] /* From Location */,
4478 renderer : function(v) { return String.format('{0}', v); },
4481 '|xns' : 'Roo.grid',
4482 xtype : 'ColumnModel'
4485 dataIndex : 'shiphead_shipto_id_shipto_name',
4486 header : _this._strings['74002cb040b036511b8d031da591364a'] /* Ship to */,
4487 renderer : function(v) { return String.format('{0}', v); },
4490 '|xns' : 'Roo.grid',
4491 xtype : 'ColumnModel'
4494 builderCfg : '{\"table\":\"shiphead\",\"column\":\"shiphead_shipdate\",\"columnshort\":\"shiphead_shipdate\",\"ctype\":\"date\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}',
4495 dataIndex : 'shiphead_shipdate',
4496 header : _this._strings['e963218370d6410e1ee0f8e6128c12d4'] /* shipdate */,
4497 renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); },
4500 '|xns' : 'Roo.grid',
4501 xtype : 'ColumnModel'
4504 builderCfg : '{\"table\":\"shiphead\",\"column\":\"shiphead_sfstatus\",\"columnshort\":\"shiphead_sfstatus\",\"ctype\":\"bpchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}',
4505 dataIndex : 'shiphead_sfstatus',
4506 header : _this._strings['ec53a8c4f07baed5d8825072c89799be'] /* Status */,
4507 renderer : function(v,x,r) {
4512 if (r.json.shiphead_shipdate.length) {
4514 if (r.json.shiphead_shipped) {
4518 return '<span style="color:red">Draft</span>';
4527 '|xns' : 'Roo.grid',
4528 xtype : 'ColumnModel'
4531 builderCfg : '{\"table\":\"shiphead\",\"column\":\"shiphead_shipvia\",\"columnshort\":\"shiphead_shipvia\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"\"}',
4532 dataIndex : 'shiphead_shipvia',
4533 header : _this._strings['37656f0f6cf5e5befb1ec7abd3db5804'] /* shipvia */,
4534 renderer : function(v) { return String.format('{0}', v); },
4537 '|xns' : 'Roo.grid',
4538 xtype : 'ColumnModel'
4541 builderCfg : '{\"table\":\"shiphead\",\"column\":\"shiphead_tracknum\",\"columnshort\":\"shiphead_tracknum\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}',
4542 dataIndex : 'shiphead_tracknum',
4543 header : _this._strings['58ec392a138714456f83d1288f553099'] /* tracknum */,
4544 renderer : function(v) { return String.format('{0}', v); },
4547 '|xns' : 'Roo.grid',
4548 xtype : 'ColumnModel'
4555 fitContainer : true,
4558 tableName : 'cobmisc',
4559 title : _this._strings['fce9a6a1bd2a2050eb86d33103f46fd3'] /* Invoices */,
4562 xtype : 'GridPanel',
4564 activate : function() {
4565 _this.invpanel = this;
4566 if (_this.invgrid) {
4567 _this.invgrid.ds.load({});
4572 autoExpandColumn : 'invchead_invcnumber',
4573 builderCfg : '{\"cols\":[{\"table\":\"invchead\",\"column\":\"invchead_invcnumber\",\"columnshort\":\"invchead_invcnumber\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"\"},{\"table\":\"invchead\",\"column\":\"invchead_invcdate\",\"columnshort\":\"invchead_invcdate\",\"ctype\":\"date\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}],\"cols_ex\":[\"invchead_invcnumber\"],\"table\":\"invchead\",\"xtype\":\"GridPanel\",\"|xns\":\"Roo\"}',
4576 '|xns' : 'Roo.grid',
4581 _this.invgrid = this;
4582 //_this.dialog = Pman.Dialog.FILL_IN
4583 if (_this.invpanel.active) {
4587 rowdblclick : function (_self, rowIndex, e)
4590 var ri = this.ds.getAt(rowIndex);
4591 if ( ri.data.cobmisc_id < 0) { // skip summary row..
4594 var rv = _this.form.getFieldValues();
4595 Pman.Dialog.XtupleInvoice.show({
4596 cobmisc_id : ri.data.cobmisc_id,
4597 // below parms for add credit memo
4599 cm_cust_id : rv.cohead_cust_id,
4600 cm_cust_id_cust_name : rv.cohead_cust_id_cust_name,
4601 cm_curr_id : rv.cohead_curr_id,
4602 cm_curr_id_curr_name : rv.cohead_curr_id_curr_name,
4603 cm_terms_id : rv.cohead_terms_id,
4604 cm_terms_id_terms_descrip : rv.cohead_terms_id_terms_descrip,
4605 cm_salesrep_id : rv.cohead_salesrep_id,
4606 cm_salesrep_id_salesrep_name : rv.cohead_salesrep_id_salesrep_name,
4607 cm_docdate : new Date(),
4608 cm_taxzone_id : rv.cohead_taxzone_id,
4609 cm_taxzone_id_taxzone_descrip : rv.cohead_taxzone_id_taxzone_descrip,
4610 cm_billto_cntct_id : rv.cohead_billto_cntct_id,
4611 cm_billto_cntct_id_cntct_name : rv.cohead_billto_cntct_id_cntct_name,
4612 cm_location_src : rv.cohead_location_src,
4613 cm_location_src_location_name : rv.cohead_location_src_location_name,
4614 cm_billto_address : rv.billto_address
4618 _this.invgrid.ds.load({});
4629 cls : 'x-btn-text-icon',
4630 icon : rootURL + '/Pman/templates/images/lock.gif',
4631 text : _this._strings['b8feb9ee933bc5cc05615860322e9e7a'] /* Post Invoice */,
4633 '|xns' : 'Roo.Toolbar',
4639 var sel = _this.invgrid.getSelectionModel().getSelected();
4641 Roo.MessageBox.alert("Error", "Select a invoice");
4644 // check current status of shipment..
4646 Roo.MessageBox.confirm("Are you sure", "Are you sure you want to Post that invoice?",
4653 url : baseURL + '/Roo/cobmisc',
4656 cobmisc_id : sel.data.cobmisc_id,
4659 success : function() {
4660 _this.invgrid.ds.load({});
4673 cls : 'x-btn-text-icon',
4674 icon : rootURL + '/Pman/templates/images/pdf.gif',
4675 text : _this._strings['13dba24862cf9128167a59100e154c8d'] /* Print */,
4677 '|xns' : 'Roo.Toolbar',
4681 '|xns' : 'Roo.menu',
4685 text : _this._strings['f97f673be4e5f66aca62b35280d8bcde'] /* Print Standard Invoice */,
4687 '|xns' : 'Roo.menu',
4693 var sel = _this.invgrid.getSelectionModel().getSelected();
4695 Roo.MessageBox.alert("Error", "Select a invoice");
4698 if (!sel.data.cobmisc_invchead_id) {
4699 Roo.MessageBox.alert("Error", "Invoice has not been posted");
4702 // check current status of shipment..
4705 url : baseURL + '/Roo/invchead',
4708 invchead_id : sel.data.cobmisc_invchead_id,
4711 success : function() {
4722 hidden : !(baseURL.match(/(hk\.php|cn\.php)$/)),
4723 text : _this._strings['0ee182201463a0ea31cb073b227fbbbe'] /* Print Chinese Invoice With GST in line item */,
4725 '|xns' : 'Roo.menu',
4728 click : function (_self, e)
4731 var sel = _this.invgrid.getSelectionModel().getSelected();
4733 Roo.MessageBox.alert("Error", "Select a invoice");
4736 if (!sel.data.cobmisc_invchead_id) {
4737 Roo.MessageBox.alert("Error", "Invoice has not been posted");
4740 // check current status of shipment..
4743 url : baseURL + '/Roo/invchead',
4746 invchead_id : sel.data.cobmisc_invchead_id,
4750 success : function() {
4760 hidden : !(baseURL.match(/(hk\.php|cn\.php)$/)),
4761 text : _this._strings['6ac26fe4e9a39ac45fffe6d6920dac3a'] /* Print Chinese Invoice */,
4763 '|xns' : 'Roo.menu',
4766 click : function (_self, e)
4769 var sel = _this.invgrid.getSelectionModel().getSelected();
4771 Roo.MessageBox.alert("Error", "Select a invoice");
4774 if (!sel.data.cobmisc_invchead_id) {
4775 Roo.MessageBox.alert("Error", "Invoice has not been posted");
4778 // check current status of shipment..
4781 url : baseURL + '/Roo/invchead',
4784 invchead_id : sel.data.cobmisc_invchead_id,
4788 success : function() {
4798 hidden : !(baseURL.match(/au\.php$/)),
4799 text : _this._strings['69193f49683ba5a928ae8a27328105ba'] /* Print Aus - GST included Invoice */,
4801 '|xns' : 'Roo.menu',
4804 click : function (_self, e)
4807 var sel = _this.invgrid.getSelectionModel().getSelected();
4809 Roo.MessageBox.alert("Error", "Select a invoice");
4812 if (!sel.data.cobmisc_invchead_id) {
4813 Roo.MessageBox.alert("Error", "Invoice has not been posted");
4816 // check current status of shipment..
4819 url : baseURL + '/Roo/invchead',
4822 invchead_id : sel.data.cobmisc_invchead_id,
4826 success : function() {
4836 hidden : !(baseURL.match(/au\.php$/)),
4837 text : _this._strings['3d96cc39e5517a284e203ffc8cafcf51'] /* Print Bambini Pronto Invoice */,
4839 '|xns' : 'Roo.menu',
4842 click : function (_self, e)
4844 var sel = _this.invgrid.getSelectionModel().getSelected();
4846 Roo.MessageBox.alert("Error", "Select a invoice");
4849 if (!sel.data.cobmisc_invchead_id) {
4850 Roo.MessageBox.alert("Error", "Invoice has not been posted");
4853 // check current status of shipment..
4856 url : baseURL + '/Roo/invchead',
4859 invchead_id : sel.data.cobmisc_invchead_id,
4871 hidden : !(baseURL.match(/au\.php$/)),
4872 text : _this._strings['c6b4fd215b0cdcb7426519edc0ece828'] /* Print Bambini Pro Forma Invoice */,
4874 '|xns' : 'Roo.menu',
4877 click : function (_self, e)
4880 var sel = _this.invgrid.getSelectionModel().getSelected();
4882 Roo.MessageBox.alert("Error", "Select a invoice");
4885 if (!sel.data.cobmisc_invchead_id) {
4886 Roo.MessageBox.alert("Error", "Invoice has not been posted");
4889 // check current status of shipment..
4892 url : baseURL + '/Roo/invchead',
4895 invchead_id : sel.data.cobmisc_invchead_id,
4896 _print : 'au-proforma'
4899 success : function() {
4909 hidden : !( baseURL.match(/au\.php$/)),
4910 text : _this._strings['46fc12727bf2c5cc79988ab857ad73b4'] /* Print Shipping / Commercial Invoice */,
4912 '|xns' : 'Roo.menu',
4915 click : function (_self, e)
4917 var sel = _this.invgrid.getSelectionModel().getSelected();
4919 Roo.MessageBox.alert("Error", "Select a invoice");
4923 Pman.Dialog.XtupleDiscountOfInvoice.show({invchead_id : sel.data.cobmisc_invchead_id}, function(){
4933 cls : 'x-btn-text-icon',
4934 icon : Roo.rootURL + 'images/default/tree/leaf.gif',
4935 text : _this._strings['d682c376c82f68bc65dcd05570d04dfc'] /* Payments / Refunds / Credit Memos */,
4937 '|xns' : 'Roo.Toolbar',
4941 '|xns' : 'Roo.menu',
4945 cls : 'x-btn-text-icon',
4946 icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
4947 text : _this._strings['01d35df7886d24900b1ecb65da6bf21d'] /* Receive Payment */,
4949 '|xns' : 'Roo.menu',
4952 click : function(_self,e)
4955 var sel = _this.invgrid.getSelectionModel().getSelected();
4956 if (!sel || sel.data.cobmisc_id < 1) {
4957 Roo.MessageBox.alert("Error", "Select a invoice");
4960 if(!sel.data.cobmisc_posted){
4961 Roo.MessageBox.alert("Error", "This invoice has not been posted!");
4964 if(sel.data.cobmisc_outstanding == 0){
4965 Roo.MessageBox.alert("Error", "There is no any outstanding of this invoice!");
4969 var cust_id = _this.form.findField('cohead_cust_id').getValue();
4974 cashrcpt_amount : sel.data.cobmisc_outstanding,
4975 cashrcpt_cust_id : cust_id,
4976 cashrcpt_aropen_id : sel.data.cobmisc_aropen_id_aropen_id,
4977 cashrcpt_distdate : new Date(),
4978 cashrcpt_fundstype : 'C',
4979 cashrcpt_curr_id : sel.data.cobmisc_curr_id_curr_id,
4980 cashrcpt_curr_id_curr_name : sel.data.cobmisc_curr_id_curr_name,
4981 cashrcpt_usecustdeposit : true,
4982 cashrcpt_docdate : new Date(),
4983 cashrcpt_salescat_id : -1,
4984 cashrcpt_applydate : new Date(),
4985 cashrcpt_discount : 0
4987 Pman.Dialog.XtupleReceivePayment.show( data , function() {
4988 _this.invgrid.ds.load({});
4994 cls : 'x-btn-text-icon',
4995 icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
4996 text : _this._strings['526db6366257755024ed2556000871bc'] /* Issue Refund */,
4998 '|xns' : 'Roo.menu',
5001 click : function(_self,e)
5003 var sel = _this.invgrid.getSelectionModel().getSelected();
5004 if (!sel || sel.data.cobmisc_cobapply_aropen_id < 1) {
5005 Roo.MessageBox.alert("Error", "Select a credit memo");
5008 if(!sel.data.cobmisc_posted){
5009 Roo.MessageBox.alert("Error", "The invoice that credit memo has been applied to has been not posted");
5012 var cust_id = _this.form.findField('cohead_cust_id').getValue();
5017 if(!sel.data.cobmisc_outstanding || sel.data.cobmisc_outstanding == 0){
5018 Roo.MessageBox.alert("Error", "The amount of this credit memo is 0!");
5022 var d = _this.form.getFieldValues();
5025 'checkhead_recip_id' : cust_id,
5026 'checkhead_recip_type' : 'C',
5027 'checkhead_checkdate' : new Date(),
5028 'checkhead_amount' : sel.data.cobmisc_outstanding,
5029 'remaining_total' : sel.data.cobmisc_outstanding,
5030 'checkhead_curr_id' : d.cohead_curr_id,
5031 'checkhead_curr_id_curr_name' : d.cohead_curr_id_curr_name,
5032 'checkhead_misc' : true,
5033 'aropen_id' : sel.data.cobmisc_cobapply_aropen_id,
5034 'cmhead_number' : sel.data.cobmisc_invchead_id_invchead_invcnumber,
5035 'cust_name' : d.cohead_cust_id_cust_name,
5036 '_create_and_post' : 1
5041 Pman.Dialog.XtupleMiscellaneousCheck.show( data , function() {
5042 _this.invgrid.ds.load({});
5049 '|xns' : 'Roo.menu',
5053 cls : 'x-btn-text-icon',
5054 icon : rootURL + '/Pman/templates/images/trash.gif',
5055 text : _this._strings['2142511303396bd51e0cc25ea8ffe47f'] /* Void Payment */,
5057 '|xns' : 'Roo.menu',
5060 click : function(_self,e)
5062 var sel = _this.invgrid.getSelectionModel().getSelected();
5063 if (!sel || sel.data.cobmisc_cashrcpt_id * 1 < 1) {
5064 Roo.MessageBox.alert("Error", "Select a Receive Payment");
5068 Roo.MessageBox.confirm("Confirm", "Voiding receipt will mean you will have to re-enter the receipt refund - " +
5069 "please take note of the details so you can enter it again correctly later.", function(r) {
5075 url : baseURL + '/Roo/cashrcpt',
5078 cashrcpt_id : sel.data.cobmisc_cashrcpt_id,
5081 success : function()
5083 _this.invgrid.ds.load({});
5095 cls : 'x-btn-text-icon',
5096 icon : rootURL + '/Pman/templates/images/trash.gif',
5097 text : _this._strings['052fbb9431206b4755090dc53fcef300'] /* Void Refund */,
5099 '|xns' : 'Roo.menu',
5102 click : function(_self,e)
5104 var sel = _this.invgrid.getSelectionModel().getSelected();
5105 if (!sel || sel.data.cobmisc_checkhead_id * 1 < 1) {
5106 Roo.MessageBox.alert("Error", "Select a Miscellaneours Check");
5110 Roo.MessageBox.confirm("Confirm", "Voiding refund will mean you will have to re-enter the receipt refund - " +
5111 "please take note of the details so you can enter it again correctly later.", function(r) {
5117 url : baseURL + '/Roo/checkhead',
5120 checkhead_id : sel.data.cobmisc_checkhead_id,
5123 success : function()
5125 _this.invgrid.ds.load({});
5137 cls : 'x-btn-text-icon',
5138 icon : rootURL + '/Pman/templates/images/trash.gif',
5139 text : _this._strings['4b5a5a93e13bd338d40cf4bae2ca51cb'] /* Void Credit Memo */,
5141 '|xns' : 'Roo.menu',
5144 click : function(_self,e)
5146 var sel = _this.invgrid.getSelectionModel().getSelected();
5147 if (!sel || sel.data.cobmisc_cobapply_aropen_id < 1) {
5148 Roo.MessageBox.alert("Error", "Select a credit memo");
5152 if(sel.data.cobmisc_posted){
5153 Roo.MessageBox.alert("Error", "You cann't void this credit memo, since the invoice that credit memo has been applied to has been posted");
5157 if (sel.data.cobmisc_cobapply_id < 1) {
5158 Roo.MessageBox.alert("Error", "invaild credit memo");
5161 Roo.MessageBox.confirm("Confirm", "Are you sure want to void this applied credit memo, " +
5162 "it will also void all the check that belongs to this credit memo ", function(r) {
5168 url : baseURL + '/Roo/cobapply',
5171 _delete : sel.data.cobmisc_cobapply_id,
5174 success : function()
5176 _this.invgrid.ds.load({});
5191 '|xns' : 'Roo.Toolbar',
5195 cls : 'x-btn-text-icon',
5196 icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
5197 text : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'] /* Add */,
5199 '|xns' : 'Roo.Toolbar',
5205 if (!_this.form.findField('cohead_id').getValue()) {
5206 Roo.MessageBox.alert("Error", "Save Order first");
5210 var rv = _this.form.getFieldValues();
5213 Pman.Dialog.XtupleInvoice.show({
5214 cobmisc_cohead_id : rv.cohead_id,
5215 cobmisc_shipdate : _this.form.findField('cohead_targetdate').getValue(),
5216 cobmisc_invcdate : _this.form.findField('cohead_targetdate').getValue(),
5217 cobmisc_curr_id : rv.cohead_curr_id,
5218 cobmisc_curr_id_curr_name : rv.cohead_curr_id_curr_name,
5219 // below parms for add credit memo
5221 cm_cust_id : rv.cohead_cust_id,
5222 cm_cust_id_cust_name : rv.cohead_cust_id_cust_name,
5223 cm_curr_id : rv.cohead_curr_id,
5224 cm_curr_id_curr_name : rv.cohead_curr_id_curr_name,
5225 cm_terms_id : rv.cohead_terms_id,
5226 cm_terms_id_terms_descrip : rv.cohead_terms_id_terms_descrip,
5227 cm_salesrep_id : rv.cohead_salesrep_id,
5228 cm_salesrep_id_salesrep_name : rv.cohead_salesrep_id_salesrep_name,
5229 cm_docdate : new Date(),
5230 cm_taxzone_id : rv.cohead_taxzone_id,
5231 cm_taxzone_id_taxzone_descrip : rv.cohead_taxzone_id_taxzone_descrip,
5232 cm_billto_cntct_id : rv.cohead_billto_cntct_id,
5233 cm_billto_cntct_id_cntct_name : rv.cohead_billto_cntct_id_cntct_name,
5234 cm_location_src : rv.cohead_location_src,
5235 cm_location_src_location_name : rv.cohead_location_src_location_name,
5236 cm_billto_address : rv.billto_address
5241 _this.invgrid.ds.load({});
5245 render : function (_self)
5247 _this.addInvoiceBtn = _self;
5252 cls : 'x-btn-text-icon',
5253 icon : rootURL + '/Pman/templates/images/trash.gif',
5254 text : _this._strings['b25f6c965342495f74899e183efe20a4'] /* Void / Unpost */,
5256 '|xns' : 'Roo.Toolbar',
5262 var sel = _this.invgrid.getSelectionModel().getSelected();
5264 Roo.MessageBox.alert("Error", "Select a invoice");
5267 // check current status of shipment..
5270 // cobmisc_id : sel.data.cobmisc_id,
5273 if (sel.data.cobmisc_id * 1) {
5274 params.cobmisc_id = sel.data.cobmisc_id * 1 ;
5276 if (sel.data.cobmisc_invchead_id_invchead_id * 1) {
5277 params.invchead_id = sel.data.cobmisc_invchead_id_invchead_id * 1;
5280 Roo.MessageBox.confirm("Are you sure", "Are you sure you want to VOID that invoice?",
5287 url : baseURL + '/Roo/cobmisc',
5290 success : function() {
5291 _this.invgrid.ds.load({});
5307 sortInfo : { field : 'invchead_invcnumber', direction: 'ASC' },
5309 '|xns' : 'Roo.data',
5312 beforeload : function (_self, options)
5315 options.params = options.params || {};
5316 options.params.cobmisc_cohead_id = _this.form.findField('cohead_id').getValue() * 1;
5317 if (options.params.cobmisc_cohead_id < 1) {
5321 options.params._with_other_payment = 1;
5322 //options.params['query[invchead_ordernumber]'] = _this.form.findField('cohead_number').getValue()
5325 load : function (_self, records, options)
5330 var totalfreight = 0.0;
5331 var totalmisc = 0.0;
5334 Roo.each(records, function(r)
5336 if(r.data.cobmisc_id > 1){
5337 done += parseInt(r.data.cobmisc_qty);
5338 totalic += parseFloat(r.data.cobmisc_itemcost).toFixed(2)*1;
5339 totalmisc += parseFloat(r.data.cobmisc_misc).toFixed(2)*1;
5340 totalfreight += parseFloat(r.data.cobmisc_freight).toFixed(2)*1;
5341 totaltax += parseFloat(r.data.cobmisc_tax).toFixed(2)*1;
5342 total = parseInt(r.data.cobmisc_total_qty);
5347 _this.shipinvtab.layout.getRegion('center').getPanel(0).setTitle(
5349 "Invoices (Complete)" :
5350 ("Invoices prepared for " + done + '/' + total)
5354 var frtotal = (parseFloat(_this.form.findField('cohead_freight').getValue()) - totalfreight).toFixed(2);
5355 var misctotal = (parseFloat(_this.form.findField('cohead_misc').getValue()) - totalmisc).toFixed(2);
5356 var ictotal = (parseFloat(_this.form.findField('cohead_subtotal').getValue()) - totalic).toFixed(2);
5357 var taxtotal = (parseFloat(_this.form.findField('cohead_tax').getValue()) - totaltax).toFixed(2);
5358 var remtotal = frtotal*1 + misctotal*1 + ictotal*1 + taxtotal*1;
5360 var nr = this.reader.newRow({
5362 cobmisc_invchead_id_invchead_invcnumber : "Total Remaining",
5363 cobmisc_qty : total - done,
5364 cobmisc_freight :frtotal,
5365 cobmisc_misc : misctotal,
5366 cobmisc_itemcost : ictotal,
5367 cobmisc_tax : taxtotal,
5368 cobmisc_total : remtotal
5372 // do we need to add it somehow??
5373 _this.invgrid.ds.add(nr);
5378 url : baseURL + '/Roo/cobmisc.php',
5380 '|xns' : 'Roo.data',
5384 builderCfg : '{\"cols\":[{\"table\":\"invchead\",\"column\":\"invchead_invcnumber\",\"columnshort\":\"invchead_invcnumber\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"\"},{\"table\":\"invchead\",\"column\":\"invchead_invcdate\",\"columnshort\":\"invchead_invcdate\",\"ctype\":\"date\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}],\"cols_ex\":[\"invchead_invcnumber\"],\"table\":\"invchead\",\"xtype\":\"GridPanel\",\"|xns\":\"Roo\"}',
5387 'name': 'invchead_invcnumber',
5391 'name': 'invchead_invcdate',
5397 totalProperty : 'total',
5399 '|xns' : 'Roo.data',
5400 xtype : 'JsonReader'
5405 dataIndex : 'cobmisc_invchead_id_invchead_invcnumber',
5406 header : _this._strings['42f6d99a2dddc4858882ed8e9a210b52'] /* Invoice # */,
5407 renderer : function(v,x,r) {
5409 r.data.cobmisc_invchead_id_invchead_id * 1 &&
5410 !r.data.cobmisc_invchead_id_invchead_posted) {
5411 return '<span style="color:red">' +
5412 "NEEDS Voiding then re-posted: " +
5413 String.format('{0}', v) +
5417 if(v && r.data.cobmisc_id == -2){
5418 return String.format('<span style="margin-left: 10px;"> - {0} (Credit Memo)</span>', v);
5420 if(v && r.data.cobmisc_id == -3){
5421 return String.format('<span style="margin-left: 20px;"> - {0} (Miscellaneous Check)</span>', v);
5423 if(v && r.data.cobmisc_id == -4){
5424 return String.format('<span style="margin-left: 10px;"> - {0} (Receive Payment to {2}) [ {1} ]</span>',
5425 v, r.data.cobmisc_cashrcpt_amount, r.json.cashrcpt_bankaccnt_id_bankaccnt_bankname);
5428 return v ? String.format('{0}', v) :
5429 '<span style="color:red">' + "Not Posted" + '</span>';
5433 '|xns' : 'Roo.grid',
5434 xtype : 'ColumnModel'
5437 builderCfg : '{\"table\":\"invchead\",\"column\":\"invchead_invcdate\",\"columnshort\":\"invchead_invcdate\",\"ctype\":\"date\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}',
5438 dataIndex : 'cobmisc_invcdate',
5439 header : _this._strings['3a6a3353e3b44ad5359c8e3178b66a54'] /* invcdate */,
5440 renderer : function(v,x,r) {
5442 return String.format('{0}', v && v.format ? v.format('d/M/Y') : '');
5446 '|xns' : 'Roo.grid',
5447 xtype : 'ColumnModel'
5451 dataIndex : 'cobmisc_qty',
5452 header : _this._strings['03ab340b3f99e03cff9e84314ead38c0'] /* Qty */,
5453 renderer : function(v) { return String.format('{0}', v ? parseInt(v) : 0); },
5456 '|xns' : 'Roo.grid',
5457 xtype : 'ColumnModel'
5461 dataIndex : 'cobmisc_itemcost',
5462 header : _this._strings['757989a16207ab23076685118640adf3'] /* Item Cost */,
5463 renderer : function(v) { return String.format('{0}', v ? (1.0*v).toFixed(2) : 0); },
5466 '|xns' : 'Roo.grid',
5467 xtype : 'ColumnModel'
5471 dataIndex : 'cobmisc_freight',
5472 header : _this._strings['ea9cf7e47ff33b2be14e6dd07cbcefc6'] /* Shipping */,
5473 renderer : function(v) { return String.format('{0}', v ? (1.0*v).toFixed(2) : ''); },
5476 '|xns' : 'Roo.grid',
5477 xtype : 'ColumnModel'
5481 dataIndex : 'cobmisc_tax',
5482 header : _this._strings['4b78ac8eb158840e9638a3aeb26c4a9d'] /* Tax */,
5483 renderer : function(v,x,r) {
5485 // tax is based on the % itemcost..
5486 // var ic = r.data.cobmisc_itemcost;
5488 var ic =r.data.cobmisc_itemcost - (1* r.data.cobmisc_itemcost_taxfree);
5490 var tax= _this.form.findField('cohead_tax').getValue() * 1.0;
5491 var totic = _this.form.findField('cohead_subtotal').getValue() * 1.0;
5495 var taxp = tax / totic;
5498 return String.format('{0}', (1.0*v).toFixed(2) );
5504 '|xns' : 'Roo.grid',
5505 xtype : 'ColumnModel'
5509 dataIndex : 'cobmisc_cohead_id_cohead_pretax_discount',
5510 header : _this._strings['a763436d2b30d54e4aff264b1636827a'] /* Discount (Pretax) */,
5511 renderer : function(v) { return String.format('{0}', v ? (1.0*v).toFixed(2) : 0); },
5514 '|xns' : 'Roo.grid',
5515 xtype : 'ColumnModel'
5519 dataIndex : 'cobmisc_misc',
5520 header : _this._strings['bb4af85913879b95661b81570a2c2e83'] /* Discount (Posttax) */,
5521 renderer : function(v,x,r)
5523 var vv = v - r.data.cobmisc_cohead_id_cohead_pretax_discount;
5525 return String.format('{0}', vv ? (1.0*vv).toFixed(2) : 0);
5529 '|xns' : 'Roo.grid',
5530 xtype : 'ColumnModel'
5534 dataIndex : 'cobmisc_total',
5535 header : _this._strings['09466661df2abefeecf849e52fce8fb4'] /* Total */,
5536 renderer : function(v,x,r) {
5539 var ic = r.data.cobmisc_itemcost;
5540 var tax= _this.form.findField('cohead_tax').getValue() * 1.0;
5541 var totic = _this.form.findField('cohead_subtotal').getValue() * 1.0;
5544 var taxp = tax / totic;
5552 return String.format('{0}',(v * 1.0).toFixed(2) );
5556 return String.format('{0}',
5557 ((d.cobmisc_itemcost * 1.0) +
5558 (d.cobmisc_freight * 1.0) +
5559 (d.cobmisc_tax * 1.0) +
5560 (d.cobmisc_misc * 1.0)
5566 '|xns' : 'Roo.grid',
5567 xtype : 'ColumnModel'
5571 dataIndex : 'cobmisc_outstanding',
5572 header : _this._strings['a860ed9926b241b7d4dca2d00610ab2c'] /* Outstanding */,
5573 renderer : function(v,x,r)
5576 return String.format('{0}', v ? (v * 1.0).toFixed(2) : 0 );
5580 '|xns' : 'Roo.grid',
5581 xtype : 'ColumnModel'
5591 builderCfg : '{\"cols\":[{\"table\":\"events\",\"column\":\"event_when\",\"columnshort\":\"event_when\",\"ctype\":\"timestamp\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"events\",\"column\":\"action\",\"columnshort\":\"action\",\"ctype\":\"varchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"events\",\"column\":\"ipaddr\",\"columnshort\":\"ipaddr\",\"ctype\":\"varchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"person\",\"column\":\"person_id_name\",\"columnshort\":\"name\",\"ctype\":\"varchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"events\",\"column\":\"remarks\",\"columnshort\":\"remarks\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"\"}],\"cols_ex\":[\"remarks\"],\"table\":\"events\",\"xtype\":\"GridPanel\",\"|xns\":\"Roo\"}',
5592 fitContainer : true,
5595 tableName : 'events',
5596 title : _this._strings['16d2b386b2034b9488996466aaae0b57'] /* History */,
5599 xtype : 'GridPanel',
5601 activate : function() {
5602 _this.hpanel = this;
5604 _this.hgrid.footer.onClick('first');
5609 autoExpandColumn : 'remarks',
5610 builderCfg : '{\"cols\":[{\"table\":\"events\",\"column\":\"event_when\",\"columnshort\":\"event_when\",\"ctype\":\"timestamp\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"events\",\"column\":\"action\",\"columnshort\":\"action\",\"ctype\":\"varchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"events\",\"column\":\"ipaddr\",\"columnshort\":\"ipaddr\",\"ctype\":\"varchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"person\",\"column\":\"person_id_name\",\"columnshort\":\"name\",\"ctype\":\"varchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"events\",\"column\":\"remarks\",\"columnshort\":\"remarks\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"\"}],\"cols_ex\":[\"remarks\"],\"table\":\"events\",\"xtype\":\"GridPanel\",\"|xns\":\"Roo\"}',
5613 '|xns' : 'Roo.grid',
5619 //_this.dialog = Pman.Dialog.FILL_IN
5620 if (_this.hpanel.active) {
5621 this.footer.onClick('first');
5624 rowdblclick : function (_self, rowIndex, e)
5626 if (!_this.dialog) return;
5627 _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {
5628 _this.grid.footer.onClick('first');
5634 displayMsg : _this._strings['089ba2b5edc96565fc22c584ecfbb1a6'] /* Displaying events{0} - {1} of {2} */,
5635 emptyMsg : _this._strings['594f5bdc5e1519ce9934d276e5bf081f'] /* No events found */,
5639 xtype : 'PagingToolbar'
5642 builderCfg : '{\"cols\":[{\"table\":\"events\",\"column\":\"event_when\",\"columnshort\":\"event_when\",\"ctype\":\"timestamp\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"events\",\"column\":\"action\",\"columnshort\":\"action\",\"ctype\":\"varchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"events\",\"column\":\"ipaddr\",\"columnshort\":\"ipaddr\",\"ctype\":\"varchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"person\",\"column\":\"person_id_name\",\"columnshort\":\"name\",\"ctype\":\"varchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"events\",\"column\":\"remarks\",\"columnshort\":\"remarks\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"\"}],\"cols_ex\":[\"remarks\"],\"table\":\"events\",\"xtype\":\"GridPanel\",\"|xns\":\"Roo\"}',
5644 sortInfo : { field : 'event_when', direction: 'DESC' },
5646 '|xns' : 'Roo.data',
5649 beforeload : function (_self, options)
5651 options.params._related_on_table = 'cohead';
5652 options.params._related_on_id = _this.form.findField('cohead_id').getValue();
5657 url : baseURL + '/Roo/events.php',
5659 '|xns' : 'Roo.data',
5663 builderCfg : '{\"cols\":[{\"table\":\"events\",\"column\":\"event_when\",\"columnshort\":\"event_when\",\"ctype\":\"timestamp\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"events\",\"column\":\"action\",\"columnshort\":\"action\",\"ctype\":\"varchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"events\",\"column\":\"ipaddr\",\"columnshort\":\"ipaddr\",\"ctype\":\"varchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"person\",\"column\":\"person_id_name\",\"columnshort\":\"name\",\"ctype\":\"varchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"events\",\"column\":\"remarks\",\"columnshort\":\"remarks\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"\"}],\"cols_ex\":[\"remarks\"],\"table\":\"events\",\"xtype\":\"GridPanel\",\"|xns\":\"Roo\"}',
5666 'name': 'event_when',
5678 'name': 'person_id_name',
5688 totalProperty : 'total',
5690 '|xns' : 'Roo.data',
5691 xtype : 'JsonReader'
5696 builderCfg : '{\"table\":\"events\",\"column\":\"event_when\",\"columnshort\":\"event_when\",\"ctype\":\"timestamp\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}',
5697 dataIndex : 'event_when',
5698 header : _this._strings['820dbd2b8f606aff866c0bbfb6b737c1'] /* Changed */,
5699 renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y H:i:s') : ''); },
5702 '|xns' : 'Roo.grid',
5703 xtype : 'ColumnModel'
5706 builderCfg : '{\"table\":\"events\",\"column\":\"action\",\"columnshort\":\"action\",\"ctype\":\"varchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}',
5707 dataIndex : 'action',
5708 header : _this._strings['418c5509e2171d55b0aee5c2ea4442b5'] /* action */,
5709 renderer : function(v,x,r) { return String.format('{0} - {1}', v, r.data.on_table); },
5712 '|xns' : 'Roo.grid',
5713 xtype : 'ColumnModel'
5716 builderCfg : '{\"table\":\"events\",\"column\":\"ipaddr\",\"columnshort\":\"ipaddr\",\"ctype\":\"varchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}',
5717 dataIndex : 'ipaddr',
5718 header : _this._strings['75ba8d70e3692ba200f0e0df37b4d2ae'] /* IP address */,
5719 renderer : function(v) { return String.format('{0}', v); },
5722 '|xns' : 'Roo.grid',
5723 xtype : 'ColumnModel'
5726 builderCfg : '{\"table\":\"person\",\"column\":\"person_id_name\",\"columnshort\":\"name\",\"ctype\":\"varchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}',
5727 dataIndex : 'person_id_name',
5728 header : _this._strings['4ee972120bcda675f75222c87cb9d356'] /* Who */,
5729 renderer : function(v) { return String.format('{0}', v); },
5732 '|xns' : 'Roo.grid',
5733 xtype : 'ColumnModel'
5736 builderCfg : '{\"table\":\"events\",\"column\":\"remarks\",\"columnshort\":\"remarks\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"\"}',
5737 dataIndex : 'remarks',
5738 header : _this._strings['f4c6f851b00d5518bf888815de279aba'] /* Notes */,
5739 renderer : function(v) { return String.format('{0}', v); },
5742 '|xns' : 'Roo.grid',
5743 xtype : 'ColumnModel'
5750 title : _this._strings['47cb03899dc494703b52c37240fa4c17'] /* Stock Tx */,
5753 xtype : 'NestedLayoutPanel',
5757 xtype : 'BorderLayout',
5761 xtype : 'LayoutRegion'
5768 xtype : 'LayoutRegion'
5773 fitContainer : true,
5776 tableName : 'invdetail',
5777 title : _this._strings['f817f797c422f7ac3404b6223db1a1ee'] /* invdetail */,
5780 xtype : 'GridPanel',
5782 activate : function() {
5783 _this.txpanel = this;
5785 _this.txgrid.footer.onClick('first');
5790 autoExpandColumn : 'item_number',
5793 '|xns' : 'Roo.grid',
5798 _this.txgrid = this;
5799 //_this.dialog = Pman.Dialog.FILL_IN
5800 if (_this.txpanel.active) {
5801 this.footer.onClick('first');
5807 displayMsg : _this._strings['87813307f6e7498b30c5b3d9b2f65f56'] /* Displaying invdetail{0} - {1} of {2} */,
5808 emptyMsg : _this._strings['a0d036a1d6a00180df168fa86143e5f8'] /* No invdetail found */,
5812 xtype : 'PagingToolbar'
5820 text : _this._strings['b80f4ed22929b09103f0c5666ad7a7e1'] /* Run Apply Fifo on order */,
5822 '|xns' : 'Roo.Toolbar',
5825 click : function (_self, e)
5829 url : baseURL + '/Roo/Cohead',
5832 _apply_fifo : _this.form.findField('cohead_id').getValue()
5834 success : function () {
5835 Roo.MessageBox.alert("Applied", "Succesfully Applied");
5842 text : _this._strings['d179a904ac10a39ab574fe803cc29fa3'] /* Run Void flagger */,
5844 '|xns' : 'Roo.Toolbar',
5847 click : function (_self, e)
5851 url : baseURL + '/Roo/Cohead',
5854 _run_void_fix : _this.form.findField('cohead_id').getValue()
5856 success : function () {
5857 Roo.MessageBox.alert("Applied", "Succesfully Run");
5864 text : _this._strings['26453198f2ddac444702879a8f6d61a5'] /* Auto Reverse */,
5866 '|xns' : 'Roo.Toolbar',
5869 click : function (_self, e)
5874 url : baseURL + '/Roo/Invdetail',
5879 _reverse_all_bad : _this.form.findField('cohead_id').getValue()
5881 success : function () {
5882 Roo.MessageBox.alert("Applied", "Succesfully Run");
5892 sortInfo : { field : 'item_number', direction: 'ASC' },
5894 '|xns' : 'Roo.data',
5897 beforeload : function (_self, o)
5899 o.params.cohead_id = _this.form.findField('cohead_id').getValue();
5900 if (! o.params.cohead_id ) {
5908 url : baseURL + '/Roo/invdetail.php',
5910 '|xns' : 'Roo.data',
5916 'name': 'invdetail_id',
5920 'name': 'invdetail_transtype',
5924 'name': 'invdetail_invhist_id',
5928 'name': 'invdetail_location_id',
5932 'name': 'invdetail_qty',
5936 'name': 'invdetail_comments',
5940 'name': 'invdetail_qty_before',
5944 'name': 'invdetail_qty_after',
5948 'name': 'invdetail_invcitem_id',
5952 'name': 'invdetail_expiration',
5954 'dateFormat': 'Y-m-d'
5957 'name': 'invdetail_warrpurc',
5959 'dateFormat': 'Y-m-d'
5962 'name': 'invdetail_ls_id',
5968 totalProperty : 'total',
5970 '|xns' : 'Roo.data',
5971 xtype : 'JsonReader'
5975 singleSelect : true,
5977 '|xns' : 'Roo.grid',
5978 xtype : 'RowSelectionModel',
5980 selectionchange : function (_self)
5982 _this.txdgrid.footer.onClick('first');;
5988 dataIndex : 'item_number',
5989 header : _this._strings['7d74f3b92b19da5e606d737d339a9679'] /* Item */,
5990 renderer : function(v) { return String.format('{0}', v); },
5993 '|xns' : 'Roo.grid',
5994 xtype : 'ColumnModel'
5998 dataIndex : 'rec_shipped',
5999 header : _this._strings['53896265ad28c11cb4997b3c3e3e122d'] /* #Ship */,
6000 renderer : function(v) { return String.format('{0}', Roo.util.Format.number(v,0)); },
6003 '|xns' : 'Roo.grid',
6004 xtype : 'ColumnModel'
6008 dataIndex : 'rec_returned',
6009 header : _this._strings['d323a19bad62ff427d0b75dc52674c81'] /* #Ret */,
6010 renderer : function(v) { return String.format('{0}', Roo.util.Format.number(v,0)); },
6013 '|xns' : 'Roo.grid',
6014 xtype : 'ColumnModel'
6018 dataIndex : 'tx_shipped',
6019 header : _this._strings['51e07f52ae2192d23a1b43922e5beb90'] /* #TX ship */,
6020 renderer : function(v) { return String.format('{0}', Roo.util.Format.number(v,0)); },
6023 '|xns' : 'Roo.grid',
6024 xtype : 'ColumnModel'
6028 dataIndex : 'tx_returned',
6029 header : _this._strings['5e33fc1550a56738da96fbaaf57e72f0'] /* #TX ret */,
6030 renderer : function(v) { return String.format('{0}', Roo.util.Format.number(v,0)); },
6033 '|xns' : 'Roo.grid',
6034 xtype : 'ColumnModel'
6038 dataIndex : 'tx_total',
6039 header : _this._strings['1abe972d603f3bd61eefc9ac39fb7522'] /* #TX Tot */,
6040 renderer : function(v) { return String.format('{0}', Roo.util.Format.number(v,0)); },
6043 '|xns' : 'Roo.grid',
6044 xtype : 'ColumnModel'
6048 dataIndex : 'total_value',
6049 header : _this._strings['689202409e48743b914713f96d93947c'] /* Value */,
6050 renderer : function(v,x,r) {
6052 return (v*1).toFixed(3);
6056 '|xns' : 'Roo.grid',
6057 xtype : 'ColumnModel'
6061 dataIndex : 'tx_total',
6062 header : _this._strings['56d56144d4e4a42ce450446518c4fc00'] /* #Diff */,
6063 renderer : function(v,x,r) {
6065 var cototal = (r.data.rec_returned*1) - (r.data.rec_shipped*1);
6066 // Roo.log(cototal);
6067 var diff = (v*1) - cototal;
6072 return String.format('<span style="color:red">{0}</span>', diff );
6076 '|xns' : 'Roo.grid',
6077 xtype : 'ColumnModel'
6084 fitContainer : true,
6087 tableName : 'invdetail',
6088 title : _this._strings['f817f797c422f7ac3404b6223db1a1ee'] /* invdetail */,
6091 xtype : 'GridPanel',
6093 activate : function() {
6094 _this.txdpanel = this;
6095 if (_this.txdgrid) {
6096 _this.txdgrid.footer.onClick('first');
6101 autoExpandColumn : 'invhist_comments',
6104 '|xns' : 'Roo.grid',
6109 _this.txdgrid = this;
6110 //_this.dialog = Pman.Dialog.FILL_IN
6111 if (_this.txdpanel.active) {
6112 this.footer.onClick('first');
6115 rowclick : function (_self, rowIndex, e)
6117 var s = _this.txdgrid.ds.getAt(rowIndex);
6118 var dt = s.data.invhist_transdate.split(' ');
6120 _this.dateSel.setValue(new Date(dt[0]));
6125 displayMsg : _this._strings['87813307f6e7498b30c5b3d9b2f65f56'] /* Displaying invdetail{0} - {1} of {2} */,
6126 emptyMsg : _this._strings['a0d036a1d6a00180df168fa86143e5f8'] /* No invdetail found */,
6130 xtype : 'PagingToolbar'
6138 text : _this._strings['fa1cfdb383ea976facbdb20d40d2f811'] /* Duplicate Selected */,
6140 '|xns' : 'Roo.Toolbar',
6143 click : function (_self, e)
6145 var s = _this.txdgrid.selModel.getSelected();
6148 Roo.MessageBox.alert("Error", "Select a transaction");
6152 var reverseSel = function() {
6156 url : baseURL + '/Roo/invdetail',
6159 _duplicate : s.data.invdetail_id
6161 success : function() {
6162 _this.txdgrid.footer.onClick('first');
6170 Roo.MessageBox.confirm(
6172 "This should only be used by System Administrators - are you sure you know what you are doing!",
6189 '|xns' : 'Roo.Toolbar',
6193 text : _this._strings['72bb7a9ea8714c52b0c0b8369d6a8dc3'] /* Issue Date */,
6195 '|xns' : 'Roo.Toolbar',
6200 fieldLabel : _this._strings['72bb7a9ea8714c52b0c0b8369d6a8dc3'] /* Issue Date */,
6202 name : 'issue_date',
6205 '|xns' : 'Roo.form',
6206 xtype : 'DateField',
6208 render : function (_self)
6210 _this.dateSel = _self;
6215 text : _this._strings['8156649b9de8783c15c822b592c3bac6'] /* Reverse Selected */,
6217 '|xns' : 'Roo.Toolbar',
6220 click : function (_self, e)
6222 var s = _this.txdgrid.selModel.getSelected();
6223 var dt = _this.dateSel.getValue();
6225 Roo.MessageBox.alert("Error", "Select a transaction");
6229 var reverseSel = function(force) {
6233 url : baseURL + '/Roo/invdetail',
6236 _reverse : s.data.invdetail_id,
6237 _as_of : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),
6240 success : function() {
6241 _this.txdgrid.footer.onClick('first');
6243 failure : function(res) {
6246 if (res.errors.confirm) {
6248 Roo.MessageBox.confirm(
6250 "are you really sure the totals will get messed up.",
6261 Roo.MessageBox.alert("Error", res.errorMsg);
6271 Roo.MessageBox.confirm(
6273 "This should only be used by System Administrators - are you sure you know what you are doing!",
6292 sortInfo : { field : 'invdetail_id', direction: 'ASC' },
6294 '|xns' : 'Roo.data',
6297 beforeload : function (_self, o)
6299 o.params.cohead_id = _this.form.findField('cohead_id').getValue();
6300 var s = _this.txgrid.selModel.getSelected();
6305 o.params.itemsite_id = s.data.invhist_itemsite_id;
6311 url : baseURL + '/Roo/invdetail.php',
6313 '|xns' : 'Roo.data',
6319 'name': 'invdetail_id',
6323 'name': 'invdetail_transtype',
6327 'name': 'invdetail_invhist_id',
6331 'name': 'invdetail_location_id',
6335 'name': 'invdetail_qty',
6339 'name': 'invdetail_comments',
6343 'name': 'invdetail_qty_before',
6347 'name': 'invdetail_qty_after',
6351 'name': 'invdetail_invcitem_id',
6355 'name': 'invdetail_expiration',
6357 'dateFormat': 'Y-m-d'
6360 'name': 'invdetail_warrpurc',
6362 'dateFormat': 'Y-m-d'
6365 'name': 'invdetail_ls_id',
6371 totalProperty : 'total',
6373 '|xns' : 'Roo.data',
6374 xtype : 'JsonReader'
6379 dataIndex : 'invdetail_id',
6380 header : _this._strings['fd216b286b94577ac68c112c0dcaf341'] /* TX# */,
6381 renderer : function(v) { return String.format('{0}', v); },
6384 '|xns' : 'Roo.grid',
6385 xtype : 'ColumnModel'
6388 dataIndex : 'invhist_transdate',
6389 header : _this._strings['44749712dbec183e983dcd78a7736c41'] /* Date */,
6390 renderer : function(v) { return String.format('{0}', v); },
6393 '|xns' : 'Roo.grid',
6394 xtype : 'ColumnModel'
6397 dataIndex : 'invhist_ordnumber',
6398 header : _this._strings['9c9745a343efeacc9efe9b7222b27afb'] /* Ref# */,
6399 renderer : function(v,x,r) {
6400 if (r.data.invfifo_void *1 != 0) {
6401 return String.format('<s>{0}</s>', v);
6404 return String.format('{0}', v);
6408 '|xns' : 'Roo.grid',
6409 xtype : 'ColumnModel'
6412 dataIndex : 'location_name',
6413 header : _this._strings['fd216b286b94577ac68c112c0dcaf341'] /* TX# */,
6414 renderer : function(v) { return String.format('{0}', v); },
6417 '|xns' : 'Roo.grid',
6418 xtype : 'ColumnModel'
6421 dataIndex : 'invhist_comments',
6422 header : _this._strings['f4c6f851b00d5518bf888815de279aba'] /* Notes */,
6423 renderer : function(v) { return String.format('{0}', v); },
6426 '|xns' : 'Roo.grid',
6427 xtype : 'ColumnModel'
6431 dataIndex : 'invdetail_qty',
6432 header : _this._strings['c4a0f4ddf926328daa2a350db9f9ca00'] /* Qty Changed */,
6433 renderer : function(v,x,r) {
6434 if ( r.data.coitem_shipped != v) {
6435 return String.format('{0} <span style="color:red">({1})</span>',
6436 Roo.util.Format.number(v,0),
6437 r.data.coitem_shipped
6441 return String.format('{0}', Roo.util.Format.number(v,0));
6445 '|xns' : 'Roo.grid',
6446 xtype : 'ColumnModel'
6450 dataIndex : 'invhist_value_before',
6451 header : _this._strings['c4a0f4ddf926328daa2a350db9f9ca00'] /* Qty Changed */,
6452 renderer : function(v,x,r) {
6453 var tot = r.data.invhist_value_after*1 - v*1;
6455 if (r.data.invdetail_qty >0 && tot < 0) {
6456 f = '<span style="color:red">{0}</span>';
6458 if (r.data.invdetail_qty < 0 && tot > 0) {
6459 f = '<span style="color:red">{0}</span>';
6461 return String.format(f, Roo.util.Format.number(tot));
6465 '|xns' : 'Roo.grid',
6466 xtype : 'ColumnModel'
6469 dataIndex : 'invhist_posted',
6470 header : _this._strings['16cd452dda9d4398bf6240603eee40a9'] /* Posted */,
6471 renderer : function(v,x,r) {
6473 var state = v ? '-checked' : '';
6475 return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
6479 '|xns' : 'Roo.grid',
6480 xtype : 'ColumnModel'
6490 title : _this._strings['99575a08540e6ee585a7b389e8bde351'] /* GL Tx */,
6493 xtype : 'NestedLayoutPanel',
6497 xtype : 'BorderLayout',
6501 xtype : 'LayoutRegion'
6508 xtype : 'LayoutRegion'
6513 fitContainer : true,
6516 tableName : 'invdetail',
6517 title : _this._strings['f817f797c422f7ac3404b6223db1a1ee'] /* invdetail */,
6520 xtype : 'GridPanel',
6522 activate : function() {
6523 _this.gltxpanel = this;
6524 if (_this.gltxgrid) {
6525 _this.gltxgrid.footer.onClick('first');
6530 autoExpandColumn : 'gltrans_accnt_id_accnt_descrip',
6533 '|xns' : 'Roo.grid',
6536 cellclick : function (_self, rowIndex, columnIndex, e)
6538 if (columnIndex > 0) {
6541 var rec = this.ds.getAt(rowIndex);
6542 rec.set('gltrans_as_summary', rec.data.gltrans_as_summary *1 ? 0 : 1);
6543 _this.gltxdgrid.footer.onClick('first');
6547 _this.gltxgrid = this;
6548 //_this.dialog = Pman.Dialog.FILL_IN
6549 if (_this.gltxpanel.active) {
6550 this.footer.onClick('first');
6556 displayMsg : _this._strings['87813307f6e7498b30c5b3d9b2f65f56'] /* Displaying invdetail{0} - {1} of {2} */,
6557 emptyMsg : _this._strings['a0d036a1d6a00180df168fa86143e5f8'] /* No invdetail found */,
6561 xtype : 'PagingToolbar',
6564 enableToggle : true,
6566 text : _this._strings['8fb8fbc1c0bc53b2d01121344410e444'] /* Split sales */,
6568 '|xns' : 'Roo.Toolbar',
6571 click : function (_self, e)
6573 (function() { _this.gltxgrid.footer.onClick('first'); }).defer(100);
6575 render : function (_self)
6577 _this.glsalesbtn = _self;
6585 sortInfo : { field : 'item_number', direction: 'ASC' },
6587 '|xns' : 'Roo.data',
6590 beforeload : function (_self, o)
6592 o.params.cohead_id = _this.form.findField('cohead_id').getValue();
6593 if (! o.params.cohead_id ) {
6597 o.params._split_sales = _this.glsalesbtn.pressed ? 1 : 0;
6602 url : baseURL + '/Roo/gltrans.php',
6604 '|xns' : 'Roo.data',
6610 'name': 'invdetail_id',
6614 'name': 'invdetail_transtype',
6618 'name': 'invdetail_invhist_id',
6622 'name': 'invdetail_location_id',
6626 'name': 'invdetail_qty',
6630 'name': 'invdetail_comments',
6634 'name': 'invdetail_qty_before',
6638 'name': 'invdetail_qty_after',
6642 'name': 'invdetail_invcitem_id',
6646 'name': 'invdetail_expiration',
6648 'dateFormat': 'Y-m-d'
6651 'name': 'invdetail_warrpurc',
6653 'dateFormat': 'Y-m-d'
6656 'name': 'invdetail_ls_id',
6662 totalProperty : 'total',
6664 '|xns' : 'Roo.data',
6665 xtype : 'JsonReader'
6669 singleSelect : true,
6671 '|xns' : 'Roo.grid',
6672 xtype : 'RowSelectionModel',
6674 selectionchange : function (_self)
6676 _this.gltxdgrid.footer.onClick('first');;
6682 dataIndex : 'gltrans_as_summary',
6683 header : _this._strings['290612199861c31d1036b185b4e69b75'] /* Summary */,
6684 renderer : function(v,x,r) {
6686 var state = v*1 ? '-checked' : '';
6688 return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
6692 '|xns' : 'Roo.grid',
6693 xtype : 'ColumnModel'
6696 dataIndex : 'gltrans_accnt_id_accnt_descrip',
6697 header : _this._strings['08bd40c7543007ad06e4fce31618f6ec'] /* Account */,
6698 renderer : function(v) { return String.format('{0}', v); },
6701 '|xns' : 'Roo.grid',
6702 xtype : 'ColumnModel'
6706 dataIndex : 'gltrans_amount_credit',
6707 header : _this._strings['0a90b1bc4078f74b6f0d117ec7df65af'] /* Credit */,
6708 renderer : function(v) { return String.format('{0}', Roo.util.Format.number(v,3)); },
6711 '|xns' : 'Roo.grid',
6712 xtype : 'ColumnModel'
6716 dataIndex : 'gltrans_amount_debit',
6717 header : _this._strings['009534719f8c8221440a5629f497a784'] /* Debit */,
6718 renderer : function(v) { return String.format('{0}', Roo.util.Format.number(v,3)); },
6721 '|xns' : 'Roo.grid',
6722 xtype : 'ColumnModel'
6726 dataIndex : 'gltrans_amount_total',
6727 header : _this._strings['a0ec87054b5e5b7847d0d8780a01a3d5'] /* Sum */,
6728 renderer : function(v) { return String.format('<b>{0}</b>', Roo.util.Format.number(v,3)); },
6731 '|xns' : 'Roo.grid',
6732 xtype : 'ColumnModel'
6736 dataIndex : 'gltrans_amount_total_unposted',
6737 header : _this._strings['58733ee735e3160c5c9fa5739fb4d056'] /* Unposted */,
6738 renderer : function(v) { return String.format('<span style="color:red">{0}</span>', Roo.util.Format.number(v,3)); },
6741 '|xns' : 'Roo.grid',
6742 xtype : 'ColumnModel'
6749 fitContainer : true,
6752 tableName : 'invdetail',
6753 title : _this._strings['f817f797c422f7ac3404b6223db1a1ee'] /* invdetail */,
6756 xtype : 'GridPanel',
6758 activate : function() {
6759 _this.gltxdpanel = this;
6760 if (_this.gltxdgrid) {
6761 _this.gltxdgrid.footer.onClick('first');
6766 autoExpandColumn : 'gltrans_notes',
6769 '|xns' : 'Roo.grid',
6772 cellclick : function (_self, ri, ci, e)
6775 var deleteSel = function() {
6779 url : baseURL + '/Roo/gltrans',
6783 gltrans_id : rec.data.gltrans_id
6786 success : function() {
6787 rec.set('gltrans_posted', false);
6788 rec.set('gltrans_deleted', true);
6789 rec.set('gltrans_docnumber', rec.data.gltrans_docnumber);
6790 _this.gltxgrid.footer.onClick('first');
6795 var undeleteSel = function() {
6799 url : baseURL + '/Roo/gltrans',
6803 gltrans_id : rec.data.gltrans_id
6806 success : function() {
6807 rec.set('gltrans_posted', true);
6808 rec.set('gltrans_deleted', false);
6809 rec.set('gltrans_docnumber', rec.data.gltrans_docnumber);
6810 _this.gltxgrid.footer.onClick('first');
6816 var di = this.colModel.config[ci].dataIndex;
6817 if (di != 'gltrans_posted') {
6823 var rec = this.ds.getAt(ri);
6824 if (rec.data.gltrans_deleted) {
6826 Roo.MessageBox.confirm(
6828 "This should only be used by System Administrators - are you sure you know what you are doing!",
6842 if (!rec.data.gltrans_posted) {
6848 url : baseURL + '/Roo/gltrans',
6852 gltrans_id : rec.data.gltrans_id
6854 success : function (res)
6856 rec.set('gltrans_posted', true);
6857 _this.gltxgrid.footer.onClick('first');
6866 // we have a posted transaction.
6867 // only allow recalled to be deleted..
6868 if (!rec.data.gltrans_notes.match(/(Recall|Ship Order)/)) {
6877 Roo.MessageBox.confirm(
6879 "This should only be used by System Administrators - are you sure you know what you are doing!",
6893 _this.gltxdgrid = this;
6894 //_this.dialog = Pman.Dialog.FILL_IN
6895 if (_this.gltxdpanel.active) {
6896 this.footer.onClick('first');
6902 displayMsg : _this._strings['87813307f6e7498b30c5b3d9b2f65f56'] /* Displaying invdetail{0} - {1} of {2} */,
6903 emptyMsg : _this._strings['a0d036a1d6a00180df168fa86143e5f8'] /* No invdetail found */,
6907 xtype : 'PagingToolbar',
6910 text : _this._strings['801ab24683a4a8c433c6eb40c48bcd9d'] /* Download */,
6912 '|xns' : 'Roo.Toolbar',
6915 click : function (_self, e)
6917 new Pman.Download( {
6918 grid : _this.gltxdgrid
6928 sortInfo : { field : 'gltrans_docnumber', direction: 'ASC' },
6930 '|xns' : 'Roo.data',
6933 beforeload : function (_self, o)
6935 o.params.cohead_id = _this.form.findField('cohead_id').getValue();
6936 var s = _this.gltxgrid.selModel.getSelected();
6941 o.params.gltrans_accnt_id = s.data.gltrans_accnt_id;
6942 o.params.gltrans_is_ship = s.data.gltrans_is_ship;
6943 o.params.gltrans_as_summary = s.data.gltrans_as_summary;
6950 url : baseURL + '/Roo/gltrans.php',
6952 '|xns' : 'Roo.data',
6958 'name': 'invdetail_id',
6962 'name': 'invdetail_transtype',
6966 'name': 'invdetail_invhist_id',
6970 'name': 'invdetail_location_id',
6974 'name': 'invdetail_qty',
6978 'name': 'invdetail_comments',
6982 'name': 'invdetail_qty_before',
6986 'name': 'invdetail_qty_after',
6990 'name': 'invdetail_invcitem_id',
6994 'name': 'invdetail_expiration',
6996 'dateFormat': 'Y-m-d'
6999 'name': 'invdetail_warrpurc',
7001 'dateFormat': 'Y-m-d'
7004 'name': 'invdetail_ls_id',
7010 totalProperty : 'total',
7012 '|xns' : 'Roo.data',
7013 xtype : 'JsonReader'
7018 dataIndex : 'gltrans_id',
7019 header : _this._strings['9c9745a343efeacc9efe9b7222b27afb'] /* Ref# */,
7020 renderer : function(v) { return String.format('{0}', v ); },
7024 '|xns' : 'Roo.grid',
7025 xtype : 'ColumnModel'
7028 dataIndex : 'gltrans_date',
7029 header : _this._strings['44749712dbec183e983dcd78a7736c41'] /* Date */,
7030 renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); },
7033 '|xns' : 'Roo.grid',
7034 xtype : 'ColumnModel'
7037 dataIndex : 'gltrans_docnumber',
7038 header : _this._strings['cb02c723b8a159fea3cd7913d3df7fbc'] /* Doc# */,
7039 renderer : function(v,x,r) {
7040 if (r.data.gltrans_deleted) {
7041 return String.format('<s>{0}</s>', v);
7043 return String.format('{0}', v);
7047 '|xns' : 'Roo.grid',
7048 xtype : 'ColumnModel'
7051 dataIndex : 'gltrans_source',
7052 header : _this._strings['f31bbdd1b3e85bccd652680e16935819'] /* Source */,
7053 renderer : function(v) { return String.format('{0}', v); },
7056 '|xns' : 'Roo.grid',
7057 xtype : 'ColumnModel'
7060 dataIndex : 'gltrans_notes',
7061 header : _this._strings['f4c6f851b00d5518bf888815de279aba'] /* Notes */,
7062 renderer : function(v) { return String.format('{0}', v); },
7065 '|xns' : 'Roo.grid',
7066 xtype : 'ColumnModel'
7070 dataIndex : 'gltrans_amount',
7071 header : _this._strings['b2f40690858b404ed10e62bdf422c704'] /* Amount */,
7072 renderer : function(v) { return String.format('{0}', Roo.util.Format.number(v,3)); },
7075 '|xns' : 'Roo.grid',
7076 xtype : 'ColumnModel'
7079 dataIndex : 'gltrans_posted',
7080 header : _this._strings['16cd452dda9d4398bf6240603eee40a9'] /* Posted */,
7081 renderer : function(v,x,r) {
7083 var state = v ? '-checked' : '';
7085 return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
7089 '|xns' : 'Roo.grid',
7090 xtype : 'ColumnModel'
7100 fitContainer : true,
7103 tableName : 'coitem',
7104 title : _this._strings['182875b6c36a761f1e459624c1d93638'] /* Profit */,
7107 xtype : 'GridPanel',
7109 activate : function() {
7110 _this.profitpanel = this;
7112 try { if (MODULE.isBuilder) {
7116 var id = _this.form.findField('cohead_id').getValue() * 1;
7118 Roo.MessageBox.alert("Save First", "Save the order first, before adding items");
7119 _this.dialog.layout.getRegion('center').showPanel(0);
7123 if (_this.profitgrid) {
7124 _this.profitgrid.footer.onClick('first');
7130 autoExpandColumn : 'item_number',
7133 '|xns' : 'Roo.grid',
7138 _this.profitgrid = this;
7139 //_this.dialog = Pman.Dialog.FILL_IN
7140 if (_this.profitpanel.active) {
7141 this.footer.onClick('first');
7147 displayMsg : _this._strings['d0cc96be641673ad48fc74374fda8137'] /* Displaying coitem{0} - {1} of {2} */,
7148 emptyMsg : _this._strings['c04b33241cc5478500daf178e3720b63'] /* No coitem found */,
7152 xtype : 'PagingToolbar'
7156 sortInfo : { field : 'coitem_linenumber,coitem_subnumber', direction: 'ASC' },
7158 '|xns' : 'Roo.data',
7161 beforeload : function (_self,o) {
7168 if (!_this.data || !_this.data.cohead_id) {
7171 o.params = o.params || {};
7173 o.params.coitem_cohead_id = _this.data.cohead_id;
7174 o.params._without_list_discount =1;
7175 o.params._with_profit = 1;
7181 url : baseURL + '/Roo/coitem.php',
7183 '|xns' : 'Roo.data',
7205 'name': 'leader_id',
7209 'name': 'leader_office_id',
7213 'name': 'leader_name',
7217 'name': 'leader_phone',
7221 'name': 'leader_fax',
7225 'name': 'leader_email',
7229 'name': 'leader_company_id',
7233 'name': 'leader_role',
7237 'name': 'leader_active',
7241 'name': 'leader_remarks',
7245 'name': 'leader_passwd',
7249 'name': 'leader_owner_id',
7253 'name': 'leader_lang',
7257 'name': 'leader_no_reset_sent',
7261 'name': 'leader_action_type',
7265 'name': 'leader_project_id',
7269 'name': 'leader_deleted_by',
7273 'name': 'leader_deleted_dt',
7277 'name': 'leader_firstname',
7281 'name': 'leader_lastname',
7285 'name': 'leader_name_facebook',
7289 'name': 'leader_url_blog',
7293 'name': 'leader_url_twitter',
7297 'name': 'leader_url_linkedin',
7301 'name': 'leader_crm_lead_percentage',
7305 'name': 'leader_crm_industry_id',
7309 'name': 'leader_crm_updated_action_id',
7313 'name': 'leader_crm_created_action_id',
7317 'name': 'leader_crm_type_id',
7323 totalProperty : 'total',
7325 '|xns' : 'Roo.data',
7326 xtype : 'JsonReader'
7331 dataIndex : 'item_number',
7332 header : _this._strings['7608203603437f0513ba8203a2d39a4f'] /* Item Code */,
7333 renderer : function(v) { return String.format('{0}', v); },
7336 '|xns' : 'Roo.grid',
7337 xtype : 'ColumnModel'
7340 dataIndex : 'calc_subtotal',
7341 header : _this._strings['c5eae6ea505388a73962c635ac821fba'] /* SubTotal */,
7342 renderer : function(v) {
7345 return Roo.util.Format.number( v, 2);
7349 '|xns' : 'Roo.grid',
7350 xtype : 'ColumnModel'
7353 dataIndex : 'calc_cost_total',
7354 header : _this._strings['81dffdb31b9576e343d3f7ffcf721d7e'] /* Cost of goods */,
7355 renderer : function(v) {
7357 return Roo.util.Format.number( v, 2);
7361 '|xns' : 'Roo.grid',
7362 xtype : 'ColumnModel'
7365 dataIndex : 'profit',
7366 header : _this._strings['182875b6c36a761f1e459624c1d93638'] /* Profit */,
7367 renderer : function(v,x,r) {
7369 var profit = r.data.calc_subtotal - r.data.calc_cost_total;
7371 if(parseInt(profit) < 1){
7372 return String.format('<b style="color:red;">{0}</b>', Roo.util.Format.number(profit,2));
7376 return Roo.util.Format.number( profit, 2);
7380 '|xns' : 'Roo.grid',
7381 xtype : 'ColumnModel'