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 '900eb3dcf3a7d639acbd2528ca5bbd52' :"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 '96b0141273eabab320119c467cdcaf17' :"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({
215 xtype : 'LayoutDialog',
221 title : _this._strings['57cdc7bcd2ca327f3267e2f5ecfa8c6d'] /* Edit / Create Sales Order */,
225 this.layout.getRegion('center').showPanel(0);
231 xtype : 'LayoutRegion',
232 alwaysShowTabs : true,
244 '|xns' : 'Roo.Toolbar'
248 cls : 'x-btn-text-icon',
249 icon : rootURL + '/Pman/templates/images/spreadsheet.gif',
250 text : _this._strings['160ab8f9d6c5d2819fff11dea08d4ef8'] /* Download Excel */,
254 var id = 1* _this.form.findField('cohead_id').getValue();
256 Roo.MessageBox.alert("Error", "Save Sales order first");
260 // check current status of shipment..
263 url : baseURL + '/Roo/cohead',
269 success : function() {
279 '|xns' : 'Roo.Toolbar'
283 cls : 'x-btn-text-icon',
284 icon : rootURL + '/Pman/templates/images/pdf.gif',
285 text : _this._strings['13dba24862cf9128167a59100e154c8d'] /* Print */,
289 var id = 1* _this.form.findField('cohead_id').getValue();
291 Roo.MessageBox.alert("Error", "Save Sales order first");
295 // check current status of shipment..
298 url : baseURL + '/Roo/cohead',
304 success : function() {
314 '|xns' : 'Roo.Toolbar'
318 cls : 'x-btn-text-icon',
320 icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
321 text : _this._strings['80092f7900d59aab765d0ddd35dc7231'] /* Add Shipment */,
323 click : function (_self, e)
326 _this.addShipmentBtn.fireEvent('click');
331 '|xns' : 'Roo.Toolbar'
335 cls : 'x-btn-text-icon',
336 icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
337 text : _this._strings['e5d63551ca2d2842661e49a25fd12a67'] /* Edit Customer */,
339 click : function (_self, e)
342 Pman.Dialog.XtupleCustomer.show({
343 cust_id : _this.form.findField('cohead_cust_id').getValue()
348 '|xns' : 'Roo.Toolbar'
352 cls : 'x-btn-text-icon',
354 icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
355 text : _this._strings['bdd31bfe5374e3cdc19a10020eae4b49'] /* Add Invoice */,
357 click : function (_self, e)
360 _this.addInvoiceBtn.fireEvent('click');
365 '|xns' : 'Roo.Toolbar'
369 text : _this._strings['81ceb48a978444906d80119200aa358d'] /* Void */,
371 click : function (_self, e)
374 cohead_id : _this.form.findField('cohead_id').getValue()
381 url: baseURL + '/Roo/cohead',
387 if ( _this.data.cohead_status == 'X') {
388 _this.form.load({ method: 'GET', params: { '_id' : _this.data.cohead_id }});
400 if (_this.data.cohead_status == 'X') {
406 Roo.MessageBox.confirm("Confirm", "Are you sure you want to void this?", function(r) {
418 render : function (_self, e)
420 _this.voidBtn = _self;
424 '|xns' : 'Roo.Toolbar'
428 text : _this._strings['07ca5050e697392c9ed47e6453f1453f'] /* Completed */,
430 click : function (_self, e)
432 var p = { cohead_id : _this.form.findField('cohead_id').getValue() };
435 if (_this.data.cohead_status == 'C') {
443 url: baseURL + '/Roo/cohead',
451 _this.form.load({ method: 'GET', params: { '_id' : _this.data.cohead_id }});
461 render : function (_self)
463 _this.closeBtn = _self;
467 '|xns' : 'Roo.Toolbar'
475 text : _this._strings['511b6a78f5503881ba10ff93b7205ade'] /* Create CM reversal */,
477 click : function (_self, e)
479 var id = _this.form.findField('cohead_id').getValue() * 1;
482 Roo.MessageBox.alert('Error', 'Error occour on getting the sales order id');
486 Roo.MessageBox.confirm("Confirm", "Are you sure to create a credit memo reversal?",
494 url: baseURL+ '/Roo/cohead',
499 success : function() {
500 _this.form.load({ method: 'GET', params: { '_id' : id }});
506 render : function (_self)
508 _this.reversalBtn = _self;
516 text : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
518 click : function (_self, e)
520 if (_this.grid) _this.grid.stopEditing();
529 text : _this._strings['c9cc8cce247e49bae79f15173ce97354'] /* Save */,
531 click : function (_self, e)
535 if (_this.grid) _this.grid.stopEditing();
537 _this.form.doAction("submit");
540 render : function (_self)
542 _this.saveBtn = _self;
551 xtype : 'ContentPanel',
553 title : _this._strings['c5c8ac6bbc6d7f5c95d0a888527554d3'] /* Order Details */,
555 activate : function (_self)
557 // we need to reload to find out the subtotal.
558 if (!_this.data || !_this.data.cohead_id) {
563 url : baseURL + '/Roo/cohead',
565 _id : _this.data.cohead_id
567 success : function(res) {
568 _this.form.findField('cohead_subtotal').setValue(res.data.cohead_subtotal);
569 _this.form.findField('cohead_tax').setValue(res.data.cohead_tax);
570 _this.form.findField('cohead_uninvoiced').setValue(res.data.cohead_uninvoiced);
571 _this.form.findField('cohead_unshipped').setValue(res.data.cohead_unshipped);
572 _this.form.findField('cohead_pretax_discount').setValue(res.data.cohead_pretax_discount);
573 _this.form.findField('cohead_total').recalc();
574 _this.form.findField('cohead_misc').recalc();
585 style : 'margin:10px;',
586 url : baseURL + '/Roo/cohead.php',
588 actioncomplete : function(_self,action)
590 if (action.type == 'setdata') {
591 // clear the stock level cache...
592 _this.stockcache = [];
594 _this.form.findField('billto_email').setValue('');
596 _this.reversalBtn.hide();
598 if (_this.data.cohead_id) {
599 this.load({ method: 'GET', params: { '_id' : _this.data.cohead_id }});
603 _this.dialog.setTitle("Edit New Sales Order");
605 _this.closeBtn.hide();
606 _this.voidBtn.hide();
607 _this.saveBtn.show();
609 if(_this.data.cohead_billto_cntct_id_cntct_id){
610 _this.form.findField('billto_address').update();
612 _this.form.setValues({
\r
613 cohead_billto_cntct_id: _this.data.cohead_billto_cntct_id_cntct_id,
\r
614 cohead_billto_cntct_id_cntct_name : _this.data.cohead_billto_cntct_id_cntct_name,
\r
623 if (action.type == 'load') {
626 _this.data = action.result.data;
628 if (!_this.data.cohead_shipto_id && _this.data.shipto_id*1 > 0) {
629 _this.form.findField('cohead_shipto_id').setValue(_this.data.shipto_id);
630 _this.form.findField('cohead_shipto_id_shipto_name').setValue(_this.data.cohead_shipto_cntct_id_cntct_name);
635 _this.dataloading = true;
636 if (_this.data.cohead_shipto_cntct_id == _this.data.cohead_billto_cntct_id) {
637 this.findField('_shipto_same').setValue(1);
638 Roo.log("set shipto 1");
640 this.findField('_shipto_same').setValue(0);
641 Roo.log("set shipto 0");
643 _this.dataloading = false;
646 this.findField('billto_address').update();
647 this.findField('shipto_address').update();
648 _this.dialog.setTitle("Edit Sales Order - " + this.findField('cohead_number').getValue());
651 if (_this.data.cohead_status == 'C') {
652 _this.closeBtn.show();
653 _this.closeBtn.setText('Re-open');
654 _this.voidBtn.hide();
655 _this.saveBtn.hide();
656 _this.reversalBtn.show();
657 } else if (_this.data.cohead_status == 'X') {
658 _this.closeBtn.hide();
659 _this.voidBtn.show();
660 _this.voidBtn.setText("Un-void / Re-open");
661 _this.saveBtn.hide();
664 _this.closeBtn.show();
665 _this.closeBtn.setText('Complete and Close');
666 _this.voidBtn.setText("Void");
667 _this.voidBtn.show();
668 _this.saveBtn.show();
671 _this.form.findField('cohead_misc_per').update();
673 // finally override the value for discount...
674 if ((''+ _this.data.cohead_misc_descrip).length) {
675 _this.form.findField('cohead_misc_descrip').setValue(_this.data.cohead_misc_descrip);
678 // update the stockcache...
681 url : baseURL + '/Roo/cohead',
684 _stockLevel : _this.data.cohead_id
686 success : function(res)
688 for (var i in res.data) {
690 if(typeof(_this.stockcache[res.data[i].item]) == 'undefined'){
691 _this.stockcache[res.data[i].item] = res.data[i];
699 if (action.type =='submit') {
702 var id = _this.form.findField('cohead_id').getValue() * 1;
705 _this.data.cohead_id = action.result.data.cohead_id;
706 this.load({ method: 'GET', params: { '_id' : _this.data.cohead_id }});
712 if (_this.callback) {
713 _this.callback.call(_this, _this.form.getValues());
719 actionfailed : function (_self, action)
721 if (action.failureType == 'client') {
722 Roo.MessageBox.alert("Error", "Fill in all the required fields");
724 if (action.failureType == 'server') {
726 Roo.MessageBox.alert("Error", action.result.errorMsg);
728 _this.dialog.layout.getRegion('center').showPanel(0);
730 rendered : function (form)
747 legend : _this._strings['a240fa27925a635b08dc28c9e4f9216d'] /* Order */,
748 style : 'width:420px',
769 emptyText : _this._strings['086247a9b57fde6eefee2a0c4752242d'] /* Automatic */,
770 fieldLabel : _this._strings['3ffaf70863d6f46e2719050a37d9ef86'] /* Order# */,
771 name : 'cohead_number',
780 style : 'float:left',
788 fieldLabel : _this._strings['6a813cbab5d0c9d33b1a471839935d88'] /* Cust# */,
789 name : 'cohead_cust_id_cust_number',
802 fieldLabel : _this._strings['ce26601dac0dea138b7295f02b7620a7'] /* Customer */,
803 forceSelection : true,
804 hiddenName : 'cohead_cust_id',
806 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
808 name : 'cohead_cust_id_cust_name',
810 qtip : _this._strings['fce6d3795b41b54dc0dab82df50517c1'] /* Select custinfo */,
811 queryParam : 'query[cust_name]',
813 selectOnFocus : true,
814 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{cust_name}</b> </div>',
815 triggerAction : 'all',
817 valueField : 'cust_id',
824 fieldLabel : _this._strings['986b90fb419e5349dd59b691b0e0e9f6'] /* Customer PO# */,
825 name : 'cohead_custponumber',
833 fieldLabel : _this._strings['26e09a1ee1517389c7b07f42df65561a'] /* Ordered */,
835 name : 'cohead_orderdate',
850 fieldLabel : _this._strings['a2fdeac60e3c5b6c51a92e027fb9d533'] /* Target Delivery */,
852 name : 'cohead_targetdate',
865 boxLabel : 'same as order',
867 name : '_same_as_order',
869 check : function (_self, checked)
872 _this.form.findField('cohead_targetdate').setValue(_this.form.findField('cohead_orderdate').getValue());
886 displayField : 'location_name',
888 emptyText : _this._strings['4a2a14210d78f0d82db75d0264030169'] /* Supply From */,
889 fieldLabel : _this._strings['4a2a14210d78f0d82db75d0264030169'] /* Supply From */,
890 forceSelection : true,
891 hiddenName : 'cohead_location_src',
893 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
895 name : 'cohead_location_src_location_name',
897 qtip : _this._strings['151ccf95db9b81c11bb20fbc302af4b6'] /* Select terms */,
898 queryParam : 'query[location_name]',
899 selectOnFocus : true,
900 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{location_name}</b> {location_descrip} </div>',
901 triggerAction : 'all',
903 valueField : 'location_id',
910 sortInfo : { direction : 'ASC', field: 'location_name' },
912 beforeload : function (_self, o){
913 o.params = o.params || {};
915 o.params.location_netable = 1;
916 o.params.location_restrict = 0;
917 o.params._notinternalcompany = 1;
925 url : baseURL + '/Roo/location.php',
930 xtype : 'JsonReader',
931 fields : [{"name":"location_id","type":"int"},"location_name"],
934 totalProperty : 'total',
947 legend : _this._strings['3ec365dd533ddb7ef3d1c111186ce872'] /* Details */,
948 style : 'width:420px',
962 displayField : 'terms_descrip',
964 emptyText : _this._strings['151ccf95db9b81c11bb20fbc302af4b6'] /* Select terms */,
965 fieldLabel : _this._strings['6f1bf85c9ebb3c7fa26251e1e335e032'] /* Terms */,
966 forceSelection : true,
967 hiddenName : 'cohead_terms_id',
969 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
971 name : 'cohead_terms_id_terms_descrip',
973 qtip : _this._strings['151ccf95db9b81c11bb20fbc302af4b6'] /* Select terms */,
974 queryParam : 'query[terms_descrip]',
975 selectOnFocus : true,
976 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{terms_descrip}</b> </div>',
977 triggerAction : 'all',
979 valueField : 'terms_id',
986 sortInfo : { direction : 'ASC', field: 'terms_descrip' },
988 beforeload : function (_self, o){
989 o.params = o.params || {};
998 url : baseURL + '/Roo/terms.php',
1003 xtype : 'JsonReader',
1004 fields : [{"name":"terms_id","type":"int"},"terms_descrip"],
1007 totalProperty : 'total',
1017 displayField : 'salesrep_name',
1019 emptyText : _this._strings['7b09a122e58c067939744c4a96ff2d77'] /* Select salesrep */,
1020 fieldLabel : _this._strings['94f475efc6722fd13ab78411c1ef7bd7'] /* Sales Rep */,
1021 forceSelection : true,
1022 hiddenName : 'cohead_display_salesrep_id',
1024 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
1026 name : 'cohead_display_salesrep_id_salesrep_name',
1028 qtip : _this._strings['7b09a122e58c067939744c4a96ff2d77'] /* Select salesrep */,
1029 queryParam : 'query[salesrep_name]',
1030 selectOnFocus : true,
1031 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{salesrep_name}</b> </div>',
1032 triggerAction : 'all',
1034 valueField : 'salesrep_id',
1037 '|xns' : 'Roo.form',
1041 sortInfo : { direction : 'ASC', field: 'salesrep_name' },
1043 beforeload : function (_self, o){
1044 o.params = o.params || {};
1049 '|xns' : 'Roo.data',
1051 xtype : 'HttpProxy',
1053 url : baseURL + '/Roo/salesrep.php',
1058 xtype : 'JsonReader',
1059 fields : [{"name":"salesrep_id","type":"int"},"salesrep_name"],
1062 totalProperty : 'total',
1072 displayField : 'salesrep_name',
1074 emptyText : _this._strings['de3d17fb46f44fdf066581fbb5fe6113'] /* Select Staff */,
1075 fieldLabel : _this._strings['0ee72ad23c24d7cfc5c13311abdc3f72'] /* Staff I.C. */,
1076 forceSelection : true,
1077 hiddenName : 'cohead_salesrep_id',
1079 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
1081 name : 'cohead_salesrep_id_salesrep_name',
1083 qtip : _this._strings['7b09a122e58c067939744c4a96ff2d77'] /* Select salesrep */,
1084 queryParam : 'query[salesrep_name]',
1085 selectOnFocus : true,
1086 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{salesrep_name}</b> </div>',
1087 triggerAction : 'all',
1089 valueField : 'salesrep_id',
1092 '|xns' : 'Roo.form',
1096 sortInfo : { direction : 'ASC', field: 'salesrep_name' },
1098 beforeload : function (_self, o){
1099 o.params = o.params || {};
1104 '|xns' : 'Roo.data',
1106 xtype : 'HttpProxy',
1108 url : baseURL + '/Roo/salesrep.php',
1113 xtype : 'JsonReader',
1114 fields : [{"name":"salesrep_id","type":"int"},"salesrep_name"],
1117 totalProperty : 'total',
1125 fieldLabel : _this._strings['f4ac45b9eb622dcb26c0d4fc1c93b27c'] /* Order Comments */,
1127 name : 'cohead_ordercomments',
1138 legend : _this._strings['780c462e85ba4399a5d42e88f69a15ca'] /* Billing */,
1139 style : 'width:420px',
1141 '|xns' : 'Roo.form',
1148 '|xns' : 'Roo.form',
1154 displayField : 'cntct_name',
1156 emptyText : _this._strings['fbb9d6ec5325d0fe63c19431856a0802'] /* Select cntct */,
1157 fieldLabel : _this._strings['c3ce05eb16c5e0075b4a247b2c4b7bba'] /* Bill To (select) */,
1158 forceSelection : true,
1159 hiddenName : 'cohead_billto_cntct_id',
1161 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
1163 name : 'cohead_billto_cntct_id_cntct_name',
1165 qtip : _this._strings['fbb9d6ec5325d0fe63c19431856a0802'] /* Select cntct */,
1166 queryParam : 'query[cntct_name]',
1167 selectOnFocus : true,
1168 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{cntct_name}</b> {cntct_addr_id_addr_line1}</div>',
1169 triggerAction : 'all',
1171 valueField : 'cntct_id',
1174 add : function (combo)
1177 Pman.Dialog.XtupleQuickContact.show(
1180 customer_id : _this.form.findField('cohead_cust_id').getValue()
1185 for(var i in data) {
1187 _this.data['cohead_billto_cntct_id_' + i] = data[i];
1190 _this.form.findField('billto_address').update();
1191 // fill in the select box..
1192 _this.form.setValues( {
1193 cohead_billto_cntct_id : data.cntct_id,
1194 cohead_billto_cntct_id_cntct_name : data.cntct_first_name + ' '+
1195 data.cntct_last_name
1200 // Pman.Dialog.XtupleCustomer.show(
1201 //{ cust_id : _this.form.findField('cohead_cust_id').getValue() },
1203 // refresh the data in the pulldown..
1207 beforeselect : function (combo, record, index)
1209 // set _this.data values ..
1211 // just add everything...
1212 for(var i in record.data) {
1213 _this.data['cohead_billto_cntct_id_' + i] = record.data[i];
1216 _this.form.findField('billto_address').update();
1223 '|xns' : 'Roo.form',
1227 sortInfo : { direction : 'ASC', field: 'cntct_name' },
1229 beforeload : function (_self, o){
1230 o.params = o.params || {};
1232 o.params._customer_id = _this.data.cohead_cust_id;
1236 '|xns' : 'Roo.data',
1238 xtype : 'HttpProxy',
1240 url : baseURL + '/Roo/cntct.php',
1245 xtype : 'JsonReader',
1246 fields : [{"name":"cntct_id","type":"int"},"cntct_name"],
1249 totalProperty : 'total',
1257 fieldLabel : _this._strings['1d144309cbdf2536723621bf0eac9f33'] /* or enter Address */,
1258 name : 'billto_address',
1260 update : function() {
1262 var c = ['first_name', 'last_name' ] ;
1263 var a = [ 'line1', 'line2', 'line3', 'city', 'state', 'country' ];
1265 Roo.each(c, function(e) {
1266 if (_this.data['cohead_billto_cntct_id_cntct_' +e].length) {
1267 v.push(_this.data['cohead_billto_cntct_id_cntct_' +e]);
1270 Roo.each(a, function(e) {
1271 if (_this.data['cohead_billto_cntct_id_cntct_addr_id_addr_' +e].length) {
1272 v.push(_this.data['cohead_billto_cntct_id_cntct_addr_id_addr_' +e]);
1276 this.setValue(v.join("\n"));
1278 if(_this.data.cohead_billto_cntct_id_cntct_email.length){
1279 _this.form.findField('billto_email').setValue(_this.data.cohead_billto_cntct_id_cntct_email);
1283 render : function (_self)
1289 this.el.on('click', function() {
1290 var id = _this.form.findField('cohead_billto_cntct_id').getValue();
1291 Pman.Dialog.XtupleQuickContact.show(
1294 customer_id : _this.form.findField('cohead_cust_id').getValue()
1299 for(var i in data) {
1301 _this.data['cohead_billto_cntct_id_' + i] = data[i];
1304 _this.form.findField('billto_address').update();
1305 // fill in the select box..
1306 _this.form.setValues( {
1307 cohead_billto_cntct_id : data.cntct_id,
1308 cohead_billto_cntct_id_cntct_name : data.cntct_first_name + ' '+
1309 data.cntct_last_name
1318 Roo.log("Click text");
1328 xtype : 'DisplayField',
1329 fieldLabel : _this._strings['ce8ae9da5b7cd6c3df2929543a9af92d'] /* Email */,
1330 name : 'billto_email',
1331 valueRenderer : function(v)
1334 return v ? String.format('<a href="mailto:{0}" target="_blank">{0}</a>',v) : '';
1347 style : 'margin-left:10px',
1350 '|xns' : 'Roo.form',
1355 legend : _this._strings['9f1a342d0197aac60ed73e921dc4c1f5'] /* Price Details */,
1356 style : 'width:420px',
1358 '|xns' : 'Roo.form',
1362 labelAlign : 'right',
1366 '|xns' : 'Roo.form',
1371 labelSeparator : ' ',
1374 '|xns' : 'Roo.form',
1379 displayField : 'curr_name',
1381 emptyText : _this._strings['2925dda0ec274c20c0a30d8720eb830b'] /* Select curr_name */,
1382 fieldLabel : _this._strings['386c339d37e737a436499d423a77df0c'] /* Currency */,
1383 forceSelection : true,
1384 hiddenName : 'cohead_curr_id',
1386 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
1388 name : 'cohead_curr_id_curr_name',
1390 qtip : _this._strings['e8586011952b0d098b0e568f20ca2b1f'] /* Select Currency */,
1391 queryParam : 'query[curr_name]',
1392 selectOnFocus : true,
1393 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{curr_name}</b> </div>',
1394 triggerAction : 'all',
1396 valueField : 'curr_id',
1399 beforequery : function (combo, query, forceAll, cancel, e)
1401 Roo.log('beforequery');
1403 if (_this.form.findField('cohead_number').getValue().length) {
1404 Roo.MessageBox.alert("Error", "You can not change the currency of this order");
1406 query.cancel = true;
1413 '|xns' : 'Roo.form',
1417 sortInfo : { direction : 'ASC', field: 'curr_symbol' },
1419 beforeload : function (_self, o){
1420 o.params = o.params || {};
1426 '|xns' : 'Roo.data',
1428 xtype : 'HttpProxy',
1430 url : baseURL + '/Roo/curr_symbol.php',
1435 xtype : 'JsonReader',
1436 fields : [{"name":"curr_id","type":"int"},"curr_symbol"],
1439 totalProperty : 'total',
1446 xtype : 'NumberField',
1447 allowDecimals : true,
1448 cls : 'roo-align-right',
1449 decimalPrecision : 3,
1450 fieldLabel : _this._strings['068f80c7519d0528fb08e82137a72131'] /* Products */,
1451 name : 'cohead_subtotal',
1462 labelSeparator : ' ',
1465 '|xns' : 'Roo.form',
1470 displayField : 'taxzone_descrip',
1472 emptyText : _this._strings['249ff431aa95198ad6814dd1d2799883'] /* Select taxtype */,
1473 fieldLabel : _this._strings['78ca8a8170f2065057507ddcde63d9ca'] /* Tax Zone */,
1474 forceSelection : true,
1475 hiddenName : 'cohead_taxzone_id',
1477 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
1479 name : 'cohead_taxzone_id_taxzone_descrip',
1481 qtip : _this._strings['249ff431aa95198ad6814dd1d2799883'] /* Select taxtype */,
1482 queryParam : 'query[taxzone_descrip]',
1483 selectOnFocus : true,
1484 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{taxzone_descrip}</b> </div>',
1485 triggerAction : 'all',
1487 valueField : 'taxzone_id',
1490 select : function (combo, record, index)
1492 _this.form.findField('cohead_tax').setValue(
1493 parseFloat(record.data.taxzone_rate) *
1494 parseFloat(_this.form.findField('cohead_subtotal').getValue())
1496 _this.form.findField('cohead_total').recalc();
1500 '|xns' : 'Roo.form',
1504 sortInfo : { direction : 'ASC', field: 'taxzone_descrip' },
1506 beforeload : function (_self, o){
1507 o.params = o.params || {};
1510 o.params.with_date = _this.form.findField('cohead_orderdate').getValue().format('Y-m-d');
1511 Roo.log("with date?" + o.params.with_date);
1517 '|xns' : 'Roo.data',
1519 xtype : 'HttpProxy',
1521 url : baseURL + '/Roo/taxzone.php',
1526 xtype : 'JsonReader',
1527 fields : [{"name":"taxzone_id","type":"int"},"taxzone_descrip"],
1530 totalProperty : 'total',
1537 xtype : 'NumberField',
1538 allowDecimals : true,
1539 cls : 'roo-align-right',
1540 decimalPrecision : 3,
1541 fieldLabel : _this._strings['4b78ac8eb158840e9638a3aeb26c4a9d'] /* Tax */,
1542 name : 'cohead_tax',
1551 xtype : 'NumberField',
1552 allowDecimals : true,
1553 cls : 'roo-align-right',
1554 decimalPrecision : 3,
1555 fieldLabel : _this._strings['25d81668fca34c83d0720cc6365d62d6'] /* Pre Tax discount */,
1556 name : 'cohead_pretax_discount',
1565 labelSeparator : ' ',
1568 '|xns' : 'Roo.form',
1571 xtype : 'TextField',
1572 fieldLabel : _this._strings['b6dad11e8e2203819164d64fc82b40f1'] /* Discount after Tax Description */,
1573 name : 'cohead_misc_descrip',
1579 xtype : 'NumberField',
1580 allowDecimals : true,
1581 cls : 'roo-align-right',
1582 decimalPrecision : 1,
1583 fieldLabel : _this._strings['0bcef9c45bd8a48eda1b26eb0c61c869'] /* % */,
1584 name : 'cohead_misc_per',
1585 update : function() {
1586 var m = _this.form.findField('cohead_misc_per');
1587 var pv = parseFloat(_this.form.findField('cohead_subtotal').getValue());
1588 var tax = parseFloat(_this.form.findField('cohead_tax').getValue());
1589 var pd = parseFloat(_this.form.findField('cohead_pretax_discount').getValue());
1591 var discount = parseFloat(_this.form.findField('cohead_posttax_discount').getValue());
1593 if (discount > 0.0) {
1601 var val = ((discount) / (pv + tax + pd)) * -100;
1603 //Roo.log("update discount?" + val);
1604 this.setValue(val.toFixed(1));
1607 _this.form.findField('cohead_misc_descrip').setValue("Discount of " + val.toFixed(1)+'%');
1615 keyup : function (_self, e)
1617 var pv = parseFloat(_this.form.findField('cohead_subtotal').getValue());
1618 var tax = parseFloat(_this.form.findField('cohead_tax').getValue());
1619 var pd = parseFloat(_this.form.findField('cohead_pretax_discount').getValue());
1621 var n = this.getValue();
1622 var discount = parseFloat(n * (pv + tax + pd) * 0.01);
1624 _this.form.findField('cohead_posttax_discount').setValue(discount);
1626 _this.form.findField('cohead_total').recalc();
1627 _this.form.findField('cohead_misc').recalc();
1628 var val = discount * -1.0;
1630 _this.form.findField('cohead_misc_descrip').setValue("Discount of " + val.toFixed(1)+'%');
1640 xtype : 'NumberField',
1641 allowDecimals : true,
1642 cls : 'roo-align-right',
1643 decimalPrecision : 3,
1644 fieldLabel : _this._strings['cc7819055cde3194bb3b136bad5cf58d'] /* */,
1645 name : 'cohead_posttax_discount',
1648 keyup : function (_self, e)
1650 _this.form.findField('cohead_misc_per').update();
1651 _this.form.findField('cohead_total').recalc();
1652 _this.form.findField('cohead_misc').recalc();
1661 xtype : 'NumberField',
1662 allowDecimals : true,
1663 cls : 'roo-align-right',
1664 decimalPrecision : 3,
1665 fieldLabel : _this._strings['96b0141273eabab320119c467cdcaf17'] /* Total */,
1666 name : 'cohead_total',
1668 recalc : function() {
1669 var d = _this.form.getValues();
1671 parseFloat(d.cohead_subtotal) +
1672 parseFloat(d.cohead_pretax_discount) +
1673 parseFloat(d.cohead_posttax_discount) +
1674 parseFloat(d.cohead_tax) +
1675 parseFloat(d.cohead_freight));
1682 xtype : 'NumberField',
1683 allowDecimals : true,
1684 cls : 'roo-align-right',
1685 decimalPrecision : 3,
1686 fieldLabel : _this._strings['ea9cf7e47ff33b2be14e6dd07cbcefc6'] /* Shipping */,
1687 name : 'cohead_freight',
1690 keyup : function (_self, e)
1692 _this.form.findField('cohead_total').recalc();
1699 xtype : 'NumberField',
1700 allowDecimals : true,
1701 cls : 'roo-align-right',
1702 decimalPrecision : 3,
1703 fieldLabel : _this._strings['d335d558a8386d20318888b1f034103d'] /* Unshipped Total */,
1704 name : 'cohead_unshipped',
1711 xtype : 'NumberField',
1712 allowDecimals : true,
1713 cls : 'roo-align-right',
1714 decimalPrecision : 3,
1715 fieldLabel : _this._strings['b98c34417c412e0c87faa828f26b9123'] /* Uninvoiced Total */,
1716 name : 'cohead_uninvoiced',
1728 legend : _this._strings['ea9cf7e47ff33b2be14e6dd07cbcefc6'] /* Shipping */,
1729 style : 'width:420px',
1731 '|xns' : 'Roo.form',
1738 '|xns' : 'Roo.form',
1742 labelSeparator : ' ',
1744 '|xns' : 'Roo.form',
1748 boxLabel : 'Same as Billing',
1749 name : '_shipto_same',
1751 check : function (_self, checked)
1757 if (_this.dataloading) {
1765 // copy the cohead_billto_cntct_id
1766 for (var i in _this.data) {
1767 if (!i.match(/^cohead_billto_cntct_id/)) {
1770 var ni = i.replace(/^cohead_billto_cntct_id/, 'cohead_shipto_cntct_id');
1771 _this.data[ni] = _this.data[i];
1773 _this.form.findField('shipto_address').update();
1774 _this.form.setValues( {
1775 cohead_shipto_cntct_id : _this.data.cohead_shipto_cntct_id,
1776 cohead_shipto_cntct_id_cntct_name : _this.data.cohead_shipto_cntct_id_cntct_first_name + ' ' +
1777 _this.data.cohead_shipto_cntct_id_cntct_last_name
1784 for (var i in _this.data) {
1785 if (!i.match(/^cohead_billto_cntct_id/)) {
1788 var ni = i.replace(/^cohead_billto_cntct_id/, 'cohead_shipto_cntct_id');
1790 _this.data[ni] = '';
1792 _this.form.findField('shipto_address').update();
1794 _this.form.setValues( {
1795 cohead_shipto_cntct_id : '',
1796 cohead_shipto_cntct_id_cntct_name : ''
1813 displayField : 'cntct_name',
1815 emptyText : _this._strings['5f0c1431b38e3d279bf105d48824b7f3'] /* Select ship to */,
1816 fieldLabel : _this._strings['74002cb040b036511b8d031da591364a'] /* Ship to */,
1817 forceSelection : true,
1818 hiddenName : 'cohead_shipto_cntct_id',
1820 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
1822 name : 'cohead_shipto_cntct_id_cntct_name',
1824 qtip : _this._strings['acc95aeaee48871da70cc3bce664728c'] /* Select shiptoinfo */,
1825 queryParam : 'query[cntct_name]',
1826 selectOnFocus : true,
1827 tpl : '<div class=\"x-grid-cell-text x-btn button\">{cntct_name} - <b>{cntct_addr_id_addr_line1}</b> </div>',
1828 triggerAction : 'all',
1830 valueField : 'cntct_id',
1833 add : function (combo)
1835 Pman.Dialog.XtupleQuickContact.show(
1838 customer_id : _this.form.findField('cohead_cust_id').getValue()
1843 for(var i in data) {
1845 _this.data['cohead_shipto_cntct_id_' + i] = data[i];
1848 _this.form.findField('shipto_address').update();
1849 // fill in the select box..
1850 _this.form.setValues( {
1851 cohead_shipto_cntct_id : data.cntct_id,
1852 cohead_shipto_cntct_id_cntct_name : data.cntct_first_name + ' '+
1853 data.cntct_last_name
1859 beforeselect : function (combo, record, index)
1862 // just add everything...
1863 for(var i in record.data) {
1864 //Roo.log('cohead_shipto_cntct_id_' + i +' =' + record.data[i]);
1865 _this.data['cohead_shipto_cntct_id_' + i] = record.data[i];
1868 _this.form.findField('shipto_address').update();
1874 '|xns' : 'Roo.form',
1878 sortInfo : { direction : 'ASC', field: 'cntct_name' },
1880 beforeload : function (_self, o){
1881 o.params = o.params || {};
1883 o.params._customer_id = _this.data.cohead_cust_id;
1887 '|xns' : 'Roo.data',
1889 xtype : 'HttpProxy',
1891 url : baseURL + '/Roo/cntct.php',
1896 xtype : 'JsonReader',
1897 fields : [{"name":"cntct_id","type":"int"},"cntct_name"],
1900 totalProperty : 'total',
1908 fieldLabel : _this._strings['dd7bf230fde8d4836917806aff6a6b27'] /* Address */,
1909 name : 'shipto_address',
1911 update : function() {
1913 var c = ['first_name', 'last_name' ] ;
1914 var a = [ 'line1', 'line2', 'line3', 'city', 'state', 'country' ];
1917 if (_this.data['cohead_shipto_vend_name'] && _this.data['cohead_shipto_vend_name'].length) {
1918 v.push(_this.data['cohead_shipto_vend_name']);
1920 if (_this.data['cohead_shipto_vendaddr_code'] && _this.data['cohead_shipto_vendaddr_code'].length) {
1921 v.push(_this.data['cohead_shipto_vendaddr_code']);
1923 Roo.each(c, function(e) {
1924 if (_this.data['cohead_shipto_cntct_id_cntct_' +e] &&
1925 _this.data['cohead_shipto_cntct_id_cntct_' +e].length) {
1926 v.push(_this.data['cohead_shipto_cntct_id_cntct_' +e]);
1929 Roo.each(a, function(e) {
1930 if (_this.data['cohead_shipto_cntct_id_cntct_addr_id_addr_' +e] &&
1931 _this.data['cohead_shipto_cntct_id_cntct_addr_id_addr_' +e].length) {
1932 v.push(_this.data['cohead_shipto_cntct_id_cntct_addr_id_addr_' +e]);
1936 this.setValue(v.join("\n"));
1940 render : function (_self)
1946 this.el.on('click', function() {
1947 var id = _this.form.findField('cohead_shipto_cntct_id').getValue();
1948 Pman.Dialog.XtupleQuickContact.show(
1951 customer_id : _this.form.findField('cohead_cust_id').getValue()
1956 for(var i in data) {
1958 _this.data['cohead_shipto_cntct_id_' + i] = data[i];
1961 _this.form.findField('shipto_address').update();
1962 // fill in the select box..
1963 _this.form.setValues( {
1964 cohead_shipto_cntct_id : data.cntct_id,
1965 cohead_shipto_cntct_id_cntct_name : data.cntct_first_name + ' '+
1966 data.cntct_last_name
1975 // Roo.log("Click text");
1986 fieldLabel : _this._strings['48e91c2f1cb7b90612ccae2502c7327f'] /* Shipment Comments */,
1987 name : 'cohead_shipcomments',
2006 name : 'cohead_shipto_id',
2012 name : 'cohead_shipto_id_shipto_name',
2018 name : 'cohead_max_linenumber',
2024 name : 'cohead_cust_id',
2030 name : 'cohead_misc',
2031 recalc : function() {
2032 var d = _this.form.getValues();
2034 parseFloat(d.cohead_pretax_discount) +
2035 parseFloat(d.cohead_posttax_discount) );
2042 name : 'taxzone_rate',
2051 xtype : 'GridPanel',
2053 fitContainer : true,
2056 tableName : 'coitem',
2057 title : _this._strings['4b84bd35233c0d3d3c36b9a6ce6e0745'] /* Order Items */,
2059 activate : function() {
2062 try { if (MODULE.isBuilder) {
2066 var id = _this.form.findField('cohead_id').getValue() * 1;
2068 Roo.MessageBox.alert("Save First", "Save the order first, before adding items");
2069 _this.dialog.layout.getRegion('center').showPanel(0);
2074 _this.grid.footer.onClick('first');
2076 //if (_this.form.findField('cohead_cust_id_cust_name').getValue() == 'Bloom and Grow HK') {
2077 // _this.xferAll.show();
2080 // _this.xferAll.hide();
2085 deactivate : function (_self)
2088 _this.grid.stopEditing();
2095 xtype : 'EditorGrid',
2096 autoExpandColumn : 'item_descrip1',
2098 loadAvail : function() {
2101 this.ds.each(function(r) {
2103 if(!r.data.item_number.length){
2107 if(typeof(_this.stockcache[r.data.item_number]) != 'undefined'){
2109 r.set('avail_qty', _this.stockcache[r.data.item_number].qty);
2110 if (r.data.coitem_unitcost_in_order_cur * 1.0 < 0.1) {
2111 r.set('coitem_unitcost_in_order_cur', _this.stockcache[r.data.item_number].unitcost);
2119 item : r.data.item_number,
2120 loc: r.data.coitem_location_src_location_name,
2121 id: r.data.coitem_linenumber + (r.data.coitem_subnumber ? ('.' + r.data.coitem_subnumber) : '')
2125 url : baseURL + '/Roo/itemloc',
2128 _availqty : Roo.encode(q),
2129 curr_name : _this.form.findField('cohead_curr_id').el.dom.value
2131 success : function(res)
2133 for (var i in res.data) {
2134 _this.stockcache[res.data[i].item] = res.data[i];
2136 r.set('avail_qty', _this.stockcache[r.data.item_number].qty);
2137 if (r.data.coitem_unitcost_in_order_cur * 1.0 < 0.1) {
2138 r.set('coitem_unitcost_in_order_cur', _this.stockcache[r.data.item_number].unitcost);
2140 //_this.grid.ds.fireEvent("update", _this.grid.ds, r, Roo.data.Record.EDIT);
2150 afteredit : function (e)
2152 Roo.log('afteredit:' + e.record.data.coitem_linenumber);
2155 // if ( e.record && e.record.data.coitem_id) {
2156 // as we disable update to the display on the ajax callback to
2157 // allow editing flow to continue, and not refresh - we can only update
2158 // these values after something has actually been edited.
2159 // e.record.set('coitem_id', e.record.data.coitem_id);
2160 // e.record.set('coitem_status', e.record.data.coitem_status);
2163 if (e.field == 'item_number' || e.originalValue == e.value) {
2164 // afterselect handles this...
2167 if (e.field == 'item_descrip1') {
2168 e.record.set('coitem_memo', e.value);
2170 var rate = _this.form.findField('taxzone_rate').getValue();
2172 case 'coitem_linedisc':
2174 var cp = parseFloat(e.record.data.coitem_custprice);
2176 if (isNaN(cp) || cp == 0.0) {
2180 var dis = parseFloat(e.value);
2188 Math.max(0,cp * ((100.0 - parseInt(e.value))/ 100.0) )
2191 // donot need to set the subtotal here, coz we will render it automatically
2193 // 'coitem_subtotal',
2194 // e.record.data.coitem_price * 1.0 * e.record.data.coitem_qtyord
2198 case 'coitem_price': // SELL@ price
2200 var cp = parseFloat(e.record.data.coitem_custprice);
2201 // list price is < price -- update it..
2202 if (isNaN(cp) || cp == 0.0 || cp < e.value) {
2203 e.record.set('coitem_custprice', e.value);
2206 // update the discount calc.
2208 e.record.set('coitem_linedisc', Math.max(0, 100.0 - (( e.value / cp) * 100.0)));
2210 // donot need to set the subtotal here, coz we will render it automatically
2212 // 'coitem_subtotal',
2213 // e.record.data.coitem_price * 1.0 * e.record.data.coitem_qtyord
2217 case 'coitem_custprice':
2218 // modified customer price...
2219 // just modify the discount.. -- leave the entered price the same..
2220 var sp = parseFloat(e.record.data.coitem_price);
2221 var cp = parseFloat(e.value);
2222 if (isNaN(cp) || cp == 0.0 || cp < e.value) {
2226 e.record.set('coitem_linedisc', Math.max(0, 100.0 - (( sp / cp) * 100.0)));
2230 case 'coitem_custprice_tax':
2231 var cp = parseFloat(e.value / ( 1 + rate * 1 ));
2232 var sp = parseFloat(e.record.data.coitem_price);
2234 if (isNaN(cp) || cp == 0.0) {
2237 e.record.set('coitem_custprice', cp);
2238 e.record.set('coitem_linedisc', Math.max(0, 100.0 - (( sp / cp) * 100.0)));
2242 case 'coitem_price_tax':
2244 var cp = parseFloat(e.record.data.coitem_custprice);
2245 var sp = parseFloat(e.value / ( 1 + rate * 1 ));
2246 if (isNaN(cp) || cp == 0.0 || cp < sp) {
2247 e.record.set('coitem_custprice', sp);
2250 e.record.set('coitem_price', sp);
2251 e.record.set('coitem_linedisc', Math.max(0, 100.0 - (( sp / cp) * 100.0)));
2260 var doupdate = function() {
2261 if (!e.record.updatePending) {
2262 Roo.log('doupdate...' + e.record.data.coitem_linenumber);
2267 Roo.log('doupdate pending...' + e.record.data.coitem_linenumber);
2268 // wait until it's not peding an update..
2269 doupdate.defer(500);
2272 if(e.record.data.coitem_id * 1 < 1 && !e.record.isInserting){ // insert
2273 e.record.isInserting = 1;
2274 e.record.isUpdating = 0;
2280 if(!e.record.isInserting && !e.record.isUpdating){
2281 e.record.isUpdating = 1;
2286 if(!e.record.updatePending){
2287 e.record.updatePending = 1;
2291 Roo.log("got to end without doing an update?" + e.record.data.coitem_linenumber);
2294 beforeedit : function (e)
2296 // we can only edit if nothing is assigned to shipping or invoices..
2300 if (rec.data.coitem_qtyshipped > 0 || rec.data.cobill_billed > 0 || (rec.data.shipitem_shipped - rec.data.coitem_qtyshipped) > 0 ) {
2301 Roo.MessageBox.alert("Error", "That item has been shipped, has a draft shipment or invoices - void the shipments/invoices first");
2306 if (rec.data.coitem_subnumber * 1 > 0) {
2307 Roo.log("Edit container event");
2308 Roo.log(e); // if it's a tab..
2312 // allow editing of source / destination..
2313 case 'coitem_shipto_id':
2314 case 'coitem_location_src':
2319 Roo.MessageBox.alert("Error", "That is a kit item, edit the container.");
2323 // zero off values..
2324 //if (e.field == 'coitem_qtyord' && rec.data.coitem_qtyord == 0) {
2327 // if (e.field == 'coitem_custprice' && rec.data.coitem_qtyord == 0.0) {
2331 if (rec.data.item_type == 'K' && e.field == 'item_number') {
2332 // you can not change the product type on kits' as it messing things up..
2333 Roo.MessageBox.alert("Error", "That is a kit item,if you need to change it, delete it first.");
2339 celldblclick : function (_self, rowIndex, columnIndex, e)
2341 var rec = this.ds.getAt(rowIndex);
2342 var di = this.cm.getDataIndex(columnIndex);
2343 if (di != 'avail_qty') {
2347 Pman.Dialog.XtupleInvHistory.show({
2348 itemsite_item_id_item_number : rec.data.item_number,
2349 // itemsite_item_id_item_descript1 : rec.data.item_descrip1,
2350 location_name : rec.data.coitem_location_src_location_name,
2351 location_descrip : rec.data.coitem_location_src_location_descrip,
2353 invhist_transdate : _this.form.findField('cohead_targetdate').getValue()
2360 //_this.dialog = Pman.Dialog.FILL_IN
2362 if (_this.panel.active) {
2363 this.footer.onClick('first');
2366 rowclass : function (gridview, rowcfg)
2368 if (rowcfg.record.data.coitem_status == 'C' &&
2369 rowcfg.record.data.shipitem_shipped * 1 < 1) {
2371 rowcfg.rowClass = 'strikethrough';
2373 if (rowcfg.record.data.coitem_status == 'X' ) {
2375 rowcfg.rowClass = 'strikethrough';
2378 if (!rowcfg.record.data.coitem_id) {
2379 rowcfg.rowClass = 'dragon-not-saved';
2388 '|xns' : 'Roo.grid',
2390 xtype : 'PagingToolbar',
2392 emptyMsg : _this._strings['158e64bcd08067d26e9c27679eeced88'] /* No Items */,
2394 updateSummary : function() {
2397 url : baseURL + '/Roo/Coitem',
2401 coitem_cohead_id : _this.form.findField('cohead_id').getValue()
2403 success : function(d) {
2405 f.displayEl.update(String.format(
2406 "{0} items | Subtotal: {2} | Tax: {3} | List Discount {4} | Total : {1}{5}",
2408 _this.form.findField('cohead_curr_id').el.dom.value,
2411 d.data.total_list_discount,
2423 text : _this._strings['806dca90dbeda894ffb258939f9fef9a'] /* Fill empty Ship To */,
2425 click : function (_self, e)
2428 url : baseURL + '/Roo/Cohead',
2431 _fill_shipto : _this.form.findField('cohead_id').getValue()
2433 success : function() {
2434 _this.grid.footer.onClick('first');
2440 '|xns' : 'Roo.Toolbar'
2444 text : _this._strings['c4b515058fab313f403ae427ce7e32b3'] /* Update Location to match S/O */,
2446 click : function (_self, e)
2448 Roo.MessageBox.confirm("Confirm", "Are you sure?<BR>"+
2449 "This will set all the locations to match the Sales Order - and remove all old locations.",
2456 url : baseURL + '/Roo/Cohead',
2459 _fill_location : _this.form.findField('cohead_id').getValue(),
2460 _location_id : _this.form.findField('cohead_location_src').getValue()
2462 success : function() {
2463 _this.grid.footer.onClick('first');
2471 '|xns' : 'Roo.Toolbar'
2475 enableToggle : true,
2477 text : _this._strings['88408722ed9d719c44087292bf8a06cf'] /* Prices with GST */,
2479 render : function (_self)
2481 _this.showgstBtn = _self;
2483 toggle : function (_self, pressed)
2485 this.setText(pressed ? "Prices exc GST" : "Prices with GST");
2486 var cm = _this.grid.getColumnModel();
2488 cm.setHidden(cm.getIndexByDataIndex('coitem_price_tax'), pressed ? false : true);
2489 cm.setHidden(cm.getIndexByDataIndex('coitem_custprice_tax'), pressed ? false : true);
2490 cm.setHidden(cm.getIndexByDataIndex('coitem_subtotal_tax'), pressed ? false : true);
2492 cm.setHidden(cm.getIndexByDataIndex('coitem_price'), pressed ? true : false);
2493 cm.setHidden(cm.getIndexByDataIndex('coitem_custprice'), pressed ? true : false);
2494 cm.setHidden(cm.getIndexByDataIndex('coitem_subtotal'), pressed ? true : false);
2499 '|xns' : 'Roo.Toolbar'
2510 cls : 'x-btn-text-icon',
2511 icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
2512 text : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'] /* Add */,
2517 Roo.log("add presed");
2520 var grid = _this.grid;
2522 grid.ds.each(function(r) {
2523 if (r.data.coitem_qtyord < 1) {
2524 Roo.MessageBox.alert("Error", "you must fill in a quantity for " + r.data.item_number);
2536 var last = _this.form.findField('cohead_max_linenumber').getValue();
2543 _this.form.findField('cohead_max_linenumber').setValue(last);
2545 // this should be getting the previous row..??
2546 var ct = _this.grid.ds.getCount();
2547 var lastrow = ct ? _this.grid.ds.getAt(ct-1) : false;
2549 function lastor(k,d,kk) {
2550 var def = d ? _this.form.findField(k).el.dom.value : _this.form.findField(k).getValue();
2551 return lastrow ? lastrow.data[kk] : def;
2554 // uses form defaults or last row value.
2555 var nr = _this.grid.ds.reader.newRow({
2556 coitem_linenumber : last,
2560 coitem_cohead_id : _this.form.findField('cohead_id').getValue(),
2561 coitem_qtyshipped : 0,
2562 coitem_location_src : lastor('cohead_location_src',false, 'coitem_location_src'),
2563 coitem_location_src_location_name : lastor('cohead_location_src',true, 'coitem_location_src_location_name'),
2564 coitem_shipto_id : lastor('cohead_shipto_id',false, 'coitem_shipto_id'),
2565 coitem_shipto_id_shipto_name : lastor('cohead_shipto_id_shipto_name', false, 'coitem_shipto_id_shipto_name'),
2566 coitem_unitcost_in_order_cur : 0,
2567 coitem_taxtype_id : _this.data.default_taxtype_id,
2568 coitem_taxtype_id_taxtype_name : 'Taxable',
2574 grid.ds.insert(grid.ds.getCount(), nr);
2575 grid.startEditing(grid.ds.getCount()-1, 1); // type..
2576 nr.updatePending = 0;
2581 render : function (_self)
2583 _this.addItemBtn = _self;
2587 '|xns' : 'Roo.Toolbar'
2591 cls : 'x-btn-text-icon',
2592 icon : rootURL + '/Pman/templates/images/search.gif',
2593 text : _this._strings['9f4f3d35db49c5c2bba70a321a42fa87'] /* Find Products */,
2595 click : function (_self, e)
2597 var last = _this.form.findField('cohead_max_linenumber').getValue();
\r
2599 _this.form.findField('cohead_max_linenumber').setValue(last);
2601 var ct = _this.grid.ds.getCount();
\r
2602 var lastrow = ct ? _this.grid.ds.getAt(ct-1) : false;
\r
2604 function lastor(k,d,kk) {
\r
2605 var def = d ? _this.form.findField(k).el.dom.value : _this.form.findField(k).getValue();
\r
2606 return lastrow ? lastrow.data[kk] : def;
\r
2609 var cohead_cust_id = _this.form.findField('cohead_cust_id').getValue();
2610 var cohead_id = _this.form.findField('cohead_id').getValue();
2612 Pman.Dialog.XtupleSalesProductList.show( {cohead_cust_id : cohead_cust_id, cohead_id : cohead_id} , function(res) {
2614 _this.grid.stopEditing();
2616 if (_this.grid.ds.getCount() > 0) {
2617 var lr = _this.grid.ds.getAt(_this.grid.ds.getCount()-1);
2618 if (!lr.data.coitem_itemsite_id) {
2619 lr.set('coitem_itemsite_id', res.item_itemsite_id_itemsite_id);
2620 lr.set('item_number', res.item_number);
2621 lr.set('item_descrip1', res.item_descrip1);
2622 lr.set('coitem_listprice', res.item_price);
2623 lr.set('coitem_price', res.item_price);
2624 lr.set('coitem_custprice', res.item_price);
2631 var nr = _this.grid.ds.reader.newRow({
2632 coitem_linenumber : last,
2633 coitem_itemsite_id : res.item_itemsite_id_itemsite_id,
2634 item_number : res.item_number,
2635 item_descrip1 : res.item_descrip1,
2637 coitem_cohead_id : _this.form.findField('cohead_id').getValue(),
2638 coitem_qtyshipped : 0,
2639 coitem_listprice : res.item_price,
2640 coitem_price : res.item_price,
2641 coitem_custprice : res.item_price,
2643 coitem_location_src : lastor('cohead_location_src',false, 'coitem_location_src'),
2644 coitem_location_src_location_name : lastor('cohead_location_src',true, 'coitem_location_src_location_name'),
2645 coitem_shipto_id : lastor('cohead_shipto_id',false, 'coitem_shipto_id'),
2646 coitem_shipto_id_shipto_name : lastor('cohead_shipto_id_shipto_name', false, 'coitem_shipto_id_shipto_name')
2649 _this.grid.ds.insert(_this.grid.ds.getCount(), nr);
2655 '|xns' : 'Roo.Toolbar'
2659 cls : 'x-btn-text-icon',
2661 icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
2662 text : _this._strings['a0947dda65e4112f49260243804b6528'] /* Xfer all stock to HK */,
2668 url : baseURL + '/Roo/coitem',
2669 mask : 'Loading Data',
2673 _hk_xfer :_this.form.findField('cohead_id').getValue()
2675 success : function() {
2676 _this.grid.ds.load({});
2681 render : function (_self)
2683 _this.xferAll = _self;
2687 '|xns' : 'Roo.Toolbar'
2691 text : _this._strings['66b2bba3de9b8c5d6fb94e9458f1b7f5'] /* Show Inventory History */,
2693 click : function (_self, e)
2695 var c = _this.grid.getSelectionModel().getSelectedCell();
2697 Roo.MessageBox.alert("Error", "Select item to show history (you can also double click on the #avail number) ");
2701 var rec = _this.grid.ds.getAt(c[0]);
2703 Pman.Dialog.XtupleInvHistory.show({
2704 itemsite_item_id_item_number : rec.data.item_number,
2705 // itemsite_item_id_item_descript1 : rec.data.item_descrip1,
2706 location_name : rec.data.coitem_location_src_location_name,
2707 location_descrip : rec.data.coitem_location_src_location_descrip,
2710 invhist_transdate : _this.form.findField('cohead_targetdate').getValue()
2717 '|xns' : 'Roo.Toolbar'
2720 xtype : 'Separator',
2722 '|xns' : 'Roo.Toolbar'
2726 text : _this._strings['900eb3dcf3a7d639acbd2528ca5bbd52'] /* Apply % Discount of : */,
2728 '|xns' : 'Roo.Toolbar'
2731 xtype : 'TextField',
2734 render : function (_self)
2736 _this._applyDiscount = _self;
2744 text : _this._strings['e87de1a5d238411ab34a292be599e9f4'] /* Apply To All */,
2746 click : function (_self, e)
2748 var val = parseFloat(_this._applyDiscount.getValue());
2750 var factor = (100.0 - val)/100.0;
2752 _this.grid.ds.each(function(rec) {
2753 if (rec.data.coitem_qtyshipped > 0 || rec.data.cobill_billed > 0) {
2757 rec.set('coitem_price', rec.data.coitem_custprice * factor);
2758 rec.set('coitem_linedisc', val);
2759 rec.set('coitem_subtotal', rec.data.coitem_price & rec.data.ordqty);
2768 '|xns' : 'Roo.Toolbar'
2772 text : _this._strings['72d6d7a1885885bb55a565fd1070581a'] /* Import */,
2774 click : function (_self, e)
2777 if (!(1* _this.form.findField('cohead_id').getValue())) {
2778 Roo.MessageBox.alert("Error", "save the order first");
2782 Pman.Dialog.Image.show(
2785 _url : baseURL+'/Xtuple/Import/SalesOrder',
2786 onid : _this.form.findField('cohead_id').getValue()
2791 Roo.MessageBox.alert("Notice", "Uploaded");
2792 _this.grid.footer.onClick('first');
2799 '|xns' : 'Roo.Toolbar'
2804 '|xns' : 'Roo.Toolbar'
2808 cls : 'x-btn-text-icon',
2809 icon : rootURL + '/Pman/templates/images/trash.gif',
2810 text : _this._strings['f2a6c498fb90ee345d997f888fce3b18'] /* Delete */,
2814 _this.grid.stopEditing();
2815 // check that no shipments or invoices are done..
2816 var rc = _this.grid.getSelectionModel().getSelectedCell();
2818 var rec = _this.grid.ds.getAt(rc[0]);
2820 if (rec.data.coitem_qtyshipped > 0 || rec.data.cobill_billed > 0) {
2821 Roo.MessageBox.alert("Error", "That item has been shipped or invoices - void the shipments/invoices first");
2824 if (rec.data.coitem_subnumber*1 > 0) {
2825 Roo.MessageBox.alert("Error", "Delete the kit item that that belongs to.");
2828 if (!rec.data.coitem_id) {
2829 _this.grid.ds.remove(rec);
2836 url : baseURL + '/Roo/coitem',
2839 _delete : rec.data.coitem_id
2842 success : function() {
2843 if (rec.data.item_type == 'K') {
2844 _this.grid.ds.load({});
2847 _this.grid.ds.remove(rec);
2852 if (rec.data_qtyord * 1 < 1) {
2856 Roo.MessageBox.confirm("Confirm", "Are you sure you want to delete that line?", function(r)
2870 '|xns' : 'Roo.Toolbar'
2874 cls : 'x-btn-text-icon',
2875 icon : rootURL + '/Pman/templates/images/trash.gif',
2876 text : _this._strings['27f2870eaa01c99fc83105240ad15f7f'] /* Delete All */,
2880 _this.grid.stopEditing();
2881 // check that no shipments or invoices are done..
2883 _this.grid.ds.each(function(rec) {
2887 if (rec.data.coitem_qtyshipped > 0 || rec.data.cobill_billed > 0) {
2888 //Roo.MessageBox.alert("Error", "That item has been shipped or invoices - void the shipments/invoices first");
2891 if (rec.data.item_type == 'K') {
2895 if (rec.data.coitem_subnumber*1 > 0) {
2896 //Roo.MessageBox.alert("Error", "Delete the kit item that that belongs to.");
2899 if (!rec.data.coitem_id) {
2900 _this.grid.ds.remove(rec);
2903 ids.push(rec.data.coitem_id);
2909 url : baseURL + '/Roo/coitem',
2912 _delete : ids.join(',')
2915 success : function() {
2917 _this.grid.footer.onClick('first');
2922 // if (rec.data_qtyord * 1 < 1) {
2926 Roo.MessageBox.confirm("Confirm", "Are you sure you want to delete everything?", function(r)
2940 '|xns' : 'Roo.Toolbar'
2947 sortInfo : { field : 'coitem_linenumber,coitem_subnumber', direction: 'ASC' },
2949 beforeload : function (_self,o) {
2956 if (!_this.data || !_this.data.cohead_id) {
2959 o.params = o.params || {};
2961 o.params.coitem_cohead_id = _this.data.cohead_id;
2962 o.params._without_list_discount =1;
2963 //o.params.limit = 999;
2967 load : function (_self, records, options)
2969 // need to fetch availablity from master data..
2970 // build a list of what to ask..
2972 // query: ITEM CODE - LOCATION
2973 _this.grid.footer.updateSummary();
2974 _this.grid.loadAvail.defer(100, _this.grid);
2980 update : function (_self, rec, operation)
2983 if (operation != Roo.data.Record.COMMIT) {
2987 // row has been updated..
2988 // if the qty + item has been filled in, we should try and save it..
2991 var setRecord = function(){
2993 Roo.log("Clearing update?" + rec.data.coitem_linenumber);
2994 rec.updatePending = 0;
2995 if(rec.isInserting){
2996 rec.isInserting = 0;
3002 if (!(rec.data.coitem_itemsite_id * 1) || !(rec.data.coitem_qtyord*1)) {
3006 var doCommit = function() {
3007 Roo.log("Sending data?" + rec.data.coitem_linenumber);
3010 url : baseURL+'/Roo/coitem',
3013 success: function(res)
3016 var row = _this.grid.ds.indexOf(rec);
3017 Roo.get(_this.grid.view.getRow(row)).removeClass('dragon-not-saved');
3023 Roo.log("GOT success: " + rec.data.coitem_linenumber);
3024 //Roo.log("GOT success");
3025 // update the data...
3027 if (rec.data.item_type == 'K') {
3029 _this.grid.ds.load({});
3034 // why is this here.??
3036 if (_this.grid.activeEditor) {
3042 rec.set('coitem_id', res.data.coitem_id);
3043 rec.set('coitem_status', res.data.coitem_status);
3047 delete rec.modified;
3049 _this.grid.footer.updateSummary();
3050 _this.grid.loadAvail();
3056 failure : function(res)
3059 Roo.MessageBox.alert("Error", res.errorMsg ? res.errorMsg : "Error updating");
3074 '|xns' : 'Roo.data',
3076 xtype : 'HttpProxy',
3078 url : baseURL + '/Roo/coitem.php',
3083 xtype : 'JsonReader',
3084 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\"}',
3087 'name': 'coitem_linenumber',
3091 'name': 'coitem_itemsite_id',
3095 'name': 'coitem_qtyord'
3098 'name': 'coitem_unitcost'
3101 'name': 'coitem_price'
3104 'name': 'coitem_custprice'
3107 'name': 'coitem_qtyreturned'
3110 'name': 'coitem_prcost'
3113 'name': 'coitem_price_uom_id',
3117 'name': 'coitem_qtyreserved'
3122 totalProperty : 'total',
3128 xtype : 'CellSelectionModel',
3129 enter_is_tab : true,
3131 beforeeditnext : function (eventdata)
3135 // this does not work, as the reload effect cancels editng.
3136 var rec = _this.grid.ds.getAt(eventdata.cell[0]);
3137 if (rec.data.coitem_subnumber *1 < 0 ) {
3140 var r = eventdata.cell[0] + 1;
3143 if (r > _this.grid.ds.getCount()-1 ) {
3144 eventdata.cell = false;
3147 rec = _this.grid.ds.getAt(r);
3148 if (rec.data.coitem_subnumber *1 < 0 ) {
3149 eventdata.cell = [ r, eventdata.cell[1] ];
3159 tabend : function (_self)
3161 _this.addItemBtn.fireEvent('click', _this.addItemBtn);
3169 xtype : 'ColumnModel',
3170 builderCfg : '{\"table\":\"coitem\",\"column\":\"coitem_linenumber\",\"columnshort\":\"coitem_linenumber\",\"ctype\":\"int4\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Item#\"}',
3171 dataIndex : 'coitem_linenumber',
3172 header : _this._strings['7a113dee68a51f4c5f71264fd0ce3781'] /* Item# */,
3173 renderer : function(v,x,r) {
3175 if (r.data.coitem_subnumber * 1 > 0) {
3176 return String.format('{0}.{1}', v,r.data.coitem_subnumber);
3178 return String.format('{0}', v);
3185 xtype : 'ColumnModel',
3186 dataIndex : 'item_number',
3187 header : _this._strings['7608203603437f0513ba8203a2d39a4f'] /* Item Code */,
3188 renderer : function(v) { return String.format('{0}', v); },
3191 '|xns' : 'Roo.grid',
3193 xtype : 'GridEditor',
3195 '|xns' : 'Roo.grid',
3199 displayField : 'itemsite_item_id_item_number',
3201 emptyText : _this._strings['786410e93beb0193d89f8608c54feb4b'] /* Select item */,
3202 forceSelection : true,
3203 hiddenName : 'itemsite_item_id_item_number',
3205 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
3207 name : 'item_number',
3209 qtip : _this._strings['786410e93beb0193d89f8608c54feb4b'] /* Select item */,
3210 queryParam : 'query[number]',
3211 selectOnFocus : true,
3212 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>',
3213 triggerAction : 'all',
3215 valueField : 'item_number',
3217 beforeselect : function (combo, record, index)
3219 // set _this.data values ..
3220 var ar = _this.grid.activeEditor.record;
3221 // Roo.log('beforeselect');
3225 // Roo.log('beforeselect-cb');
3226 ar.set('item_descrip1', record.data.itemsite_item_id_item_descrip1);
3227 ar.set('coitem_listprice', record.data.item_listprice);
3228 ar.set('coitem_price', record.data.item_price);
3229 ar.set('coitem_custprice', record.data.item_price);
3230 ar.set('coitem_itemsite_id', record.data.itemsite_id);
3231 ar.set('item_number', record.data.itemsite_item_id_item_number);
3232 ar.set('item_type', record.data.itemsite_item_id_item_type);
3233 ar.set('avail_qty', 0);
3240 '|xns' : 'Roo.form',
3244 sortInfo : { direction : 'ASC', field: 'item_number' },
3246 beforeload : function (_self, o){
3247 o.params = o.params || {};
3248 o.params.customer_id = _this.form.findField('cohead_cust_id').getValue();
3249 o.params['query[cohead_id]'] = _this.form.findField('cohead_id').getValue();
3250 //o.params.shipto_cust_id = _this.data.cohead_cust_id;
3255 '|xns' : 'Roo.data',
3257 xtype : 'HttpProxy',
3259 url : baseURL + '/Roo/itemsite.php',
3264 xtype : 'JsonReader',
3265 fields : [{"name":"item_id","type":"int"},"item_number"],
3268 totalProperty : 'total',
3277 xtype : 'ColumnModel',
3278 dataIndex : 'coitem_location_src',
3279 header : _this._strings['5da618e8e4b89c66fe86e32cdafde142'] /* From */,
3280 renderer : function(v,x,r) {
3281 return String.format('{0}', r.data.coitem_location_src_location_name);
3285 '|xns' : 'Roo.grid',
3287 xtype : 'GridEditor',
3289 '|xns' : 'Roo.grid',
3294 displayField : 'location_name',
3296 emptyText : _this._strings['fc44040a63559bee1157010d4c602422'] /* Select location */,
3297 forceSelection : true,
3298 hiddenName : 'coitem_location_src',
3300 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
3302 name : 'coitem_location_src_location_name',
3304 qtip : _this._strings['786410e93beb0193d89f8608c54feb4b'] /* Select item */,
3305 queryParam : 'query[location_name]',
3306 selectOnFocus : true,
3307 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b> {location_name}</b> {location_descrip}</div>',
3308 triggerAction : 'all',
3310 valueField : 'location_id',
3312 beforeselect : function (combo, record, index)
3314 // set _this.data values ..
3315 var ar = _this.grid.activeEditor.record;
3319 //Roo.log('beforeselect');
3323 // Roo.log('beforeselect-cb');
3324 ar.set('item_descrip1', record.data.itemsite_item_id_item_descrip1);
3325 ar.set('coitem_price', record.data.item_listprice);
3326 ar.set('coitem_custprice', record.data.item_price);
3327 ar.set('coitem_itemsite_id', record.data.itemsite_id);
3328 ar.set('item_number', record.data.itemsite_item_id_item_number);
3336 '|xns' : 'Roo.form',
3340 sortInfo : { direction : 'ASC', field: 'location_name' },
3342 beforeload : function (_self, o){
3343 o.params = o.params || {};
3345 var row = _this.grid.activeEditor.record;
3347 o.params['query[item_itemsite_id]'] = row.data.coitem_itemsite_id;
3348 // need to know the date to calc the est. delivery time..
3349 //o.params['query[avail_when]'] = _this.form.findField('cohead_targetdate').getValue().format('Y-m-d');
3350 //o.params.location_netable = 1;
3351 o.params['query[cohead_id]'] = _this.form.findField('cohead_id').getValue();
3353 o.params.location_restrict = 0;
3354 o.params._notinternalcompany = 1;
3358 // o.params.itemsite_id = _this.form.findField('cohead_cust_id').getValue();
3359 //o.params.shipto_cust_id = _this.data.cohead_cust_id;
3364 '|xns' : 'Roo.data',
3366 xtype : 'HttpProxy',
3368 url : baseURL + '/Roo/location.php',
3373 xtype : 'JsonReader',
3374 fields : [{"name":"location_id","type":"int"},"location_name"],
3377 totalProperty : 'total',
3386 xtype : 'ColumnModel',
3387 dataIndex : 'coitem_shipto_id',
3388 header : _this._strings['e12167aa0a7698e6ebc92b4ce3909b53'] /* To */,
3389 renderer : function(v,x,r) {
3390 return String.format('{0}:{1}', v, r.data.coitem_shipto_id_shipto_name);
3394 '|xns' : 'Roo.grid',
3396 xtype : 'GridEditor',
3398 '|xns' : 'Roo.grid',
3403 displayField : 'shipto_name',
3405 emptyText : _this._strings['fbb9d6ec5325d0fe63c19431856a0802'] /* Select cntct */,
3406 forceSelection : true,
3407 hiddenName : 'cohead_shipto_id',
3409 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
3411 name : 'coitem_shipto_id_shipto_name',
3413 qtip : _this._strings['e23841a1d7427d8a9297142145dff049'] /* Select shipto */,
3414 queryParam : 'query[shipto_name]',
3415 selectOnFocus : true,
3416 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{shipto_id}:{shipto_addr_id_addr_name}</b> </div>',
3417 triggerAction : 'all',
3419 valueField : 'shipto_id',
3422 add : function (combo)
3425 Pman.Dialog.XtupleCustomer.show({ cust_id : _this.form.findField('cohead_cust_id').getValue() }, function(data) {
3426 // refresh the data in the pulldown..
3429 beforeselect : function (combo, record, index)
3433 for(var i = 1; i <4; i++) {
3434 _this.data['cohead_shiptoaddress'+ i] = record.data['cntct_addr_id_addr_line'+i];
3436 _this.form.findField('shipto_address').update();
3442 '|xns' : 'Roo.form',
3446 sortInfo : { direction : 'ASC', field: 'shipto_name' },
3448 beforeload : function (_self, o){
3449 o.params = o.params || {};
3450 o.params.shipto_cust_id = _this.data.cohead_cust_id;
3451 //o.params['query[with_shipinfo]'] = 1;
3456 '|xns' : 'Roo.data',
3458 xtype : 'HttpProxy',
3460 url : baseURL + '/Roo/shiptoinfo.php',
3465 xtype : 'JsonReader',
3466 fields : [{"name":"cntct_id","type":"int"},"cntct_name"],
3469 totalProperty : 'total',
3478 xtype : 'ColumnModel',
3479 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\":\"\"}',
3480 dataIndex : 'item_descrip1',
3481 header : _this._strings['d9db367d7e9d6a3d3ca0346dfa1ff9d2'] /* Item Description */,
3482 renderer : function(v,x,r) {
3484 if (r.data.coitem_memo && r.data.coitem_memo.length) {
3485 return String.format('{0}', r.data.coitem_memo);
3486 if (r.data.coitem_memo != v) {
3487 r.set('item_descrip1', r.data.coitem_memo);
3491 if (v && v.length > 49) {
3492 return String.format('<span style="color:orange" qtip="line may be too long to print">{0}</span>', v);
3495 return String.format('{0}', v);
3500 '|xns' : 'Roo.grid',
3502 xtype : 'GridEditor',
3504 '|xns' : 'Roo.grid',
3506 xtype : 'TextField',
3514 xtype : 'ColumnModel',
3516 builderCfg : '{\"table\":\"coitem\",\"column\":\"coitem_unitcost\",\"columnshort\":\"coitem_unitcost\",\"ctype\":\"numeric\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Unit Cost\"}',
3517 dataIndex : 'coitem_status',
3518 header : _this._strings['ec53a8c4f07baed5d8825072c89799be'] /* Status */,
3519 renderer : function(v) { return String.format('{0}', v); },
3525 xtype : 'ColumnModel',
3527 dataIndex : 'coitem_qtyord',
3528 header : _this._strings['03ab340b3f99e03cff9e84314ead38c0'] /* Qty */,
3529 renderer : function(v,x,r) {
3530 var v = parseInt(v);
3531 //var aq = parseInt(r.data.avail_qty);
3532 //aq = isNaN(aq) ? 0 : aq;
3534 var rate = _this.form.findField('taxzone_rate').getValue();
3535 r.data.coitem_subtotal = v * r.data.coitem_price;
3536 r.data.coitem_subtotal_tax = v * r.data.coitem_price * ( 1 + rate * 1);
3537 return String.format('{0}', v);
3542 '|xns' : 'Roo.grid',
3544 xtype : 'GridEditor',
3546 '|xns' : 'Roo.grid',
3548 xtype : 'NumberField',
3549 allowDecimals : false,
3550 decimalPrecision : 0,
3552 style : 'text-align:right',
3554 focus : function (_self)
3556 if (this.value == 0) {
3557 this.el.dom.value = '';
3567 xtype : 'ColumnModel',
3569 dataIndex : 'coitem_price',
3570 header : _this._strings['b166cb3a96bdb966f3288b8599594d0d'] /* Sell @ */,
3571 renderer : function(v,x,r) {
3573 var rate = _this.form.findField('taxzone_rate').getValue();
3574 r.data.coitem_subtotal = v * r.data.coitem_qtyord;
3575 r.data.coitem_subtotal_tax = v * ( 1 + rate * 1 ) * r.data.coitem_qtyord;
3576 r.data.coitem_price_tax = v * ( 1 + rate * 1 );
3577 if (parseInt(v) < 1) {
3578 return String.format('<b style="color:red;">{0}</b>', Roo.util.Format.number(v,3));
3582 //r.set('coitem_subtotal', v * r.data.coitem_qtyord);
3584 return String.format('{0}', Roo.util.Format.number(v,3));
3588 '|xns' : 'Roo.grid',
3590 xtype : 'GridEditor',
3592 '|xns' : 'Roo.grid',
3594 xtype : 'NumberField',
3595 decimalPrecision : 3,
3597 style : 'text-align:right',
3599 focus : function (_self)
3601 if (this.value == 0.0) {
3602 this.el.dom.value = '';
3612 xtype : 'ColumnModel',
3614 dataIndex : 'coitem_price_tax',
3615 header : _this._strings['9122d60c0550be8ab070b96d8bbc6358'] /* Sell @w/GST */,
3617 renderer : function(v,x,r) {
3619 if (parseInt(v) < 1) {
3620 return String.format('<b style="color:red;">{0}</b>', Roo.util.Format.number(v,3));
3623 return String.format('{0}', Roo.util.Format.number(v,3));
3627 '|xns' : 'Roo.grid',
3629 xtype : 'GridEditor',
3631 '|xns' : 'Roo.grid',
3633 xtype : 'NumberField',
3634 decimalPrecision : 3,
3636 style : 'text-align:right',
3638 focus : function (_self)
3640 if (this.value == 0.0) {
3641 this.el.dom.value = '';
3651 xtype : 'ColumnModel',
3653 dataIndex : 'coitem_linedisc',
3654 header : _this._strings['9d4ba8f5211a3ba238b2032be5991c14'] /* Disc% */,
3655 renderer : function(v,x,r) {
3657 // coitem_custprice = coitem_price * ((100 - coitem_disc)/ 100)
3659 // 12 * (( 100 - 0) / 100)
3660 // coitem_custprice / coitem_price = ((100 - coitem_disc)/ 100)
3661 // 100 - ((coitem_custprice / coitem_price) * 100) = coitem_disc
3662 // 100 - 97 = 100 -3
3664 // r.data.coitem_linedisc = 100 - (
3665 // (parseFloat(r.data.coitem_custprice) /
3666 // parseFloat(r.data.coitem_price)
3668 var fl = parseFloat(r.data.coitem_linedisc);
3669 if ( isNaN(fl) || fl == 0.0 || r.data.coitem_price > r.data.coitem_custprice) {
3672 return String.format('<span style="color:green">{0}%</span>', Roo.util.Format.number( r.data.coitem_linedisc,2));
3676 '|xns' : 'Roo.grid',
3678 xtype : 'GridEditor',
3680 '|xns' : 'Roo.grid',
3682 xtype : 'NumberField',
3683 decimalPrecision : 2,
3686 style : 'text-align:right',
3688 focus : function (_self)
3690 if (this.value == 0.0) {
3691 this.el.dom.value = '';
3701 xtype : 'ColumnModel',
3703 dataIndex : 'coitem_custprice',
3704 header : _this._strings['f84e65035f5d2d4a090b8a626c822321'] /* List Price */,
3705 renderer : function(v,x,r) {
3707 var rate = _this.form.findField('taxzone_rate').getValue();
3708 r.data.coitem_custprice_tax = v * ( 1 + rate * 1 );
3710 var tip = 'No WRP available';
3711 if ((r.data.coitem_wrpprice * 1) > 0) {
3712 tip = "WRP : " + Roo.util.Format.number(r.data.coitem_wrpprice,3);
3714 // less than zero, show as red..
3715 if (parseFloat(v) < 1) {
3716 return String.format('<b qtip="{1}" style="color:red;">{0}</b>',
3717 Roo.util.Format.number(v,3), tip);
3719 if (r.data.customer_price_each != v) {
3720 return String.format('<b qtip="{1}" style="color:pink;">{0}</b>',
3721 Roo.util.Format.number(v,3),
3722 "List Price = " + Roo.util.Format.number(r.data.customer_price_each,3)
3728 //r.data.coitem_subtotal = v * r.data.coitem_qtyord;
3730 //r.set('coitem_subtotal', v * r.data.coitem_qtyord);
3732 return String.format('<span qtip="{1}">{0}</span>', Roo.util.Format.number(v,3), tip);
3736 '|xns' : 'Roo.grid',
3738 xtype : 'GridEditor',
3740 '|xns' : 'Roo.grid',
3742 xtype : 'NumberField',
3743 decimalPrecision : 3,
3745 style : 'text-align:right',
3747 focus : function (_self)
3749 if (this.value == 0.0) {
3750 this.el.dom.value = '';
3760 xtype : 'ColumnModel',
3762 dataIndex : 'coitem_custprice_tax',
3763 header : _this._strings['4721299f56b6b7d43591156d1d3f3e82'] /* List Price w/GST */,
3765 renderer : function(v,x,r) {
3766 var rate = _this.form.findField('taxzone_rate').getValue();
3767 var tip = 'No WRP available';
3768 if ((r.data.coitem_wrpprice * 1) > 0) {
3769 tip = "WRP : " + Roo.util.Format.number(r.data.coitem_wrpprice,3);
3772 if (parseFloat(v) < 1) {
3773 return String.format('<b qtip="{1}" style="color:red;">{0}</b>',
3774 Roo.util.Format.number(v,3), tip);
3776 if (r.data.customer_price_each != v) {
3777 return String.format('<b qtip="{1}" style="color:pink;">{0}</b>',
3778 Roo.util.Format.number(v,3),
3779 "List Price = " + Roo.util.Format.number(r.data.customer_price_each * ( 1 + rate * 1 ),3)
3783 return String.format('<span qtip="{1}">{0}</span>', Roo.util.Format.number(v,3), tip);
3787 '|xns' : 'Roo.grid',
3789 xtype : 'GridEditor',
3791 '|xns' : 'Roo.grid',
3793 xtype : 'NumberField',
3794 decimalPrecision : 3,
3796 style : 'text-align:right',
3798 focus : function (_self)
3800 if (this.value == 0.0) {
3801 this.el.dom.value = '';
3811 xtype : 'ColumnModel',
3813 dataIndex : 'coitem_subtotal',
3814 header : _this._strings['c5eae6ea505388a73962c635ac821fba'] /* SubTotal */,
3815 renderer : function(v) {
3817 if (parseInt(v) < 1) {
3818 return String.format('<b style="color:red;">{0}</b>', Roo.util.Format.number(v,2));
3823 return Roo.util.Format.number( v, 2);
3830 xtype : 'ColumnModel',
3832 dataIndex : 'coitem_subtotal_tax',
3833 header : _this._strings['236119342501b1e596bc82013c9cfc42'] /* SubTotal w/GST */,
3835 renderer : function(v,x,r) {
3837 if (parseInt(v) < 1) {
3838 return String.format('<b style="color:red;">{0}</b>', Roo.util.Format.number(v,2));
3841 return String.format('{0}', Roo.util.Format.number(v,2));
3848 xtype : 'ColumnModel',
3850 builderCfg : '{\"table\":\"coitem\",\"column\":\"coitem_unitcost\",\"columnshort\":\"coitem_unitcost\",\"ctype\":\"numeric\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Unit Cost\"}',
3851 dataIndex : 'coitem_unitcost_in_order_cur',
3852 header : _this._strings['871080cb9d00a8bda1b9f1db3c164341'] /* Unit Cost */,
3853 renderer : function(v) { return Roo.util.Format.number( v, 2); },
3859 xtype : 'ColumnModel',
3861 dataIndex : 'coitem_taxtype_id',
3862 header : _this._strings['13abfee28b4564e3fb059420fbedbec5'] /* Taxed */,
3863 renderer : function(v,x,r) { return String.format('{0}', r.data.coitem_taxtype_id_taxtype_name); },
3866 '|xns' : 'Roo.grid',
3868 xtype : 'GridEditor',
3870 '|xns' : 'Roo.grid',
3874 displayField : 'taxtype_name',
3876 emptyText : _this._strings['b3c65c9f85b429821cf931b38386a64d'] /* Select Tax Type */,
3877 forceSelection : true,
3878 hiddenName : 'coitem_taxtype_id',
3880 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
3882 name : 'coitem_taxtype_id_taxtype_name',
3884 qtip : _this._strings['249ff431aa95198ad6814dd1d2799883'] /* Select taxtype */,
3885 queryParam : 'query[taxtype_id]',
3886 selectOnFocus : true,
3887 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{taxtype_name}</b> </div>',
3888 triggerAction : 'all',
3890 valueField : 'taxtype_id',
3893 '|xns' : 'Roo.form',
3897 sortInfo : { direction : 'ASC', field: 'taxtype_name' },
3899 beforeload : function (_self, o){
3900 o.params = o.params || {};
3907 '|xns' : 'Roo.data',
3909 xtype : 'HttpProxy',
3911 url : baseURL + '/Roo/taxtype.php',
3916 xtype : 'JsonReader',
3917 fields : [{"name":"taxtype_id","type":"int"},"taxtype_name"],
3920 totalProperty : 'total',
3929 xtype : 'ColumnModel',
3931 dataIndex : 'avail_qty',
3932 header : _this._strings['7eb17faabef94701775df7154f30684b'] /* #avail */,
3933 renderer : function(v,x,r) {
3935 var oq = parseInt(r.data.coitem_qtyord);
3936 var aq = parseInt(r.data.avail_qty);
3937 var sq = parseInt(r.data.coitem_qtyshipped);
3938 aq = isNaN(aq) ? 0 : aq;
3939 oq = isNaN(oq) ? 0 : oq;
3940 sq = isNaN(sq) ? 0 : sq;
3942 var unshipped = oq - sq;
3944 if ( aq < 0 || (unshipped > 0 && aq < unshipped)) {
3945 return String.format('<b style="color:red;">{0}</b>', parseInt(aq));
3948 return String.format('{0}', aq);
3956 xtype : 'ColumnModel',
3958 builderCfg : '{\"table\":\"coitem\",\"column\":\"coitem_qtyreserved\",\"columnshort\":\"coitem_qtyreserved\",\"ctype\":\"numeric\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"#reserved\"}',
3959 dataIndex : 'shipitem_shipped',
3960 header : _this._strings['7ce96513eec175e6123b56573750b0dd'] /* #reserved */,
3961 renderer : function(v,x,r) {
3964 var vv = parseInt(v);
3965 vv = isNaN(vv) ? 0 : vv;
3967 var ov = parseInt(r.data.coitem_qtyord);
3968 ov = isNaN(ov) ? 0 : ov;
3970 var qs = parseInt(r.data.coitem_qtyshipped);
3971 qs = isNaN(qs) ? 0 : qs;
3976 // not enough reserved yet.
3977 return String.format('<b style="background-color:red;color:yellow">{0}</b>', vv - qs);
3980 return String.format('{0}', vv - qs);
3988 xtype : 'ColumnModel',
3990 builderCfg : '{\"table\":\"coitem\",\"column\":\"coitem_qtyreserved\",\"columnshort\":\"coitem_qtyreserved\",\"ctype\":\"numeric\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"#reserved\"}',
3991 dataIndex : 'coitem_qtyshipped',
3992 header : _this._strings['6b15347cbd1bf352b547741a7525c1b4'] /* #shipped */,
3993 renderer : function(v,x,r) {
3995 var vv = parseInt(v);
3996 vv = isNaN(vv) ? 0 : vv;
3998 var ov = parseInt(r.data.coitem_qtyord);
3999 ov = isNaN(ov) ? 0 : ov;
4003 // not enought shipped.
4004 // or too many shipped.
4005 return String.format('<b style="background-color:red;color:yellow">{0}</b>', vv);
4010 return String.format('{0}', vv);
4018 xtype : 'ColumnModel',
4020 dataIndex : 'cobill_billed',
4021 header : _this._strings['f3d90c6982143029487fb00d4ef19526'] /* #invoiced */,
4022 renderer : function(v,x,r) {
4024 var vv = parseInt(v);
4025 vv = isNaN(vv) ? 0 : vv;
4027 var ov = parseInt(r.data.coitem_qtyord);
4028 ov = isNaN(ov) ? 0 : ov;
4032 return String.format('<b style="background-color:red;color:yellow">{0}</b>', vv);
4034 return String.format('{0}', vv);
4045 xtype : 'NestedLayoutPanel',
4047 title : _this._strings['50104a28589c5b6099d3580861c2551a'] /* Shipments / Invoices */,
4049 activate : function (_self)
4051 _this.shipinvtab = _self;
4057 xtype : 'BorderLayout',
4061 xtype : 'LayoutRegion',
4067 xtype : 'LayoutRegion',
4069 title : _this._strings['607ff05a0e4c02c54b2262cd2e381aff'] /* Reserve Stock / Shipments */,
4075 xtype : 'GridPanel',
4077 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\"}',
4078 fitContainer : true,
4081 tableName : 'shiphead',
4082 title : _this._strings['f4757c5aca5e4410b63c6ec4cd0f2363'] /* shiphead */,
4084 activate : function() {
4085 _this.shippanel = this;
4086 if (_this.shipgrid) {
4087 _this.shipgrid.ds.load({});
4095 autoExpandColumn : 'shiphead_shipvia',
4096 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\"}',
4101 _this.shipgrid = this;
4102 //_this.dialog = Pman.Dialog.FILL_IN
4103 if (_this.shippanel.active) {
4107 rowdblclick : function (_self, rowIndex, e)
4109 var rec = this.ds.getAt(rowIndex);
4110 if (!rec.json.shiphead_shipdate.length) {
4111 Roo.MessageBox.alert("Error", "You can not edit voided shipments, create a new one, and use the restore feature");
4115 Pman.Dialog.XtupleShipment.show({
4116 shiphead_id : rec.data.shiphead_id
4126 '|xns' : 'Roo.grid',
4134 cls : 'x-btn-text-icon',
4135 icon : rootURL + '/Pman/templates/images/lock.gif',
4136 text : _this._strings['813f81532d71077e497863ec9faf16c7'] /* Confirm Shipment */,
4140 var sel = _this.shipgrid.getSelectionModel().getSelected();
4142 Roo.MessageBox.alert("Error", "Select a shipment");
4145 if (sel.data.shiphead_shipped) {
4146 Roo.MessageBox.alert("Error", "Shipment is already confirmed");
4151 // check current status of shipment..
4156 url : baseURL + '/Roo/shiphead',
4160 shiphead_id : sel.data.shiphead_id,
4163 success : function() {
4164 _this.shipgrid.ds.load({});
4172 '|xns' : 'Roo.Toolbar'
4176 cls : 'x-btn-text-icon',
4177 icon : rootURL + '/Pman/templates/images/save.gif',
4178 text : _this._strings['70c6ddcd97af88d0aaac48268c459727'] /* Download (as xls) */,
4182 var sel = _this.shipgrid.getSelectionModel().getSelected();
4184 Roo.MessageBox.alert("Error", "Select a shipment");
4189 // check current status of shipment..
4193 url : baseURL + '/Roo/shiphead',
4196 _download :sel.data.shiphead_id
4205 '|xns' : 'Roo.Toolbar'
4209 cls : 'x-btn-text-icon',
4210 icon : rootURL + '/Pman/templates/images/pdf.gif',
4211 text : _this._strings['8c6aab77edc5b8e589b36bcf989683e4'] /* Print Picking Slip */,
4215 var sel = _this.shipgrid.getSelectionModel().getSelected();
\r
4217 Roo.MessageBox.alert("Error", "Select a shipment");
\r
4220 // check current status of shipment..
4223 url : baseURL + '/Xtuple/Print',
4226 template : 'picking-slip',
4227 param : "shiphead_id:integer='" + sel.data.shiphead_id + "'",
4228 filename : 'picking-slip-' + sel.data.shiphead_number
4230 success : function() {
4240 '|xns' : 'Roo.Toolbar'
4244 cls : 'x-btn-text-icon',
4245 icon : rootURL + '/Pman/templates/images/pdf.gif',
4246 text : _this._strings['1b7132f58f9ee9de75e5778ff04f7303'] /* Print Delivery Note */,
4250 var sel = _this.shipgrid.getSelectionModel().getSelected();
\r
4252 Roo.MessageBox.alert("Error", "Select a shipment");
\r
4255 // check current status of shipment..
4258 url : baseURL + '/Xtuple/Print',
4261 template : 'delivery-note-',
4262 param : "shiphead_id:integer='" + sel.data.shiphead_id + "'",
4263 filename : 'delivery-note-' + sel.data.shiphead_number
4265 success : function() {
4275 '|xns' : 'Roo.Toolbar'
4279 cls : 'x-btn-text-icon',
4280 icon : Roo.rootURL + 'images/default/dd/email.gif',
4281 text : _this._strings['62f0de97dd70387d493350e45bfa5583'] /* Send Delivery Email */,
4285 var s = _this.shipgrid.getSelectionModel().getSelected();
4287 if(!s || s.data.shiphead_id * 1 < 1){
4288 Roo.MessageBox.alert('Error', 'Please select a shipment');
4294 url: baseURL+ '/Roo/shiphead',
4296 shiphead_id : s.data.shiphead_id,
4299 success : function() {
4300 Roo.MessageBox.alert('Notice', 'SENT');
4307 '|xns' : 'Roo.Toolbar'
4312 '|xns' : 'Roo.Toolbar'
4316 cls : 'x-btn-text-icon',
4317 icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
4318 text : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'] /* Add */,
4322 if (!_this.form.findField('cohead_id').getValue()) {
4323 Roo.MessageBox.alert("Error", "Save Order first");
4326 var rv = _this.form.getFieldValues();
4328 Pman.Dialog.XtupleShipmentNew.show({
4329 shiphead_order_id : rv.cohead_id,
4330 shiphead_shipdate : _this.form.findField('cohead_targetdate').getValue().format('Y-m-d')
4333 _this.shipgrid.ds.load({});
4337 render : function (_self)
4339 _this.addShipmentBtn = _self;
4343 '|xns' : 'Roo.Toolbar'
4347 cls : 'x-btn-text-icon',
4348 icon : rootURL + '/Pman/templates/images/trash.gif',
4349 text : _this._strings['9aa6071f39d387792476bd70fed66735'] /* Void / Unconfirm */,
4353 var sel = _this.shipgrid.getSelectionModel().getSelected();
4355 Roo.MessageBox.alert("Error", "Select a shipment");
4358 // check current status of shipment..
4360 var msg = sel.data.shiphead_shipped ?
4361 "Are you sure you want to un-confirm that shipment? - It will remove items from unposted invoices" :
4362 "Are you sure you want to void that shipment?";
4364 Roo.MessageBox.confirm("Are you sure", msg,
4372 url : baseURL + '/Roo/shiphead',
4376 shiphead_id : sel.data.shiphead_id,
4379 success : function() {
4380 _this.shipgrid.ds.load({});
4394 '|xns' : 'Roo.Toolbar'
4400 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\"}',
4402 sortInfo : { field : 'shiphead_shipvia', direction: 'ASC' },
4404 beforeload : function (_self, options)
4406 options.params = options.params || {};
4407 options.params.shiphead_order_id = _this.form.findField('cohead_id').getValue() * 1;
4408 if (options.params.shiphead_order_id < 1) {
4414 '|xns' : 'Roo.data',
4416 xtype : 'HttpProxy',
4418 url : baseURL + '/Roo/shiphead.php',
4423 xtype : 'JsonReader',
4424 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\"}',
4427 'name': 'shiphead_number',
4431 'name': 'shiphead_shipvia',
4435 'name': 'shiphead_shipdate',
4439 'name': 'shiphead_sfstatus'
4442 'name': 'shiphead_tracknum',
4448 totalProperty : 'total',
4454 xtype : 'RowSelectionModel',
4455 singleSelect : true,
4461 xtype : 'ColumnModel',
4462 builderCfg : '{\"table\":\"shiphead\",\"column\":\"shiphead_number\",\"columnshort\":\"shiphead_number\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}',
4463 dataIndex : 'shiphead_number',
4464 header : _this._strings['b1bc248a7ff2b2e95569f56de68615df'] /* number */,
4465 renderer : function(v,x,r) {
4466 if (r.json.shiphead_shipdate.length) {
4467 return String.format('{0}', v);
4469 return String.format('<s>{0}</s>', v);
4476 xtype : 'ColumnModel',
4477 dataIndex : 'shiphead_location_id_location_name',
4478 header : _this._strings['40e6e8652d174c7ceef48df46f9cf25a'] /* From Location */,
4479 renderer : function(v) { return String.format('{0}', v); },
4485 xtype : 'ColumnModel',
4486 dataIndex : 'shiphead_shipto_id_shipto_name',
4487 header : _this._strings['74002cb040b036511b8d031da591364a'] /* Ship to */,
4488 renderer : function(v) { return String.format('{0}', v); },
4494 xtype : 'ColumnModel',
4495 builderCfg : '{\"table\":\"shiphead\",\"column\":\"shiphead_shipdate\",\"columnshort\":\"shiphead_shipdate\",\"ctype\":\"date\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}',
4496 dataIndex : 'shiphead_shipdate',
4497 header : _this._strings['e963218370d6410e1ee0f8e6128c12d4'] /* shipdate */,
4498 renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); },
4504 xtype : 'ColumnModel',
4505 builderCfg : '{\"table\":\"shiphead\",\"column\":\"shiphead_sfstatus\",\"columnshort\":\"shiphead_sfstatus\",\"ctype\":\"bpchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}',
4506 dataIndex : 'shiphead_sfstatus',
4507 header : _this._strings['ec53a8c4f07baed5d8825072c89799be'] /* Status */,
4508 renderer : function(v,x,r) {
4513 if (r.json.shiphead_shipdate.length) {
4515 if (r.json.shiphead_shipped) {
4519 return '<span style="color:red">Draft</span>';
4531 xtype : 'ColumnModel',
4532 builderCfg : '{\"table\":\"shiphead\",\"column\":\"shiphead_shipvia\",\"columnshort\":\"shiphead_shipvia\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"\"}',
4533 dataIndex : 'shiphead_shipvia',
4534 header : _this._strings['37656f0f6cf5e5befb1ec7abd3db5804'] /* shipvia */,
4535 renderer : function(v) { return String.format('{0}', v); },
4541 xtype : 'ColumnModel',
4542 builderCfg : '{\"table\":\"shiphead\",\"column\":\"shiphead_tracknum\",\"columnshort\":\"shiphead_tracknum\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}',
4543 dataIndex : 'shiphead_tracknum',
4544 header : _this._strings['58ec392a138714456f83d1288f553099'] /* tracknum */,
4545 renderer : function(v) { return String.format('{0}', v); },
4554 xtype : 'GridPanel',
4556 fitContainer : true,
4559 tableName : 'cobmisc',
4560 title : _this._strings['fce9a6a1bd2a2050eb86d33103f46fd3'] /* Invoices */,
4562 activate : function() {
4563 _this.invpanel = this;
4564 if (_this.invgrid) {
4565 _this.invgrid.ds.load({});
4573 autoExpandColumn : 'invchead_invcnumber',
4574 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\"}',
4579 _this.invgrid = this;
4580 //_this.dialog = Pman.Dialog.FILL_IN
4581 if (_this.invpanel.active) {
4585 rowdblclick : function (_self, rowIndex, e)
4588 var ri = this.ds.getAt(rowIndex);
4589 if ( ri.data.cobmisc_id < 0) { // skip summary row..
4592 var rv = _this.form.getFieldValues();
4593 Pman.Dialog.XtupleInvoice.show({
4594 cobmisc_id : ri.data.cobmisc_id,
4595 // below parms for add credit memo
4597 cm_cust_id : rv.cohead_cust_id,
4598 cm_cust_id_cust_name : rv.cohead_cust_id_cust_name,
4599 cm_curr_id : rv.cohead_curr_id,
4600 cm_curr_id_curr_name : rv.cohead_curr_id_curr_name,
4601 cm_terms_id : rv.cohead_terms_id,
4602 cm_terms_id_terms_descrip : rv.cohead_terms_id_terms_descrip,
4603 cm_salesrep_id : rv.cohead_salesrep_id,
4604 cm_salesrep_id_salesrep_name : rv.cohead_salesrep_id_salesrep_name,
4605 cm_docdate : new Date(),
4606 cm_taxzone_id : rv.cohead_taxzone_id,
4607 cm_taxzone_id_taxzone_descrip : rv.cohead_taxzone_id_taxzone_descrip,
4608 cm_billto_cntct_id : rv.cohead_billto_cntct_id,
4609 cm_billto_cntct_id_cntct_name : rv.cohead_billto_cntct_id_cntct_name,
4610 cm_location_src : rv.cohead_location_src,
4611 cm_location_src_location_name : rv.cohead_location_src_location_name,
4612 cm_billto_address : rv.billto_address
4616 _this.invgrid.ds.load({});
4622 '|xns' : 'Roo.grid',
4630 cls : 'x-btn-text-icon',
4631 icon : rootURL + '/Pman/templates/images/lock.gif',
4632 text : _this._strings['b8feb9ee933bc5cc05615860322e9e7a'] /* Post Invoice */,
4637 var sel = _this.invgrid.getSelectionModel().getSelected();
4639 Roo.MessageBox.alert("Error", "Select a invoice");
4642 // check current status of shipment..
4644 Roo.MessageBox.confirm("Are you sure", "Are you sure you want to Post that invoice?",
4651 url : baseURL + '/Roo/cobmisc',
4654 cobmisc_id : sel.data.cobmisc_id,
4657 success : function() {
4658 _this.invgrid.ds.load({});
4670 '|xns' : 'Roo.Toolbar'
4674 cls : 'x-btn-text-icon',
4675 icon : rootURL + '/Pman/templates/images/pdf.gif',
4676 text : _this._strings['13dba24862cf9128167a59100e154c8d'] /* Print */,
4678 '|xns' : 'Roo.Toolbar',
4682 '|xns' : 'Roo.menu',
4686 text : _this._strings['f97f673be4e5f66aca62b35280d8bcde'] /* Print Standard Invoice */,
4691 var sel = _this.invgrid.getSelectionModel().getSelected();
4693 Roo.MessageBox.alert("Error", "Select a invoice");
4696 if (!sel.data.cobmisc_invchead_id) {
4697 Roo.MessageBox.alert("Error", "Invoice has not been posted");
4700 // check current status of shipment..
4703 url : baseURL + '/Roo/invchead',
4706 invchead_id : sel.data.cobmisc_invchead_id,
4709 success : function() {
4723 hidden : !(baseURL.match(/(hk\.php|cn\.php)$/)),
4724 text : _this._strings['0ee182201463a0ea31cb073b227fbbbe'] /* Print Chinese Invoice With GST in line item */,
4726 click : function (_self, e)
4729 var sel = _this.invgrid.getSelectionModel().getSelected();
4731 Roo.MessageBox.alert("Error", "Select a invoice");
4734 if (!sel.data.cobmisc_invchead_id) {
4735 Roo.MessageBox.alert("Error", "Invoice has not been posted");
4738 // check current status of shipment..
4741 url : baseURL + '/Roo/invchead',
4744 invchead_id : sel.data.cobmisc_invchead_id,
4748 success : function() {
4761 hidden : !(baseURL.match(/(hk\.php|cn\.php)$/)),
4762 text : _this._strings['6ac26fe4e9a39ac45fffe6d6920dac3a'] /* Print Chinese Invoice */,
4764 click : function (_self, e)
4767 var sel = _this.invgrid.getSelectionModel().getSelected();
4769 Roo.MessageBox.alert("Error", "Select a invoice");
4772 if (!sel.data.cobmisc_invchead_id) {
4773 Roo.MessageBox.alert("Error", "Invoice has not been posted");
4776 // check current status of shipment..
4779 url : baseURL + '/Roo/invchead',
4782 invchead_id : sel.data.cobmisc_invchead_id,
4786 success : function() {
4799 hidden : !(baseURL.match(/au\.php$/)),
4800 text : _this._strings['69193f49683ba5a928ae8a27328105ba'] /* Print Aus - GST included Invoice */,
4802 click : function (_self, e)
4805 var sel = _this.invgrid.getSelectionModel().getSelected();
4807 Roo.MessageBox.alert("Error", "Select a invoice");
4810 if (!sel.data.cobmisc_invchead_id) {
4811 Roo.MessageBox.alert("Error", "Invoice has not been posted");
4814 // check current status of shipment..
4817 url : baseURL + '/Roo/invchead',
4820 invchead_id : sel.data.cobmisc_invchead_id,
4824 success : function() {
4837 hidden : !(baseURL.match(/au\.php$/)),
4838 text : _this._strings['3d96cc39e5517a284e203ffc8cafcf51'] /* Print Bambini Pronto Invoice */,
4840 click : function (_self, e)
4842 var sel = _this.invgrid.getSelectionModel().getSelected();
4844 Roo.MessageBox.alert("Error", "Select a invoice");
4847 if (!sel.data.cobmisc_invchead_id) {
4848 Roo.MessageBox.alert("Error", "Invoice has not been posted");
4851 // check current status of shipment..
4854 url : baseURL + '/Roo/invchead',
4857 invchead_id : sel.data.cobmisc_invchead_id,
4872 hidden : !(baseURL.match(/au\.php$/)),
4873 text : _this._strings['c6b4fd215b0cdcb7426519edc0ece828'] /* Print Bambini Pro Forma Invoice */,
4875 click : function (_self, e)
4878 var sel = _this.invgrid.getSelectionModel().getSelected();
4880 Roo.MessageBox.alert("Error", "Select a invoice");
4883 if (!sel.data.cobmisc_invchead_id) {
4884 Roo.MessageBox.alert("Error", "Invoice has not been posted");
4887 // check current status of shipment..
4890 url : baseURL + '/Roo/invchead',
4893 invchead_id : sel.data.cobmisc_invchead_id,
4894 _print : 'au-proforma'
4897 success : function() {
4910 hidden : !( baseURL.match(/au\.php$/)),
4911 text : _this._strings['46fc12727bf2c5cc79988ab857ad73b4'] /* Print Shipping / Commercial Invoice */,
4913 click : function (_self, e)
4915 var sel = _this.invgrid.getSelectionModel().getSelected();
4917 Roo.MessageBox.alert("Error", "Select a invoice");
4921 Pman.Dialog.XtupleDiscountOfInvoice.show({invchead_id : sel.data.cobmisc_invchead_id}, function(){
4934 cls : 'x-btn-text-icon',
4935 icon : Roo.rootURL + 'images/default/tree/leaf.gif',
4936 text : _this._strings['d682c376c82f68bc65dcd05570d04dfc'] /* Payments / Refunds / Credit Memos */,
4938 '|xns' : 'Roo.Toolbar',
4942 '|xns' : 'Roo.menu',
4946 cls : 'x-btn-text-icon',
4947 icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
4948 text : _this._strings['01d35df7886d24900b1ecb65da6bf21d'] /* Receive Payment */,
4950 click : function(_self,e)
4953 var sel = _this.invgrid.getSelectionModel().getSelected();
4954 if (!sel || sel.data.cobmisc_id < 1) {
4955 Roo.MessageBox.alert("Error", "Select a invoice");
4958 if(!sel.data.cobmisc_posted){
4959 Roo.MessageBox.alert("Error", "This invoice has not been posted!");
4962 if(sel.data.cobmisc_outstanding == 0){
4963 Roo.MessageBox.alert("Error", "There is no any outstanding of this invoice!");
4967 var cust_id = _this.form.findField('cohead_cust_id').getValue();
4972 cashrcpt_amount : sel.data.cobmisc_outstanding,
4973 cashrcpt_cust_id : cust_id,
4974 cashrcpt_aropen_id : sel.data.cobmisc_aropen_id_aropen_id,
4975 cashrcpt_distdate : new Date(),
4976 cashrcpt_fundstype : 'C',
4977 cashrcpt_curr_id : sel.data.cobmisc_curr_id_curr_id,
4978 cashrcpt_curr_id_curr_name : sel.data.cobmisc_curr_id_curr_name,
4979 cashrcpt_usecustdeposit : true,
4980 cashrcpt_docdate : new Date(),
4981 cashrcpt_salescat_id : -1,
4982 cashrcpt_applydate : new Date(),
4983 cashrcpt_discount : 0
4985 Pman.Dialog.XtupleReceivePayment.show( data , function() {
4986 _this.invgrid.ds.load({});
4995 cls : 'x-btn-text-icon',
4996 icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
4997 text : _this._strings['526db6366257755024ed2556000871bc'] /* Issue Refund */,
4999 click : function(_self,e)
5001 var sel = _this.invgrid.getSelectionModel().getSelected();
5002 if (!sel || sel.data.cobmisc_cobapply_aropen_id < 1) {
5003 Roo.MessageBox.alert("Error", "Select a credit memo");
5006 if(!sel.data.cobmisc_posted){
5007 Roo.MessageBox.alert("Error", "The invoice that credit memo has been applied to has been not posted");
5010 var cust_id = _this.form.findField('cohead_cust_id').getValue();
5015 if(!sel.data.cobmisc_outstanding || sel.data.cobmisc_outstanding == 0){
5016 Roo.MessageBox.alert("Error", "The amount of this credit memo is 0!");
5020 var d = _this.form.getFieldValues();
5023 'checkhead_recip_id' : cust_id,
5024 'checkhead_recip_type' : 'C',
5025 'checkhead_checkdate' : new Date(),
5026 'checkhead_amount' : sel.data.cobmisc_outstanding,
5027 'remaining_total' : sel.data.cobmisc_outstanding,
5028 'checkhead_curr_id' : d.cohead_curr_id,
5029 'checkhead_curr_id_curr_name' : d.cohead_curr_id_curr_name,
5030 'checkhead_misc' : true,
5031 'aropen_id' : sel.data.cobmisc_cobapply_aropen_id,
5032 'cmhead_number' : sel.data.cobmisc_invchead_id_invchead_invcnumber,
5033 'cust_name' : d.cohead_cust_id_cust_name,
5034 '_create_and_post' : 1
5039 Pman.Dialog.XtupleMiscellaneousCheck.show( data , function() {
5040 _this.invgrid.ds.load({});
5048 xtype : 'Separator',
5054 cls : 'x-btn-text-icon',
5055 icon : rootURL + '/Pman/templates/images/trash.gif',
5056 text : _this._strings['2142511303396bd51e0cc25ea8ffe47f'] /* Void Payment */,
5058 click : function(_self,e)
5060 var sel = _this.invgrid.getSelectionModel().getSelected();
5061 if (!sel || sel.data.cobmisc_cashrcpt_id * 1 < 1) {
5062 Roo.MessageBox.alert("Error", "Select a Receive Payment");
5066 Roo.MessageBox.confirm("Confirm", "Voiding receipt will mean you will have to re-enter the receipt refund - " +
5067 "please take note of the details so you can enter it again correctly later.", function(r) {
5073 url : baseURL + '/Roo/cashrcpt',
5076 cashrcpt_id : sel.data.cobmisc_cashrcpt_id,
5079 success : function()
5081 _this.invgrid.ds.load({});
5096 cls : 'x-btn-text-icon',
5097 icon : rootURL + '/Pman/templates/images/trash.gif',
5098 text : _this._strings['052fbb9431206b4755090dc53fcef300'] /* Void Refund */,
5100 click : function(_self,e)
5102 var sel = _this.invgrid.getSelectionModel().getSelected();
5103 if (!sel || sel.data.cobmisc_checkhead_id * 1 < 1) {
5104 Roo.MessageBox.alert("Error", "Select a Miscellaneours Check");
5108 Roo.MessageBox.confirm("Confirm", "Voiding refund will mean you will have to re-enter the receipt refund - " +
5109 "please take note of the details so you can enter it again correctly later.", function(r) {
5115 url : baseURL + '/Roo/checkhead',
5118 checkhead_id : sel.data.cobmisc_checkhead_id,
5121 success : function()
5123 _this.invgrid.ds.load({});
5138 cls : 'x-btn-text-icon',
5139 icon : rootURL + '/Pman/templates/images/trash.gif',
5140 text : _this._strings['4b5a5a93e13bd338d40cf4bae2ca51cb'] /* Void Credit Memo */,
5142 click : function(_self,e)
5144 var sel = _this.invgrid.getSelectionModel().getSelected();
5145 if (!sel || sel.data.cobmisc_cobapply_aropen_id < 1) {
5146 Roo.MessageBox.alert("Error", "Select a credit memo");
5150 if(sel.data.cobmisc_posted){
5151 Roo.MessageBox.alert("Error", "You cann't void this credit memo, since the invoice that credit memo has been applied to has been posted");
5155 if (sel.data.cobmisc_cobapply_id < 1) {
5156 Roo.MessageBox.alert("Error", "invaild credit memo");
5159 Roo.MessageBox.confirm("Confirm", "Are you sure want to void this applied credit memo, " +
5160 "it will also void all the check that belongs to this credit memo ", function(r) {
5166 url : baseURL + '/Roo/cobapply',
5169 _delete : sel.data.cobmisc_cobapply_id,
5172 success : function()
5174 _this.invgrid.ds.load({});
5192 '|xns' : 'Roo.Toolbar'
5196 cls : 'x-btn-text-icon',
5197 icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
5198 text : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'] /* Add */,
5203 if (!_this.form.findField('cohead_id').getValue()) {
5204 Roo.MessageBox.alert("Error", "Save Order first");
5208 var rv = _this.form.getFieldValues();
5211 Pman.Dialog.XtupleInvoice.show({
5212 cobmisc_cohead_id : rv.cohead_id,
5213 cobmisc_shipdate : _this.form.findField('cohead_targetdate').getValue(),
5214 cobmisc_invcdate : _this.form.findField('cohead_targetdate').getValue(),
5215 cobmisc_curr_id : rv.cohead_curr_id,
5216 cobmisc_curr_id_curr_name : rv.cohead_curr_id_curr_name,
5217 // below parms for add credit memo
5219 cm_cust_id : rv.cohead_cust_id,
5220 cm_cust_id_cust_name : rv.cohead_cust_id_cust_name,
5221 cm_curr_id : rv.cohead_curr_id,
5222 cm_curr_id_curr_name : rv.cohead_curr_id_curr_name,
5223 cm_terms_id : rv.cohead_terms_id,
5224 cm_terms_id_terms_descrip : rv.cohead_terms_id_terms_descrip,
5225 cm_salesrep_id : rv.cohead_salesrep_id,
5226 cm_salesrep_id_salesrep_name : rv.cohead_salesrep_id_salesrep_name,
5227 cm_docdate : new Date(),
5228 cm_taxzone_id : rv.cohead_taxzone_id,
5229 cm_taxzone_id_taxzone_descrip : rv.cohead_taxzone_id_taxzone_descrip,
5230 cm_billto_cntct_id : rv.cohead_billto_cntct_id,
5231 cm_billto_cntct_id_cntct_name : rv.cohead_billto_cntct_id_cntct_name,
5232 cm_location_src : rv.cohead_location_src,
5233 cm_location_src_location_name : rv.cohead_location_src_location_name,
5234 cm_billto_address : rv.billto_address
5239 _this.invgrid.ds.load({});
5243 render : function (_self)
5245 _this.addInvoiceBtn = _self;
5249 '|xns' : 'Roo.Toolbar'
5253 cls : 'x-btn-text-icon',
5254 icon : rootURL + '/Pman/templates/images/trash.gif',
5255 text : _this._strings['b25f6c965342495f74899e183efe20a4'] /* Void / Unpost */,
5260 var sel = _this.invgrid.getSelectionModel().getSelected();
5262 Roo.MessageBox.alert("Error", "Select a invoice");
5265 // check current status of shipment..
5268 // cobmisc_id : sel.data.cobmisc_id,
5271 if (sel.data.cobmisc_id * 1) {
5272 params.cobmisc_id = sel.data.cobmisc_id * 1 ;
5274 if (sel.data.cobmisc_invchead_id_invchead_id * 1) {
5275 params.invchead_id = sel.data.cobmisc_invchead_id_invchead_id * 1;
5278 Roo.MessageBox.confirm("Are you sure", "Are you sure you want to VOID that invoice?",
5285 url : baseURL + '/Roo/cobmisc',
5288 success : function() {
5289 _this.invgrid.ds.load({});
5301 '|xns' : 'Roo.Toolbar'
5308 sortInfo : { field : 'invchead_invcnumber', direction: 'ASC' },
5310 beforeload : function (_self, options)
5313 options.params = options.params || {};
5314 options.params.cobmisc_cohead_id = _this.form.findField('cohead_id').getValue() * 1;
5315 if (options.params.cobmisc_cohead_id < 1) {
5319 options.params._with_other_payment = 1;
5320 //options.params['query[invchead_ordernumber]'] = _this.form.findField('cohead_number').getValue()
5323 load : function (_self, records, options)
5328 var totalfreight = 0.0;
5329 var totalmisc = 0.0;
5332 Roo.each(records, function(r)
5334 if(r.data.cobmisc_id > 1){
5335 done += parseInt(r.data.cobmisc_qty);
5336 totalic += parseFloat(r.data.cobmisc_itemcost).toFixed(2)*1;
5337 totalmisc += parseFloat(r.data.cobmisc_misc).toFixed(2)*1;
5338 totalfreight += parseFloat(r.data.cobmisc_freight).toFixed(2)*1;
5339 totaltax += parseFloat(r.data.cobmisc_tax).toFixed(2)*1;
5340 total = parseInt(r.data.cobmisc_total_qty);
5345 _this.shipinvtab.layout.getRegion('center').getPanel(0).setTitle(
5347 "Invoices (Complete)" :
5348 ("Invoices prepared for " + done + '/' + total)
5352 var frtotal = (parseFloat(_this.form.findField('cohead_freight').getValue()) - totalfreight).toFixed(2);
5353 var misctotal = (parseFloat(_this.form.findField('cohead_misc').getValue()) - totalmisc).toFixed(2);
5354 var ictotal = (parseFloat(_this.form.findField('cohead_subtotal').getValue()) - totalic).toFixed(2);
5355 var taxtotal = (parseFloat(_this.form.findField('cohead_tax').getValue()) - totaltax).toFixed(2);
5356 var remtotal = frtotal*1 + misctotal*1 + ictotal*1 + taxtotal*1;
5358 var nr = this.reader.newRow({
5360 cobmisc_invchead_id_invchead_invcnumber : "Total Remaining",
5361 cobmisc_qty : total - done,
5362 cobmisc_freight :frtotal,
5363 cobmisc_misc : misctotal,
5364 cobmisc_itemcost : ictotal,
5365 cobmisc_tax : taxtotal,
5366 cobmisc_total : remtotal
5370 // do we need to add it somehow??
5371 _this.invgrid.ds.add(nr);
5375 '|xns' : 'Roo.data',
5377 xtype : 'HttpProxy',
5379 url : baseURL + '/Roo/cobmisc.php',
5384 xtype : 'JsonReader',
5385 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\"}',
5388 'name': 'invchead_invcnumber',
5392 'name': 'invchead_invcdate',
5398 totalProperty : 'total',
5405 xtype : 'ColumnModel',
5406 dataIndex : 'cobmisc_invchead_id_invchead_invcnumber',
5407 header : _this._strings['42f6d99a2dddc4858882ed8e9a210b52'] /* Invoice # */,
5408 renderer : function(v,x,r) {
5410 r.data.cobmisc_invchead_id_invchead_id * 1 &&
5411 !r.data.cobmisc_invchead_id_invchead_posted) {
5412 return '<span style="color:red">' +
5413 "NEEDS Voiding then re-posted: " +
5414 String.format('{0}', v) +
5418 if(v && r.data.cobmisc_id == -2){
5419 return String.format('<span style="margin-left: 10px;"> - {0} (Credit Memo)</span>', v);
5421 if(v && r.data.cobmisc_id == -3){
5422 return String.format('<span style="margin-left: 20px;"> - {0} (Miscellaneous Check)</span>', v);
5424 if(v && r.data.cobmisc_id == -4){
5425 return String.format('<span style="margin-left: 10px;"> - {0} (Receive Payment to {2}) [ {1} ]</span>',
5426 v, r.data.cobmisc_cashrcpt_amount, r.json.cashrcpt_bankaccnt_id_bankaccnt_bankname);
5429 return v ? String.format('{0}', v) :
5430 '<span style="color:red">' + "Not Posted" + '</span>';
5437 xtype : 'ColumnModel',
5438 builderCfg : '{\"table\":\"invchead\",\"column\":\"invchead_invcdate\",\"columnshort\":\"invchead_invcdate\",\"ctype\":\"date\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}',
5439 dataIndex : 'cobmisc_invcdate',
5440 header : _this._strings['3a6a3353e3b44ad5359c8e3178b66a54'] /* invcdate */,
5441 renderer : function(v,x,r) {
5443 return String.format('{0}', v && v.format ? v.format('d/M/Y') : '');
5450 xtype : 'ColumnModel',
5452 dataIndex : 'cobmisc_qty',
5453 header : _this._strings['03ab340b3f99e03cff9e84314ead38c0'] /* Qty */,
5454 renderer : function(v) { return String.format('{0}', v ? parseInt(v) : 0); },
5460 xtype : 'ColumnModel',
5462 dataIndex : 'cobmisc_itemcost',
5463 header : _this._strings['757989a16207ab23076685118640adf3'] /* Item Cost */,
5464 renderer : function(v) { return String.format('{0}', v ? (1.0*v).toFixed(2) : 0); },
5470 xtype : 'ColumnModel',
5472 dataIndex : 'cobmisc_freight',
5473 header : _this._strings['ea9cf7e47ff33b2be14e6dd07cbcefc6'] /* Shipping */,
5474 renderer : function(v) { return String.format('{0}', v ? (1.0*v).toFixed(2) : ''); },
5480 xtype : 'ColumnModel',
5482 dataIndex : 'cobmisc_tax',
5483 header : _this._strings['4b78ac8eb158840e9638a3aeb26c4a9d'] /* Tax */,
5484 renderer : function(v,x,r) {
5486 // tax is based on the % itemcost..
5487 // var ic = r.data.cobmisc_itemcost;
5489 var ic =r.data.cobmisc_itemcost - (1* r.data.cobmisc_itemcost_taxfree);
5491 var tax= _this.form.findField('cohead_tax').getValue() * 1.0;
5492 var totic = _this.form.findField('cohead_subtotal').getValue() * 1.0;
5496 var taxp = tax / totic;
5499 return String.format('{0}', (1.0*v).toFixed(2) );
5508 xtype : 'ColumnModel',
5510 dataIndex : 'cobmisc_cohead_id_cohead_pretax_discount',
5511 header : _this._strings['a763436d2b30d54e4aff264b1636827a'] /* Discount (Pretax) */,
5512 renderer : function(v) { return String.format('{0}', v ? (1.0*v).toFixed(2) : 0); },
5518 xtype : 'ColumnModel',
5520 dataIndex : 'cobmisc_misc',
5521 header : _this._strings['bb4af85913879b95661b81570a2c2e83'] /* Discount (Posttax) */,
5522 renderer : function(v,x,r)
5524 var vv = v - r.data.cobmisc_cohead_id_cohead_pretax_discount;
5526 return String.format('{0}', vv ? (1.0*vv).toFixed(2) : 0);
5533 xtype : 'ColumnModel',
5535 dataIndex : 'cobmisc_total',
5536 header : _this._strings['96b0141273eabab320119c467cdcaf17'] /* Total */,
5537 renderer : function(v,x,r) {
5540 var ic = r.data.cobmisc_itemcost;
5541 var tax= _this.form.findField('cohead_tax').getValue() * 1.0;
5542 var totic = _this.form.findField('cohead_subtotal').getValue() * 1.0;
5545 var taxp = tax / totic;
5553 return String.format('{0}',(v * 1.0).toFixed(2) );
5557 return String.format('{0}',
5558 ((d.cobmisc_itemcost * 1.0) +
5559 (d.cobmisc_freight * 1.0) +
5560 (d.cobmisc_tax * 1.0) +
5561 (d.cobmisc_misc * 1.0)
5570 xtype : 'ColumnModel',
5572 dataIndex : 'cobmisc_outstanding',
5573 header : _this._strings['a860ed9926b241b7d4dca2d00610ab2c'] /* Outstanding */,
5574 renderer : function(v,x,r)
5577 return String.format('{0}', v ? (v * 1.0).toFixed(2) : 0 );
5590 xtype : 'GridPanel',
5592 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\"}',
5593 fitContainer : true,
5596 tableName : 'events',
5597 title : _this._strings['16d2b386b2034b9488996466aaae0b57'] /* History */,
5599 activate : function() {
5600 _this.hpanel = this;
5602 _this.hgrid.footer.onClick('first');
5610 autoExpandColumn : 'remarks',
5611 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\"}',
5617 //_this.dialog = Pman.Dialog.FILL_IN
5618 if (_this.hpanel.active) {
5619 this.footer.onClick('first');
5622 rowdblclick : function (_self, rowIndex, e)
5624 if (!_this.dialog) return;
5625 _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {
5626 _this.grid.footer.onClick('first');
5631 '|xns' : 'Roo.grid',
5633 xtype : 'PagingToolbar',
5635 displayMsg : _this._strings['089ba2b5edc96565fc22c584ecfbb1a6'] /* Displaying events{0} - {1} of {2} */,
5636 emptyMsg : _this._strings['594f5bdc5e1519ce9934d276e5bf081f'] /* No events found */,
5643 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\"}',
5645 sortInfo : { field : 'event_when', direction: 'DESC' },
5647 beforeload : function (_self, options)
5649 options.params._related_on_table = 'cohead';
5650 options.params._related_on_id = _this.form.findField('cohead_id').getValue();
5654 '|xns' : 'Roo.data',
5656 xtype : 'HttpProxy',
5658 url : baseURL + '/Roo/events.php',
5663 xtype : 'JsonReader',
5664 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\"}',
5667 'name': 'event_when',
5679 'name': 'person_id_name',
5689 totalProperty : 'total',
5696 xtype : 'ColumnModel',
5697 builderCfg : '{\"table\":\"events\",\"column\":\"event_when\",\"columnshort\":\"event_when\",\"ctype\":\"timestamp\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}',
5698 dataIndex : 'event_when',
5699 header : _this._strings['820dbd2b8f606aff866c0bbfb6b737c1'] /* Changed */,
5700 renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y H:i:s') : ''); },
5706 xtype : 'ColumnModel',
5707 builderCfg : '{\"table\":\"events\",\"column\":\"action\",\"columnshort\":\"action\",\"ctype\":\"varchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}',
5708 dataIndex : 'action',
5709 header : _this._strings['418c5509e2171d55b0aee5c2ea4442b5'] /* action */,
5710 renderer : function(v,x,r) { return String.format('{0} - {1}', v, r.data.on_table); },
5716 xtype : 'ColumnModel',
5717 builderCfg : '{\"table\":\"events\",\"column\":\"ipaddr\",\"columnshort\":\"ipaddr\",\"ctype\":\"varchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}',
5718 dataIndex : 'ipaddr',
5719 header : _this._strings['75ba8d70e3692ba200f0e0df37b4d2ae'] /* IP address */,
5720 renderer : function(v) { return String.format('{0}', v); },
5726 xtype : 'ColumnModel',
5727 builderCfg : '{\"table\":\"person\",\"column\":\"person_id_name\",\"columnshort\":\"name\",\"ctype\":\"varchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}',
5728 dataIndex : 'person_id_name',
5729 header : _this._strings['4ee972120bcda675f75222c87cb9d356'] /* Who */,
5730 renderer : function(v) { return String.format('{0}', v); },
5736 xtype : 'ColumnModel',
5737 builderCfg : '{\"table\":\"events\",\"column\":\"remarks\",\"columnshort\":\"remarks\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"\"}',
5738 dataIndex : 'remarks',
5739 header : _this._strings['f4c6f851b00d5518bf888815de279aba'] /* Notes */,
5740 renderer : function(v) { return String.format('{0}', v); },
5749 xtype : 'NestedLayoutPanel',
5751 title : _this._strings['47cb03899dc494703b52c37240fa4c17'] /* Stock Tx */,
5755 xtype : 'BorderLayout',
5759 xtype : 'LayoutRegion',
5764 xtype : 'LayoutRegion',
5772 xtype : 'GridPanel',
5774 fitContainer : true,
5777 tableName : 'invdetail',
5778 title : _this._strings['f817f797c422f7ac3404b6223db1a1ee'] /* invdetail */,
5780 activate : function() {
5781 _this.txpanel = this;
5783 _this.txgrid.footer.onClick('first');
5791 autoExpandColumn : 'item_number',
5796 _this.txgrid = this;
5797 //_this.dialog = Pman.Dialog.FILL_IN
5798 if (_this.txpanel.active) {
5799 this.footer.onClick('first');
5804 '|xns' : 'Roo.grid',
5806 xtype : 'PagingToolbar',
5808 displayMsg : _this._strings['87813307f6e7498b30c5b3d9b2f65f56'] /* Displaying invdetail{0} - {1} of {2} */,
5809 emptyMsg : _this._strings['a0d036a1d6a00180df168fa86143e5f8'] /* No invdetail found */,
5821 text : _this._strings['b80f4ed22929b09103f0c5666ad7a7e1'] /* Run Apply Fifo on order */,
5823 click : function (_self, e)
5827 url : baseURL + '/Roo/Cohead',
5830 _apply_fifo : _this.form.findField('cohead_id').getValue()
5832 success : function () {
5833 Roo.MessageBox.alert("Applied", "Succesfully Applied");
5839 '|xns' : 'Roo.Toolbar'
5843 text : _this._strings['d179a904ac10a39ab574fe803cc29fa3'] /* Run Void flagger */,
5845 click : function (_self, e)
5849 url : baseURL + '/Roo/Cohead',
5852 _run_void_fix : _this.form.findField('cohead_id').getValue()
5854 success : function () {
5855 Roo.MessageBox.alert("Applied", "Succesfully Run");
5861 '|xns' : 'Roo.Toolbar'
5865 text : _this._strings['26453198f2ddac444702879a8f6d61a5'] /* Auto Reverse */,
5867 click : function (_self, e)
5872 url : baseURL + '/Roo/Invdetail',
5877 _reverse_all_bad : _this.form.findField('cohead_id').getValue()
5879 success : function () {
5880 Roo.MessageBox.alert("Applied", "Succesfully Run");
5886 '|xns' : 'Roo.Toolbar'
5893 sortInfo : { field : 'item_number', direction: 'ASC' },
5895 beforeload : function (_self, o)
5897 o.params.cohead_id = _this.form.findField('cohead_id').getValue();
5898 if (! o.params.cohead_id ) {
5905 '|xns' : 'Roo.data',
5907 xtype : 'HttpProxy',
5909 url : baseURL + '/Roo/invdetail.php',
5914 xtype : 'JsonReader',
5917 'name': 'invdetail_id',
5921 'name': 'invdetail_transtype',
5925 'name': 'invdetail_invhist_id',
5929 'name': 'invdetail_location_id',
5933 'name': 'invdetail_qty',
5937 'name': 'invdetail_comments',
5941 'name': 'invdetail_qty_before',
5945 'name': 'invdetail_qty_after',
5949 'name': 'invdetail_invcitem_id',
5953 'name': 'invdetail_expiration',
5955 'dateFormat': 'Y-m-d'
5958 'name': 'invdetail_warrpurc',
5960 'dateFormat': 'Y-m-d'
5963 'name': 'invdetail_ls_id',
5969 totalProperty : 'total',
5975 xtype : 'RowSelectionModel',
5976 singleSelect : true,
5978 selectionchange : function (_self)
5980 _this.txdgrid.footer.onClick('first');;
5988 xtype : 'ColumnModel',
5989 dataIndex : 'item_number',
5990 header : _this._strings['7d74f3b92b19da5e606d737d339a9679'] /* Item */,
5991 renderer : function(v) { return String.format('{0}', v); },
5997 xtype : 'ColumnModel',
5999 dataIndex : 'rec_shipped',
6000 header : _this._strings['53896265ad28c11cb4997b3c3e3e122d'] /* #Ship */,
6001 renderer : function(v) { return String.format('{0}', Roo.util.Format.number(v,0)); },
6007 xtype : 'ColumnModel',
6009 dataIndex : 'rec_returned',
6010 header : _this._strings['d323a19bad62ff427d0b75dc52674c81'] /* #Ret */,
6011 renderer : function(v) { return String.format('{0}', Roo.util.Format.number(v,0)); },
6017 xtype : 'ColumnModel',
6019 dataIndex : 'tx_shipped',
6020 header : _this._strings['51e07f52ae2192d23a1b43922e5beb90'] /* #TX ship */,
6021 renderer : function(v) { return String.format('{0}', Roo.util.Format.number(v,0)); },
6027 xtype : 'ColumnModel',
6029 dataIndex : 'tx_returned',
6030 header : _this._strings['5e33fc1550a56738da96fbaaf57e72f0'] /* #TX ret */,
6031 renderer : function(v) { return String.format('{0}', Roo.util.Format.number(v,0)); },
6037 xtype : 'ColumnModel',
6039 dataIndex : 'tx_total',
6040 header : _this._strings['1abe972d603f3bd61eefc9ac39fb7522'] /* #TX Tot */,
6041 renderer : function(v) { return String.format('{0}', Roo.util.Format.number(v,0)); },
6047 xtype : 'ColumnModel',
6049 dataIndex : 'total_value',
6050 header : _this._strings['689202409e48743b914713f96d93947c'] /* Value */,
6051 renderer : function(v,x,r) {
6053 return (v*1).toFixed(3);
6060 xtype : 'ColumnModel',
6062 dataIndex : 'tx_total',
6063 header : _this._strings['56d56144d4e4a42ce450446518c4fc00'] /* #Diff */,
6064 renderer : function(v,x,r) {
6066 var cototal = (r.data.rec_returned*1) - (r.data.rec_shipped*1);
6067 // Roo.log(cototal);
6068 var diff = (v*1) - cototal;
6073 return String.format('<span style="color:red">{0}</span>', diff );
6083 xtype : 'GridPanel',
6085 fitContainer : true,
6088 tableName : 'invdetail',
6089 title : _this._strings['f817f797c422f7ac3404b6223db1a1ee'] /* invdetail */,
6091 activate : function() {
6092 _this.txdpanel = this;
6093 if (_this.txdgrid) {
6094 _this.txdgrid.footer.onClick('first');
6102 autoExpandColumn : 'invhist_comments',
6107 _this.txdgrid = this;
6108 //_this.dialog = Pman.Dialog.FILL_IN
6109 if (_this.txdpanel.active) {
6110 this.footer.onClick('first');
6113 rowclick : function (_self, rowIndex, e)
6115 var s = _this.txdgrid.ds.getAt(rowIndex);
6116 var dt = s.data.invhist_transdate.split(' ');
6118 _this.dateSel.setValue(new Date(dt[0]));
6122 '|xns' : 'Roo.grid',
6124 xtype : 'PagingToolbar',
6126 displayMsg : _this._strings['87813307f6e7498b30c5b3d9b2f65f56'] /* Displaying invdetail{0} - {1} of {2} */,
6127 emptyMsg : _this._strings['a0d036a1d6a00180df168fa86143e5f8'] /* No invdetail found */,
6139 text : _this._strings['fa1cfdb383ea976facbdb20d40d2f811'] /* Duplicate Selected */,
6141 click : function (_self, e)
6143 var s = _this.txdgrid.selModel.getSelected();
6146 Roo.MessageBox.alert("Error", "Select a transaction");
6150 var reverseSel = function() {
6154 url : baseURL + '/Roo/invdetail',
6157 _duplicate : s.data.invdetail_id
6159 success : function() {
6160 _this.txdgrid.footer.onClick('first');
6168 Roo.MessageBox.confirm(
6170 "This should only be used by System Administrators - are you sure you know what you are doing!",
6185 '|xns' : 'Roo.Toolbar'
6190 '|xns' : 'Roo.Toolbar'
6194 text : _this._strings['72bb7a9ea8714c52b0c0b8369d6a8dc3'] /* Issue Date */,
6196 '|xns' : 'Roo.Toolbar'
6199 xtype : 'DateField',
6201 fieldLabel : _this._strings['72bb7a9ea8714c52b0c0b8369d6a8dc3'] /* Issue Date */,
6203 name : 'issue_date',
6206 render : function (_self)
6208 _this.dateSel = _self;
6216 text : _this._strings['8156649b9de8783c15c822b592c3bac6'] /* Reverse Selected */,
6218 click : function (_self, e)
6220 var s = _this.txdgrid.selModel.getSelected();
6221 var dt = _this.dateSel.getValue();
6223 Roo.MessageBox.alert("Error", "Select a transaction");
6227 var reverseSel = function(force) {
6231 url : baseURL + '/Roo/invdetail',
6234 _reverse : s.data.invdetail_id,
6235 _as_of : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),
6238 success : function() {
6239 _this.txdgrid.footer.onClick('first');
6241 failure : function(res) {
6244 if (res.errors.confirm) {
6246 Roo.MessageBox.confirm(
6248 "are you really sure the totals will get messed up.",
6259 Roo.MessageBox.alert("Error", res.errorMsg);
6269 Roo.MessageBox.confirm(
6271 "This should only be used by System Administrators - are you sure you know what you are doing!",
6286 '|xns' : 'Roo.Toolbar'
6293 sortInfo : { field : 'invdetail_id', direction: 'ASC' },
6295 beforeload : function (_self, o)
6297 o.params.cohead_id = _this.form.findField('cohead_id').getValue();
6298 var s = _this.txgrid.selModel.getSelected();
6303 o.params.itemsite_id = s.data.invhist_itemsite_id;
6308 '|xns' : 'Roo.data',
6310 xtype : 'HttpProxy',
6312 url : baseURL + '/Roo/invdetail.php',
6317 xtype : 'JsonReader',
6320 'name': 'invdetail_id',
6324 'name': 'invdetail_transtype',
6328 'name': 'invdetail_invhist_id',
6332 'name': 'invdetail_location_id',
6336 'name': 'invdetail_qty',
6340 'name': 'invdetail_comments',
6344 'name': 'invdetail_qty_before',
6348 'name': 'invdetail_qty_after',
6352 'name': 'invdetail_invcitem_id',
6356 'name': 'invdetail_expiration',
6358 'dateFormat': 'Y-m-d'
6361 'name': 'invdetail_warrpurc',
6363 'dateFormat': 'Y-m-d'
6366 'name': 'invdetail_ls_id',
6372 totalProperty : 'total',
6379 xtype : 'ColumnModel',
6380 dataIndex : 'invdetail_id',
6381 header : _this._strings['fd216b286b94577ac68c112c0dcaf341'] /* TX# */,
6382 renderer : function(v) { return String.format('{0}', v); },
6388 xtype : 'ColumnModel',
6389 dataIndex : 'invhist_transdate',
6390 header : _this._strings['44749712dbec183e983dcd78a7736c41'] /* Date */,
6391 renderer : function(v) { return String.format('{0}', v); },
6397 xtype : 'ColumnModel',
6398 dataIndex : 'invhist_ordnumber',
6399 header : _this._strings['9c9745a343efeacc9efe9b7222b27afb'] /* Ref# */,
6400 renderer : function(v,x,r) {
6401 if (r.data.invfifo_void *1 != 0) {
6402 return String.format('<s>{0}</s>', v);
6405 return String.format('{0}', v);
6412 xtype : 'ColumnModel',
6413 dataIndex : 'location_name',
6414 header : _this._strings['fd216b286b94577ac68c112c0dcaf341'] /* TX# */,
6415 renderer : function(v) { return String.format('{0}', v); },
6421 xtype : 'ColumnModel',
6422 dataIndex : 'invhist_comments',
6423 header : _this._strings['f4c6f851b00d5518bf888815de279aba'] /* Notes */,
6424 renderer : function(v) { return String.format('{0}', v); },
6430 xtype : 'ColumnModel',
6432 dataIndex : 'invdetail_qty',
6433 header : _this._strings['c4a0f4ddf926328daa2a350db9f9ca00'] /* Qty Changed */,
6434 renderer : function(v,x,r) {
6435 if ( r.data.coitem_shipped != v) {
6436 return String.format('{0} <span style="color:red">({1})</span>',
6437 Roo.util.Format.number(v,0),
6438 r.data.coitem_shipped
6442 return String.format('{0}', Roo.util.Format.number(v,0));
6449 xtype : 'ColumnModel',
6451 dataIndex : 'invhist_value_before',
6452 header : _this._strings['c4a0f4ddf926328daa2a350db9f9ca00'] /* Qty Changed */,
6453 renderer : function(v,x,r) {
6454 var tot = r.data.invhist_value_after*1 - v*1;
6456 if (r.data.invdetail_qty >0 && tot < 0) {
6457 f = '<span style="color:red">{0}</span>';
6459 if (r.data.invdetail_qty < 0 && tot > 0) {
6460 f = '<span style="color:red">{0}</span>';
6462 return String.format(f, Roo.util.Format.number(tot));
6469 xtype : 'ColumnModel',
6470 dataIndex : 'invhist_posted',
6471 header : _this._strings['16cd452dda9d4398bf6240603eee40a9'] /* Posted */,
6472 renderer : function(v,x,r) {
6474 var state = v ? '-checked' : '';
6476 return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
6489 xtype : 'NestedLayoutPanel',
6491 title : _this._strings['99575a08540e6ee585a7b389e8bde351'] /* GL Tx */,
6495 xtype : 'BorderLayout',
6499 xtype : 'LayoutRegion',
6504 xtype : 'LayoutRegion',
6512 xtype : 'GridPanel',
6514 fitContainer : true,
6517 tableName : 'invdetail',
6518 title : _this._strings['f817f797c422f7ac3404b6223db1a1ee'] /* invdetail */,
6520 activate : function() {
6521 _this.gltxpanel = this;
6522 if (_this.gltxgrid) {
6523 _this.gltxgrid.footer.onClick('first');
6531 autoExpandColumn : 'gltrans_accnt_id_accnt_descrip',
6534 cellclick : function (_self, rowIndex, columnIndex, e)
6536 if (columnIndex > 0) {
6539 var rec = this.ds.getAt(rowIndex);
6540 rec.set('gltrans_as_summary', rec.data.gltrans_as_summary *1 ? 0 : 1);
6541 _this.gltxdgrid.footer.onClick('first');
6545 _this.gltxgrid = this;
6546 //_this.dialog = Pman.Dialog.FILL_IN
6547 if (_this.gltxpanel.active) {
6548 this.footer.onClick('first');
6553 '|xns' : 'Roo.grid',
6555 xtype : 'PagingToolbar',
6557 displayMsg : _this._strings['87813307f6e7498b30c5b3d9b2f65f56'] /* Displaying invdetail{0} - {1} of {2} */,
6558 emptyMsg : _this._strings['a0d036a1d6a00180df168fa86143e5f8'] /* No invdetail found */,
6565 enableToggle : true,
6567 text : _this._strings['8fb8fbc1c0bc53b2d01121344410e444'] /* Split sales */,
6569 click : function (_self, e)
6571 (function() { _this.gltxgrid.footer.onClick('first'); }).defer(100);
6573 render : function (_self)
6575 _this.glsalesbtn = _self;
6579 '|xns' : 'Roo.Toolbar'
6586 sortInfo : { field : 'item_number', direction: 'ASC' },
6588 beforeload : function (_self, o)
6590 o.params.cohead_id = _this.form.findField('cohead_id').getValue();
6591 if (! o.params.cohead_id ) {
6595 o.params._split_sales = _this.glsalesbtn.pressed ? 1 : 0;
6599 '|xns' : 'Roo.data',
6601 xtype : 'HttpProxy',
6603 url : baseURL + '/Roo/gltrans.php',
6608 xtype : 'JsonReader',
6611 'name': 'invdetail_id',
6615 'name': 'invdetail_transtype',
6619 'name': 'invdetail_invhist_id',
6623 'name': 'invdetail_location_id',
6627 'name': 'invdetail_qty',
6631 'name': 'invdetail_comments',
6635 'name': 'invdetail_qty_before',
6639 'name': 'invdetail_qty_after',
6643 'name': 'invdetail_invcitem_id',
6647 'name': 'invdetail_expiration',
6649 'dateFormat': 'Y-m-d'
6652 'name': 'invdetail_warrpurc',
6654 'dateFormat': 'Y-m-d'
6657 'name': 'invdetail_ls_id',
6663 totalProperty : 'total',
6669 xtype : 'RowSelectionModel',
6670 singleSelect : true,
6672 selectionchange : function (_self)
6674 _this.gltxdgrid.footer.onClick('first');;
6682 xtype : 'ColumnModel',
6683 dataIndex : 'gltrans_as_summary',
6684 header : _this._strings['290612199861c31d1036b185b4e69b75'] /* Summary */,
6685 renderer : function(v,x,r) {
6687 var state = v*1 ? '-checked' : '';
6689 return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
6696 xtype : 'ColumnModel',
6697 dataIndex : 'gltrans_accnt_id_accnt_descrip',
6698 header : _this._strings['08bd40c7543007ad06e4fce31618f6ec'] /* Account */,
6699 renderer : function(v) { return String.format('{0}', v); },
6705 xtype : 'ColumnModel',
6707 dataIndex : 'gltrans_amount_credit',
6708 header : _this._strings['0a90b1bc4078f74b6f0d117ec7df65af'] /* Credit */,
6709 renderer : function(v) { return String.format('{0}', Roo.util.Format.number(v,3)); },
6715 xtype : 'ColumnModel',
6717 dataIndex : 'gltrans_amount_debit',
6718 header : _this._strings['009534719f8c8221440a5629f497a784'] /* Debit */,
6719 renderer : function(v) { return String.format('{0}', Roo.util.Format.number(v,3)); },
6725 xtype : 'ColumnModel',
6727 dataIndex : 'gltrans_amount_total',
6728 header : _this._strings['a0ec87054b5e5b7847d0d8780a01a3d5'] /* Sum */,
6729 renderer : function(v) { return String.format('<b>{0}</b>', Roo.util.Format.number(v,3)); },
6735 xtype : 'ColumnModel',
6737 dataIndex : 'gltrans_amount_total_unposted',
6738 header : _this._strings['58733ee735e3160c5c9fa5739fb4d056'] /* Unposted */,
6739 renderer : function(v) { return String.format('<span style="color:red">{0}</span>', Roo.util.Format.number(v,3)); },
6748 xtype : 'GridPanel',
6750 fitContainer : true,
6753 tableName : 'invdetail',
6754 title : _this._strings['f817f797c422f7ac3404b6223db1a1ee'] /* invdetail */,
6756 activate : function() {
6757 _this.gltxdpanel = this;
6758 if (_this.gltxdgrid) {
6759 _this.gltxdgrid.footer.onClick('first');
6767 autoExpandColumn : 'gltrans_notes',
6770 cellclick : function (_self, ri, ci, e)
6773 var deleteSel = function() {
6777 url : baseURL + '/Roo/gltrans',
6781 gltrans_id : rec.data.gltrans_id
6784 success : function() {
6785 rec.set('gltrans_posted', false);
6786 rec.set('gltrans_deleted', true);
6787 rec.set('gltrans_docnumber', rec.data.gltrans_docnumber);
6788 _this.gltxgrid.footer.onClick('first');
6793 var undeleteSel = function() {
6797 url : baseURL + '/Roo/gltrans',
6801 gltrans_id : rec.data.gltrans_id
6804 success : function() {
6805 rec.set('gltrans_posted', true);
6806 rec.set('gltrans_deleted', false);
6807 rec.set('gltrans_docnumber', rec.data.gltrans_docnumber);
6808 _this.gltxgrid.footer.onClick('first');
6814 var di = this.colModel.config[ci].dataIndex;
6815 if (di != 'gltrans_posted') {
6821 var rec = this.ds.getAt(ri);
6822 if (rec.data.gltrans_deleted) {
6824 Roo.MessageBox.confirm(
6826 "This should only be used by System Administrators - are you sure you know what you are doing!",
6840 if (!rec.data.gltrans_posted) {
6846 url : baseURL + '/Roo/gltrans',
6850 gltrans_id : rec.data.gltrans_id
6852 success : function (res)
6854 rec.set('gltrans_posted', true);
6855 _this.gltxgrid.footer.onClick('first');
6864 // we have a posted transaction.
6865 // only allow recalled to be deleted..
6866 if (!rec.data.gltrans_notes.match(/(Recall|Ship Order)/)) {
6875 Roo.MessageBox.confirm(
6877 "This should only be used by System Administrators - are you sure you know what you are doing!",
6891 _this.gltxdgrid = this;
6892 //_this.dialog = Pman.Dialog.FILL_IN
6893 if (_this.gltxdpanel.active) {
6894 this.footer.onClick('first');
6899 '|xns' : 'Roo.grid',
6901 xtype : 'PagingToolbar',
6903 displayMsg : _this._strings['87813307f6e7498b30c5b3d9b2f65f56'] /* Displaying invdetail{0} - {1} of {2} */,
6904 emptyMsg : _this._strings['a0d036a1d6a00180df168fa86143e5f8'] /* No invdetail found */,
6911 text : _this._strings['801ab24683a4a8c433c6eb40c48bcd9d'] /* Download */,
6913 click : function (_self, e)
6915 new Pman.Download( {
6916 grid : _this.gltxdgrid
6922 '|xns' : 'Roo.Toolbar'
6929 sortInfo : { field : 'gltrans_docnumber', direction: 'ASC' },
6931 beforeload : function (_self, o)
6933 o.params.cohead_id = _this.form.findField('cohead_id').getValue();
6934 var s = _this.gltxgrid.selModel.getSelected();
6939 o.params.gltrans_accnt_id = s.data.gltrans_accnt_id;
6940 o.params.gltrans_is_ship = s.data.gltrans_is_ship;
6941 o.params.gltrans_as_summary = s.data.gltrans_as_summary;
6947 '|xns' : 'Roo.data',
6949 xtype : 'HttpProxy',
6951 url : baseURL + '/Roo/gltrans.php',
6956 xtype : 'JsonReader',
6959 'name': 'invdetail_id',
6963 'name': 'invdetail_transtype',
6967 'name': 'invdetail_invhist_id',
6971 'name': 'invdetail_location_id',
6975 'name': 'invdetail_qty',
6979 'name': 'invdetail_comments',
6983 'name': 'invdetail_qty_before',
6987 'name': 'invdetail_qty_after',
6991 'name': 'invdetail_invcitem_id',
6995 'name': 'invdetail_expiration',
6997 'dateFormat': 'Y-m-d'
7000 'name': 'invdetail_warrpurc',
7002 'dateFormat': 'Y-m-d'
7005 'name': 'invdetail_ls_id',
7011 totalProperty : 'total',
7018 xtype : 'ColumnModel',
7019 dataIndex : 'gltrans_id',
7020 header : _this._strings['9c9745a343efeacc9efe9b7222b27afb'] /* Ref# */,
7021 renderer : function(v) { return String.format('{0}', v ); },
7028 xtype : 'ColumnModel',
7029 dataIndex : 'gltrans_date',
7030 header : _this._strings['44749712dbec183e983dcd78a7736c41'] /* Date */,
7031 renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); },
7037 xtype : 'ColumnModel',
7038 dataIndex : 'gltrans_docnumber',
7039 header : _this._strings['cb02c723b8a159fea3cd7913d3df7fbc'] /* Doc# */,
7040 renderer : function(v,x,r) {
7041 if (r.data.gltrans_deleted) {
7042 return String.format('<s>{0}</s>', v);
7044 return String.format('{0}', v);
7051 xtype : 'ColumnModel',
7052 dataIndex : 'gltrans_source',
7053 header : _this._strings['f31bbdd1b3e85bccd652680e16935819'] /* Source */,
7054 renderer : function(v) { return String.format('{0}', v); },
7060 xtype : 'ColumnModel',
7061 dataIndex : 'gltrans_notes',
7062 header : _this._strings['f4c6f851b00d5518bf888815de279aba'] /* Notes */,
7063 renderer : function(v) { return String.format('{0}', v); },
7069 xtype : 'ColumnModel',
7071 dataIndex : 'gltrans_amount',
7072 header : _this._strings['b2f40690858b404ed10e62bdf422c704'] /* Amount */,
7073 renderer : function(v) { return String.format('{0}', Roo.util.Format.number(v,3)); },
7079 xtype : 'ColumnModel',
7080 dataIndex : 'gltrans_posted',
7081 header : _this._strings['16cd452dda9d4398bf6240603eee40a9'] /* Posted */,
7082 renderer : function(v,x,r) {
7084 var state = v ? '-checked' : '';
7086 return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
7099 xtype : 'GridPanel',
7101 fitContainer : true,
7104 tableName : 'coitem',
7105 title : _this._strings['182875b6c36a761f1e459624c1d93638'] /* Profit */,
7107 activate : function() {
7108 _this.profitpanel = this;
7110 try { if (MODULE.isBuilder) {
7114 var id = _this.form.findField('cohead_id').getValue() * 1;
7116 Roo.MessageBox.alert("Save First", "Save the order first, before adding items");
7117 _this.dialog.layout.getRegion('center').showPanel(0);
7121 if (_this.profitgrid) {
7122 _this.profitgrid.footer.onClick('first');
7131 autoExpandColumn : 'item_number',
7136 _this.profitgrid = this;
7137 //_this.dialog = Pman.Dialog.FILL_IN
7138 if (_this.profitpanel.active) {
7139 this.footer.onClick('first');
7144 '|xns' : 'Roo.grid',
7146 xtype : 'PagingToolbar',
7148 displayMsg : _this._strings['d0cc96be641673ad48fc74374fda8137'] /* Displaying coitem{0} - {1} of {2} */,
7149 emptyMsg : _this._strings['c04b33241cc5478500daf178e3720b63'] /* No coitem found */,
7157 sortInfo : { field : 'coitem_linenumber,coitem_subnumber', direction: 'ASC' },
7159 beforeload : function (_self,o) {
7166 if (!_this.data || !_this.data.cohead_id) {
7169 o.params = o.params || {};
7171 o.params.coitem_cohead_id = _this.data.cohead_id;
7172 o.params._without_list_discount =1;
7173 o.params._with_profit = 1;
7178 '|xns' : 'Roo.data',
7180 xtype : 'HttpProxy',
7182 url : baseURL + '/Roo/coitem.php',
7187 xtype : 'JsonReader',
7206 'name': 'leader_id',
7210 'name': 'leader_office_id',
7214 'name': 'leader_name',
7218 'name': 'leader_phone',
7222 'name': 'leader_fax',
7226 'name': 'leader_email',
7230 'name': 'leader_company_id',
7234 'name': 'leader_role',
7238 'name': 'leader_active',
7242 'name': 'leader_remarks',
7246 'name': 'leader_passwd',
7250 'name': 'leader_owner_id',
7254 'name': 'leader_lang',
7258 'name': 'leader_no_reset_sent',
7262 'name': 'leader_action_type',
7266 'name': 'leader_project_id',
7270 'name': 'leader_deleted_by',
7274 'name': 'leader_deleted_dt',
7278 'name': 'leader_firstname',
7282 'name': 'leader_lastname',
7286 'name': 'leader_name_facebook',
7290 'name': 'leader_url_blog',
7294 'name': 'leader_url_twitter',
7298 'name': 'leader_url_linkedin',
7302 'name': 'leader_crm_lead_percentage',
7306 'name': 'leader_crm_industry_id',
7310 'name': 'leader_crm_updated_action_id',
7314 'name': 'leader_crm_created_action_id',
7318 'name': 'leader_crm_type_id',
7324 totalProperty : 'total',
7331 xtype : 'ColumnModel',
7332 dataIndex : 'item_number',
7333 header : _this._strings['7608203603437f0513ba8203a2d39a4f'] /* Item Code */,
7334 renderer : function(v) { return String.format('{0}', v); },
7340 xtype : 'ColumnModel',
7341 dataIndex : 'calc_subtotal',
7342 header : _this._strings['c5eae6ea505388a73962c635ac821fba'] /* SubTotal */,
7343 renderer : function(v) {
7346 return Roo.util.Format.number( v, 2);
7353 xtype : 'ColumnModel',
7354 dataIndex : 'calc_cost_total',
7355 header : _this._strings['81dffdb31b9576e343d3f7ffcf721d7e'] /* Cost of goods */,
7356 renderer : function(v) {
7358 return Roo.util.Format.number( v, 2);
7365 xtype : 'ColumnModel',
7366 dataIndex : 'profit',
7367 header : _this._strings['182875b6c36a761f1e459624c1d93638'] /* Profit */,
7368 renderer : function(v,x,r) {
7370 var profit = r.data.calc_subtotal - r.data.calc_cost_total;
7372 if(parseInt(profit) < 1){
7373 return String.format('<b style="color:red;">{0}</b>', Roo.util.Format.number(profit,2));
7377 return Roo.util.Format.number( profit, 2);