// Auto generated file - created by app.Builder.js- do not edit directly (at present!)
+Roo.namespace('Pman.Tab');
+
Pman.Tab.XtupleItem = new Roo.XComponent({
- part : ["Xtuple","Item"],
- order : '200-Pman.Tab.XtupleItem',
- region : 'center',
- parent : 'Pman.Tab.XtupleManage',
- name : "Pman.Tab.XtupleItem",
- disabled : false,
- permname : '',
- _tree : function()
- {
- var _this = this;
- var MODULE = this;
- return {
- xtype: 'NestedLayoutPanel',
- xns: Roo,
- background : true,
- region : 'center',
- title : "Products",
- layout : {
- xtype: 'BorderLayout',
- xns: Roo,
- items : [
- {
- xtype: 'GridPanel',
- xns: Roo,
- listeners : {
- activate : function() {
- _this.panel = this;
- if (_this.grid) {
- _this.grid.footer.onClick('first');
- }
- }
- },
- background : true,
- fitContainer : true,
- fitToframe : true,
- region : 'center',
- tableName : 'item',
- title : "Products",
- grid : {
- xtype: 'EditorGrid',
- xns: Roo.grid,
- listeners : {
- render : function()
- {
- _this.grid = this;
- //_this.dialog = Pman.Dialog.FILL_IN
- if (_this.panel.active) {
- this.footer.onClick('first');
- }
- },
- cellclick : function (_self, row, col, e)
- {
- var di = _this.grid.colModel.getDataIndex(col);
-
- var rec = _this.grid.ds.getAt(row);
-
- if(di == 'item_image_filename'){
- if(!rec.data.item_image_id){
- return;
- }
- var u = baseURL;
- if(rec.data.item_image_from_hk){
- u = u.split('/');
- u.pop();
- u = u.join('/') + '/hk.php';
- }
- Pman.download( {
- url: u + '/Images/Download/' + rec.data.item_image_id + '/' + rec.data.item_image_filename
- });
- return;
- }
-
- if (di == 'item_active') {
-
- var nv = rec.data.item_active ? 0 : 1;
- new Pman.Request({
- mask : 'Saving',
- url : baseURL + '/Roo/Item',
- params : {
- item_id : rec.data.item_id,
- item_active : nv
- },
- success : function() {
- rec.set('item_active', nv);
- }
- });
- return;
-
-
- }
-
- if(di == 'itemsrc_active'){
- if(!rec.data.itemsrc_active){
- Roo.MessageBox.alert('Error','Please edit it on Xtuple tool');
- return;
- }
- if(rec.data.itemsrc_active){
- Roo.MessageBox.confirm("Confirm", "Are you sure this product is no longer purchased",
- function (res) {
- if(res!='yes') {
- return;
- }
- rec.commit();
- });
- }
- }
-
- _this.locgrid.footer.onClick('first');
-
-
-
-
- },
- afteredit : function (e)
- {
-
-
- Roo.log(e);
- new Pman.Request({
- url : baseURL +'/Roo/Charass',
- params : {
- charass_char_id_char_name : e.field.replace(/^item_char_/,'').toUpperCase(),
- charass_value : e.value,
- charass_target_type : 'I',
- charass_default : 1,
- charass_target_id : e.record.data.item_id
- },
- method : 'POST'
- });
-
-
- e.record.commit();
-
-
-
- },
- celldblclick : function (_self, rowIndex, columnIndex, e)
- {
- var s = _this.grid.ds.getAt(rowIndex);
-
- Pman.Dialog.XtupleItem.show( { item_id : s.data.item_id } , function() {
- _this.grid.footer.onClick('first');
- });
- }
- },
- autoExpandColumn : 'item_descrip1',
- clicksToEdit : 1,
- loadMask : true,
- dataSource : {
- xtype: 'Store',
- xns: Roo.data,
- listeners : {
- beforeload : function (_self, o)
- {
- o.params._with_prodcat = 1;
- o.params._with_char = 1;
- o.params._with_itemsrc_active = 1;
- o.params._with_last_purchase_price = 1;
- o.params._with_image = 1;
- var s = _this.search.getValue();
- if (s.length) {
- o.params['query[number_or_name]'] = s;
- }
- if (!_this.active.pressed) {
- o.params.item_active = 1;
- }
- if (_this.brandSel.getValue().length) {
- o.params._with_brand = _this.brandSel.getValue()
- }
-
- o.params._with_stock_balance = 1;
- },
- update : function (_self, record, operation)
- {
- if(operation != 'commit'){
- return;
- }
-
- var nv = record.data.itemsrc_active ? 0 : 1;
- new Pman.Request({
- mask : 'Saving',
- url : baseURL + '/Roo/Itemsrc',
- params : {
- _update_by_item : 1,
- item_id : record.data.item_id,
- itemsrc_active : nv
- },
- success : function(res) {
- record.set('itemsrc_active', nv);
- }
- });
- },
- load : function (_self, records, options)
- {
-
- var cm = _this.grid.getColumnModel();
- if(records.length){
- cm.setColumnHeader(cm.getIndexByDataIndex('item_stock_balance'),records[0].data.default_location_name);
- }
- }
- },
- remoteSort : true,
- sortInfo : { field : 'item_number', direction: 'ASC' },
- proxy : {
- xtype: 'HttpProxy',
- xns: Roo.data,
- method : 'GET',
- url : baseURL + '/Roo/item.php'
- },
- reader : {
- xtype: 'JsonReader',
- xns: Roo.data,
- totalProperty : 'total',
- root : 'data',
- id : 'id',
- fields : [
- {
- 'name': 'item_id',
- 'type': 'int'
- },
- {
- 'name': 'item_number',
- 'type': 'string'
- },
- {
- 'name': 'item_descrip1',
- 'type': 'string'
- },
- {
- 'name': 'item_descrip2',
- 'type': 'string'
- },
- {
- 'name': 'item_classcode_id',
- 'type': 'int'
- },
- {
- 'name': 'item_picklist',
- 'type': 'int'
- },
- {
- 'name': 'item_comments',
- 'type': 'string'
- },
- {
- 'name': 'item_sold',
- 'type': 'int'
- },
- {
- 'name': 'item_fractional',
- 'type': 'int'
- },
- {
- 'name': 'item_active',
- 'type': 'int'
- },
- {
- 'name': 'item_type',
- 'type': 'string'
- },
- {
- 'name': 'item_prodweight',
- 'type': 'float'
- },
- {
- 'name': 'item_packweight',
- 'type': 'float'
- },
- {
- 'name': 'item_prodcat_id',
- 'type': 'int'
- },
- {
- 'name': 'item_exclusive',
- 'type': 'int'
- },
- {
- 'name': 'item_listprice',
- 'type': 'float'
- },
- {
- 'name': 'item_config',
- 'type': 'int'
- },
- {
- 'name': 'item_extdescrip',
- 'type': 'string'
- },
- {
- 'name': 'item_upccode',
- 'type': 'string'
- },
- {
- 'name': 'item_maxcost',
- 'type': 'float'
- },
- {
- 'name': 'item_inv_uom_id',
- 'type': 'int'
- },
- {
- 'name': 'item_price_uom_id',
- 'type': 'int'
- },
- {
- 'name': 'item_warrdays',
- 'type': 'int'
- },
- {
- 'name': 'item_freightclass_id',
- 'type': 'int'
- },
- {
- 'name': 'item_tax_recoverable',
- 'type': 'int'
- },
- {
- 'name': 'item_price_uom_id_uom_id',
- 'type': 'int'
- },
- {
- 'name': 'item_price_uom_id_uom_name',
- 'type': 'string'
- },
- {
- 'name': 'item_price_uom_id_uom_descrip',
- 'type': 'string'
- },
- {
- 'name': 'item_price_uom_id_uom_item_weight',
- 'type': 'int'
- },
- {
- 'name': 'item_inv_uom_id_uom_id',
- 'type': 'int'
- },
- {
- 'name': 'item_inv_uom_id_uom_name',
- 'type': 'string'
- },
- {
- 'name': 'item_inv_uom_id_uom_descrip',
- 'type': 'string'
- },
- {
- 'name': 'item_inv_uom_id_uom_item_weight',
- 'type': 'int'
- },
- {
- 'name': 'item_freightclass_id_freightclass_id',
- 'type': 'int'
- },
- {
- 'name': 'item_freightclass_id_freightclass_code',
- 'type': 'string'
- },
- {
- 'name': 'item_freightclass_id_freightclass_descrip',
- 'type': 'string'
- },
- {
- 'name': 'item_classcode_id_classcode_id',
- 'type': 'int'
- },
- {
- 'name': 'item_classcode_id_classcode_code',
- 'type': 'string'
- },
- {
- 'name': 'item_classcode_id_classcode_descrip',
- 'type': 'string'
- },
- {
- 'name': 'item_classcode_id_classcode_mfg',
- 'type': 'int'
- },
- {
- 'name': 'item_classcode_id_classcode_creator',
- 'type': 'string'
- },
- {
- 'name': 'item_classcode_id_classcode_created',
- 'type': 'date'
- },
- {
- 'name': 'item_classcode_id_classcode_modifier',
- 'type': 'string'
- },
- {
- 'name': 'item_classcode_id_classcode_modified',
- 'type': 'date'
- },
- {
- 'name': 'item_classcode_id_classcode_type',
- 'type': 'string'
- }
- ]
- }
- },
- toolbar : {
- xtype: 'Toolbar',
- xns: Roo,
- items : [
- {
- xtype: 'ComboBox',
- xns: Roo.form,
- listeners : {
- render : function (_self)
- {
- _this.brandSel = _self;
- },
- select : function (combo, record, index)
- {
- _this.grid.footer.onClick('first');
- }
- },
- allowBlank : true,
- alwaysQuery : true,
- displayField : 'charass_value',
- editable : true,
- emptyText : "Select Brand",
- forceSelection : true,
- listWidth : 300,
- loadingText : "Searching...",
- minChars : 2,
- pageSize : 20,
- qtip : "Select Brand",
- queryParam : 'query[charass_value]',
- selectOnFocus : true,
- tpl : '<div class="x-grid-cell-text x-btn button"><b>{charass_value}</b> </div>',
- triggerAction : 'all',
- width : 150,
- store : {
- xtype: 'Store',
- xns: Roo.data,
- listeners : {
- beforeload : function (_self, o)
- {
- o.params = o.params || {};
- // staff can see all logs, other companies can only see their own.
- // look for all of the charass 's with the same type= eg. brand.
-
- o.params.charass_char_id_char_name = 'BRAND';
- o.params.charass_target_type ='I';
- o.params._distinct = 'charass_value';
- o.params._columns = 'charass_value';
-
- }
- },
- remoteSort : true,
- sortInfo : { field : 'charass_value' , direction : 'ASC' },
- proxy : {
- xtype: 'HttpProxy',
- xns: Roo.data,
- method : 'GET',
- url : baseURL + '/Roo/Charass.php'
- },
- reader : {
- xtype: 'JsonReader',
- xns: Roo.data,
- totalProperty : 'total',
- root : 'data',
- id : 'id',
- fields : [
- {
- 'name': 'id',
- 'type': 'int'
- },
- {
- 'name': 'person_name',
- 'type': 'string'
- },
- {
- 'name': 'event_when',
- 'type': 'date',
- 'dateFormat': 'Y-m-d'
- },
- {
- 'name': 'action',
- 'type': 'string'
- },
- {
- 'name': 'ipaddr',
- 'type': 'string'
- },
- {
- 'name': 'on_id',
- 'type': 'int'
- },
- {
- 'name': 'on_table',
- 'type': 'string'
- },
- {
- 'name': 'person_id',
- 'type': 'int'
- },
- {
- 'name': 'remarks',
- 'type': 'string'
- },
- {
- 'name': 'person_id_id',
- 'type': 'int'
- },
- {
- 'name': 'person_id_office_id',
- 'type': 'int'
- },
- {
- 'name': 'person_id_name',
- 'type': 'string'
- },
- {
- 'name': 'person_id_phone',
- 'type': 'string'
- },
- {
- 'name': 'person_id_fax',
- 'type': 'string'
- },
- {
- 'name': 'person_id_email',
- 'type': 'string'
- },
- {
- 'name': 'person_id_company_id',
- 'type': 'int'
- },
- {
- 'name': 'person_id_role',
- 'type': 'string'
- },
- {
- 'name': 'person_id_active',
- 'type': 'int'
- },
- {
- 'name': 'person_id_remarks',
- 'type': 'string'
- },
- {
- 'name': 'person_id_passwd',
- 'type': 'string'
- },
- {
- 'name': 'person_id_owner_id',
- 'type': 'int'
- },
- {
- 'name': 'person_id_lang',
- 'type': 'string'
- },
- {
- 'name': 'person_id_no_reset_sent',
- 'type': 'int'
- },
- {
- 'name': 'person_id_action_type',
- 'type': 'string'
- },
- {
- 'name': 'person_id_project_id',
- 'type': 'int'
- },
- {
- 'name': 'person_id_deleted_by',
- 'type': 'int'
- },
- {
- 'name': 'person_id_deleted_dt',
- 'type': 'date'
- }
- ]
- }
- }
- },
- {
- xtype: 'TextField',
- xns: Roo.form,
- listeners : {
- render : function (_self)
- {
- _this.search = _self;
- },
- specialkey : function (_self, e)
- {
- _this.grid.footer.onClick('first');
- }
- },
- emptyText : "Search Product"
- },
- {
- xtype: 'Button',
- xns: Roo.Toolbar,
- listeners : {
- click : function (_self, e)
- {
- _this.grid.footer.onClick('first');
- }
- },
- cls : 'x-btn-icon',
- icon : rootURL + '/Pman/templates/images/search.gif'
- },
- {
- xtype: 'Button',
- xns: Roo.Toolbar,
- listeners : {
- click : function (_self, e)
- {
- _this.search.setValue('');
-
-
-
- _this.grid.footer.onClick('first');
- }
- },
- cls : 'x-btn-icon',
- icon : rootURL + '/Pman/templates/images/edit-clear.gif'
- },
- {
- xtype: 'Separator',
- xns: Roo.Toolbar
- },
- {
- xtype: 'Button',
- xns: Roo.Toolbar,
- listeners : {
- toggle : function (_self, pressed)
- {
-
- this.setText(pressed ? "Hide Inactive" : "Show Inactive");
- (function() { _this.grid.footer.onClick('first'); }).defer(100);
- },
- render : function (_self)
- {
- _this.active = _self;
- }
- },
- enableToggle : true,
- text : "Show Inactive"
- },
- {
- xtype: 'Fill',
- xns: Roo.Toolbar
- },
- {
- xtype: 'Button',
- xns: Roo.Toolbar,
- listeners : {
- click : function()
- {
-
- Pman.Dialog.XtupleItem.show( { item_id : 0 } , function() {
- _this.grid.footer.onClick('first');
- });
- }
- },
- cls : 'x-btn-text-icon',
- text : "Add",
- icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
- },
- {
- xtype: 'Button',
- xns: Roo.Toolbar,
- listeners : {
- click : function()
- {
- var s = _this.grid.selModel.getSelectedCell();
- if (!s) {
- Roo.MessageBox.alert("Error", "Select a product");
- return;
- }
- var rec = _this.grid.ds.getAt(s[0]);
-
- var params = [];
-
- Roo.MessageBox.prompt(
- "Rename SKU",
- "Warning changing SKU names affects historical data, and should only be done if you are sure that this is ok",
- function(r,v) {
- if (r != 'ok') {
- return;
-
- }
- params = {
- _rename_sku : v,
- item_id : rec.data.item_id,
- _check : 1
- }
-
- change(params);
-
- return;
-
-
-
- }
- );
-
- var change = function(params){
- new Pman.Request({
- url : baseURL + '/Roo/Item',
- mask : "Renaming",
- method : 'POST',
- params : params,
- success : function(res) {
- Roo.log(res);
- _this.grid.footer.onClick('refresh');
- if(typeof(res.data) == 'string'){
- Roo.MessageBox.alert("Notice", 'SKU has been renamed');
- return
- }
- var offices = [];
- Roo.each(res.data, function(o){
- offices.push(Pman.Xtuple.offices[o]);
- })
- Roo.MessageBox.alert("Notice", 'SKU has been renamed in ' + offices.join(", "));
-
- },
- failure : function(res) {
- Roo.log(res);
- try {
- if (res.errors.confirm.length) {
- var offices = [];
- Roo.each(res.errors.confirm, function(o){
- offices.push(Pman.Xtuple.offices[o]);
- })
- Roo.MessageBox.confirm(
- "Confirm",
- " Do you want to change the name in " + offices.join(", ") + "?",
- function(x) {
- if (x != 'yes') {
- Roo.MessageBox.alert("Notice", 'SKU was not changed');
- return;
- }
- delete params['_check'];
- params._can_change_sku = 1;
- change(params);
- }
- );
- return;
- }
- } catch(e) { }
- Roo.MessageBox.alert("Error", res.errorMsg);
-
- }
- });
- }
-
- }
- },
- text : "Rename SKU"
- },
- {
- xtype: 'Separator',
- xns: Roo.Toolbar
- },
- {
- xtype: 'TextItem',
- xns: Roo.Toolbar,
- text : "Report start :"
- },
- {
- xtype: 'DateField',
- xns: Roo.form,
- listeners : {
- render : function (_self)
- {
- _this.dateFrom = _self;
- }
- },
- format : 'd/M/Y',
- useIso : true,
- value : (function() { return (new Date()).format('Y') + '-01-01'; })()
- },
- {
- xtype: 'ComboBox',
- xns: Roo.form,
- listeners : {
- render : function (_self)
- {
- _this.datespan = _self;
- }
- },
- allowBlank : false,
- displayField : 'fname',
- editable : false,
- fieldLabel : 'Status',
- hiddenName : 'cm_status',
- listWidth : 200,
- mode : 'local',
- name : 'cm_status_name',
- triggerAction : 'all',
- value : 12,
- valueField : 'ftype',
- width : 150,
- store : {
- xtype: 'SimpleStore',
- xns: Roo.data,
- data : [
- [ '1', "Single Month Sales"],
- [ '3', "Quarter Sales"],
- [ '6', "Half year Sales"] ,
- [ '12', "Full Year Sales"]
- ],
- fields : [ 'ftype', 'fname']
- }
- },
- {
- xtype: 'Button',
- xns: Roo.Toolbar,
- listeners : {
- click : function (_self, e)
- {
- if (!_this.brandSel.getValue().length) {
- Roo.MessageBox.alert("Error", "Select a brand to download");
- return;
- }
-
- new Pman.Download({
- url : baseURL + '/Xtuple/Reports/SalesByCountryItemYear',
- params: {
- date_from : _this.dateFrom.getValue(),
- brand : _this.brandSel.getValue(),
- span : _this.datespan.getValue()
- }
- });
-
-
- }
- },
- text : "Download Sales Report"
- }
- ]
- },
- footer : {
- xtype: 'PagingToolbar',
- xns: Roo,
- pageSize : 25,
- displayInfo : true,
- displayMsg : "Displaying item{0} - {1} of {2}",
- emptyMsg : "No item found",
- items : [
- {
- xtype: 'Button',
- xns: Roo.Toolbar,
- text : "Tools - Upload/Download",
- menu : {
- xtype: 'Menu',
- xns: Roo.menu,
- items : [
- {
- xtype: 'Item',
- xns: Roo.menu,
- listeners : {
- click : function (_self, e)
- {
- new Pman.Download({
- method: 'GET',
- url : baseURL + '/Roo/item',
- params : {
- _costgrid : 1
- }
- });
- }
- },
- text : "Download Standard costs"
- },
- {
- xtype: 'Item',
- xns: Roo.menu,
- listeners : {
- click : function (_self, e)
- {
- // Roo.MessageBox.alert("Disabled", "Can you please send Alan the test file for this - there is a problem and we need to fix it before you use this again");
- // return;
-
- Pman.Dialog.Image.show(
- {
- _url : baseURL+'/Xtuple/Import/Products',
- timeout : 60000
-
- },
- function (data) {
- var msg = [];
-
- if (data.updated) {
- msg.push("Updated " + data.updated + " Products(s)");
- }
- if (data.inserted) {
- msg.push("Added " + data.inserted + " Products(s)");
- }
- if (data.skipped) {
- msg.push("Skipped " + data.skipped);
- }
-
- if (!msg.length) {
- msg.push("No data changed");
- }
- Roo.MessageBox.alert("Notice", msg.join("\n"));
-
- }
- );
- }
- },
- text : "Upload new products and costs"
- },
- {
- xtype: 'Separator',
- xns: Roo.menu
- },
- {
- xtype: 'Item',
- xns: Roo.menu,
- listeners : {
- click : function (_self, e)
- {
- Roo.MessageBox.progress ("Syncing Stock", "Sending");
-
- var offset = 0;
-
- function runSync() {
-
- new Pman.Request( {
- url : baseURL+'/Roo/Item',
- method : 'GET',
- timeout: 60000,
- params : {
- _syncFromHK : 1,
- offset : offset
- },
- success : function(res) {
- Roo.log(res);
- if (!res.data.total) {
- Roo.MessageBox.hide();
- return;
- }
- offset += res.data.limit;
- Roo.MessageBox.updateProgress ( offset / res.data.total, "Done " + offset + '/' + res.data.total);
- runSync();
- }
-
-
- });
- }
- runSync();
- }
- },
- text : "Sync Product Data from HK",
- hidden : (function() {
-
- return baseURL.match(/hk\.php$/) ? true : false;
- })()
- },
- {
- xtype: 'Item',
- xns: Roo.menu,
- listeners : {
- click : function (_self, e)
- {
- Roo.MessageBox.progress ("Syncing Stock", "Sending");
-
- var offset = 0;
-
-
-
- new Pman.Request( {
- url : baseURL+'/Roo/Item',
- method : 'GET',
- params : {
- _syncFromHK : 1,
- _new_only : 1
- },
- success : function(res) {
- Roo.log(res);
-
- Roo.MessageBox.hide();
- _this.grid.footer.onClick('refresh');
-
-
- }
-
-
- });
-
- }
- },
- text : "Sync Product from HK (New Products Only)",
- hidden : (function() {
-
- return baseURL.match(/hk\.php$/) ? true : false;
- })()
- },
- {
- xtype: 'Item',
- xns: Roo.menu,
- listeners : {
- click : function (_self, e)
- {
- Roo.MessageBox.progress ("Syncing Stock", "Sending");
-
- var offset = 0;
-
-
-
- new Pman.Request( {
- url : baseURL+'/Roo/Item',
- method : 'GET',
- params : {
- _syncFromHK : 1,
- item_number : _this.search.getValue()
- },
- success : function(res) {
- Roo.log(res);
-
- Roo.MessageBox.hide();
- _this.grid.footer.onClick('refresh');
-
-
- }
-
-
- });
-
- }
- },
- text : "Sync Product from HK (Based on Search)",
- hidden : (function() {
-
- return baseURL.match(/hk\.php$/) ? true : false;
- })()
- }
- ]
- }
- }
- ]
- },
- colModel : [
- {
- xtype: 'ColumnModel',
- xns: Roo.grid,
- dataIndex : 'item_image_id',
- header : 'Image',
- sortable : true,
- width : 100,
- renderer : function(v,x,r) { return String.format('<img src="{0}/Images/Thumb/100/{1}/{2}" height="100">', baseURL, v, r.data.item_image_filename); },
- editor : {
- xtype: 'GridEditor',
- xns: Roo.grid,
- field : {
- xtype: 'ComboBox',
- xns: Roo.form,
- allowBlank : true,
- alwaysQuery : true,
- displayField : 'charass_value',
- editable : true,
- forceSelection : false,
- listWidth : 300,
- loadingText : "Searching...",
- minChars : 2,
- pageSize : 20,
- qtip : "Select Brand",
- queryParam : 'query[charass_value]',
- selectOnFocus : true,
- tpl : '<div class="x-grid-cell-text x-btn button"><b>{charass_value}</b> </div>',
- triggerAction : 'all',
- width : 150,
- store : {
- xtype: 'Store',
- xns: Roo.data,
- listeners : {
- beforeload : function (_self, o)
- {
- o.params = o.params || {};
- // staff can see all logs, other companies can only see their own.
- // look for all of the charass 's with the same type= eg. brand.
-
- o.params.charass_char_id_char_name = 'BRAND';
- o.params.charass_target_type ='I';
- o.params._distinct = 'charass_value';
- o.params._columns = 'charass_value';
-
- }
- },
- remoteSort : true,
- sortInfo : { field : 'charass_value' , direction : 'ASC' },
- proxy : {
- xtype: 'HttpProxy',
- xns: Roo.data,
- method : 'GET',
- url : baseURL + '/Roo/Charass.php'
- },
- reader : {
- xtype: 'JsonReader',
- xns: Roo.data,
- totalProperty : 'total',
- root : 'data',
- id : 'id',
- fields : [
- {
- 'name': 'id',
- 'type': 'int'
- },
- {
- 'name': 'person_name',
- 'type': 'string'
- },
- {
- 'name': 'event_when',
- 'type': 'date',
- 'dateFormat': 'Y-m-d'
- },
- {
- 'name': 'action',
- 'type': 'string'
- },
- {
- 'name': 'ipaddr',
- 'type': 'string'
- },
- {
- 'name': 'on_id',
- 'type': 'int'
- },
- {
- 'name': 'on_table',
- 'type': 'string'
- },
- {
- 'name': 'person_id',
- 'type': 'int'
- },
- {
- 'name': 'remarks',
- 'type': 'string'
- },
- {
- 'name': 'person_id_id',
- 'type': 'int'
- },
- {
- 'name': 'person_id_office_id',
- 'type': 'int'
- },
- {
- 'name': 'person_id_name',
- 'type': 'string'
- },
- {
- 'name': 'person_id_phone',
- 'type': 'string'
- },
- {
- 'name': 'person_id_fax',
- 'type': 'string'
- },
- {
- 'name': 'person_id_email',
- 'type': 'string'
- },
- {
- 'name': 'person_id_company_id',
- 'type': 'int'
- },
- {
- 'name': 'person_id_role',
- 'type': 'string'
- },
- {
- 'name': 'person_id_active',
- 'type': 'int'
- },
- {
- 'name': 'person_id_remarks',
- 'type': 'string'
- },
- {
- 'name': 'person_id_passwd',
- 'type': 'string'
- },
- {
- 'name': 'person_id_owner_id',
- 'type': 'int'
- },
- {
- 'name': 'person_id_lang',
- 'type': 'string'
- },
- {
- 'name': 'person_id_no_reset_sent',
- 'type': 'int'
- },
- {
- 'name': 'person_id_action_type',
- 'type': 'string'
- },
- {
- 'name': 'person_id_project_id',
- 'type': 'int'
- },
- {
- 'name': 'person_id_deleted_by',
- 'type': 'int'
- },
- {
- 'name': 'person_id_deleted_dt',
- 'type': 'date'
- }
- ]
- }
- }
- }
- }
- },
- {
- xtype: 'ColumnModel',
- xns: Roo.grid,
- dataIndex : 'item_char_brand',
- header : 'Brand',
- sortable : true,
- width : 100,
- renderer : function(v) { return String.format('{0}', v); },
- editor : {
- xtype: 'GridEditor',
- xns: Roo.grid,
- field : {
- xtype: 'ComboBox',
- xns: Roo.form,
- allowBlank : true,
- alwaysQuery : true,
- displayField : 'charass_value',
- editable : true,
- forceSelection : false,
- listWidth : 300,
- loadingText : "Searching...",
- minChars : 2,
- pageSize : 20,
- qtip : "Select Brand",
- queryParam : 'query[charass_value]',
- selectOnFocus : true,
- tpl : '<div class="x-grid-cell-text x-btn button"><b>{charass_value}</b> </div>',
- triggerAction : 'all',
- width : 150,
- store : {
- xtype: 'Store',
- xns: Roo.data,
- listeners : {
- beforeload : function (_self, o)
- {
- o.params = o.params || {};
- // staff can see all logs, other companies can only see their own.
- // look for all of the charass 's with the same type= eg. brand.
-
- o.params.charass_char_id_char_name = 'BRAND';
- o.params.charass_target_type ='I';
- o.params._distinct = 'charass_value';
- o.params._columns = 'charass_value';
-
- }
- },
- remoteSort : true,
- sortInfo : { field : 'charass_value' , direction : 'ASC' },
- proxy : {
- xtype: 'HttpProxy',
- xns: Roo.data,
- method : 'GET',
- url : baseURL + '/Roo/Charass.php'
- },
- reader : {
- xtype: 'JsonReader',
- xns: Roo.data,
- totalProperty : 'total',
- root : 'data',
- id : 'id',
- fields : [
- {
- 'name': 'id',
- 'type': 'int'
- },
- {
- 'name': 'person_name',
- 'type': 'string'
- },
- {
- 'name': 'event_when',
- 'type': 'date',
- 'dateFormat': 'Y-m-d'
- },
- {
- 'name': 'action',
- 'type': 'string'
- },
- {
- 'name': 'ipaddr',
- 'type': 'string'
- },
- {
- 'name': 'on_id',
- 'type': 'int'
- },
- {
- 'name': 'on_table',
- 'type': 'string'
- },
- {
- 'name': 'person_id',
- 'type': 'int'
- },
- {
- 'name': 'remarks',
- 'type': 'string'
- },
- {
- 'name': 'person_id_id',
- 'type': 'int'
- },
- {
- 'name': 'person_id_office_id',
- 'type': 'int'
- },
- {
- 'name': 'person_id_name',
- 'type': 'string'
- },
- {
- 'name': 'person_id_phone',
- 'type': 'string'
- },
- {
- 'name': 'person_id_fax',
- 'type': 'string'
- },
- {
- 'name': 'person_id_email',
- 'type': 'string'
- },
- {
- 'name': 'person_id_company_id',
- 'type': 'int'
- },
- {
- 'name': 'person_id_role',
- 'type': 'string'
- },
- {
- 'name': 'person_id_active',
- 'type': 'int'
- },
- {
- 'name': 'person_id_remarks',
- 'type': 'string'
- },
- {
- 'name': 'person_id_passwd',
- 'type': 'string'
- },
- {
- 'name': 'person_id_owner_id',
- 'type': 'int'
- },
- {
- 'name': 'person_id_lang',
- 'type': 'string'
- },
- {
- 'name': 'person_id_no_reset_sent',
- 'type': 'int'
- },
- {
- 'name': 'person_id_action_type',
- 'type': 'string'
- },
- {
- 'name': 'person_id_project_id',
- 'type': 'int'
- },
- {
- 'name': 'person_id_deleted_by',
- 'type': 'int'
- },
- {
- 'name': 'person_id_deleted_dt',
- 'type': 'date'
- }
- ]
- }
- }
- }
- }
- },
- {
- xtype: 'ColumnModel',
- xns: Roo.grid,
- dataIndex : 'item_char_productgroup',
- header : 'Product Group',
- sortable : true,
- width : 100,
- renderer : function(v) { return String.format('{0}', v); },
- editor : {
- xtype: 'GridEditor',
- xns: Roo.grid,
- field : {
- xtype: 'ComboBox',
- xns: Roo.form,
- allowBlank : true,
- alwaysQuery : true,
- displayField : 'charass_value',
- editable : true,
- forceSelection : false,
- listWidth : 300,
- loadingText : "Searching...",
- minChars : 2,
- pageSize : 20,
- qtip : "Select Brand",
- queryParam : 'query[charass_value]',
- selectOnFocus : true,
- tpl : '<div class="x-grid-cell-text x-btn button"><b>{charass_value}</b> </div>',
- triggerAction : 'all',
- width : 150,
- store : {
- xtype: 'Store',
- xns: Roo.data,
- listeners : {
- beforeload : function (_self, o)
- {
- o.params = o.params || {};
- // staff can see all logs, other companies can only see their own.
- // look for all of the charass 's with the same type= eg. brand.
-
- o.params.charass_char_id_char_name = 'PRODUCTGROUP';
- o.params.charass_target_type ='I';
- o.params._distinct = 'charass_value';
- o.params._columns = 'charass_value';
- }
- },
- remoteSort : true,
- sortInfo : { field : 'charass_value' , direction : 'ASC' },
- proxy : {
- xtype: 'HttpProxy',
- xns: Roo.data,
- method : 'GET',
- url : baseURL + '/Roo/Charass.php'
- },
- reader : {
- xtype: 'JsonReader',
- xns: Roo.data,
- totalProperty : 'total',
- root : 'data',
- id : 'id',
- fields : [
- {
- 'name': 'id',
- 'type': 'int'
- },
- {
- 'name': 'person_name',
- 'type': 'string'
- },
- {
- 'name': 'event_when',
- 'type': 'date',
- 'dateFormat': 'Y-m-d'
- },
- {
- 'name': 'action',
- 'type': 'string'
- },
- {
- 'name': 'ipaddr',
- 'type': 'string'
- },
- {
- 'name': 'on_id',
- 'type': 'int'
- },
- {
- 'name': 'on_table',
- 'type': 'string'
- },
- {
- 'name': 'person_id',
- 'type': 'int'
- },
- {
- 'name': 'remarks',
- 'type': 'string'
- },
- {
- 'name': 'person_id_id',
- 'type': 'int'
- },
- {
- 'name': 'person_id_office_id',
- 'type': 'int'
- },
- {
- 'name': 'person_id_name',
- 'type': 'string'
- },
- {
- 'name': 'person_id_phone',
- 'type': 'string'
- },
- {
- 'name': 'person_id_fax',
- 'type': 'string'
- },
- {
- 'name': 'person_id_email',
- 'type': 'string'
- },
- {
- 'name': 'person_id_company_id',
- 'type': 'int'
- },
- {
- 'name': 'person_id_role',
- 'type': 'string'
- },
- {
- 'name': 'person_id_active',
- 'type': 'int'
- },
- {
- 'name': 'person_id_remarks',
- 'type': 'string'
- },
- {
- 'name': 'person_id_passwd',
- 'type': 'string'
- },
- {
- 'name': 'person_id_owner_id',
- 'type': 'int'
- },
- {
- 'name': 'person_id_lang',
- 'type': 'string'
- },
- {
- 'name': 'person_id_no_reset_sent',
- 'type': 'int'
- },
- {
- 'name': 'person_id_action_type',
- 'type': 'string'
- },
- {
- 'name': 'person_id_project_id',
- 'type': 'int'
- },
- {
- 'name': 'person_id_deleted_by',
- 'type': 'int'
- },
- {
- 'name': 'person_id_deleted_dt',
- 'type': 'date'
- }
- ]
- }
- }
- }
- }
- },
- {
- xtype: 'ColumnModel',
- xns: Roo.grid,
- dataIndex : 'item_number',
- header : 'Number',
- sortable : true,
- width : 100,
- renderer : function(v) { return String.format('<B>{0}</B>', v); }
- },
- {
- xtype: 'ColumnModel',
- xns: Roo.grid,
- dataIndex : 'item_char_pickface_location',
- header : 'Pickface',
- sortable : true,
- width : 100,
- renderer : function(v) { return String.format('{0}', v); },
- editor : {
- xtype: 'GridEditor',
- xns: Roo.grid,
- field : {
- xtype: 'TextField',
- xns: Roo.form
- }
- }
- },
- {
- xtype: 'ColumnModel',
- xns: Roo.grid,
- dataIndex : 'item_char_pallet_location',
- header : 'Pallet',
- sortable : true,
- width : 100,
- renderer : function(v) { return String.format('{0}', v); },
- editor : {
- xtype: 'GridEditor',
- xns: Roo.grid,
- field : {
- xtype: 'TextField',
- xns: Roo.form
- }
- }
- },
- {
- xtype: 'ColumnModel',
- xns: Roo.grid,
- dataIndex : 'item_descrip1',
- header : 'Description',
- sortable : true,
- width : 200,
- renderer : function(v) { return String.format('{0}', v); }
- },
- {
- xtype: 'ColumnModel',
- xns: Roo.grid,
- dataIndex : 'itemsrc_active',
- header : 'Purchased',
- width : 55,
- renderer : function(v) {
- var state = v * 1 > 0 ? '-checked' : '';
-
- return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
-
- }
- },
- {
- xtype: 'ColumnModel',
- xns: Roo.grid,
- dataIndex : 'item_sold',
- header : 'is Sold?',
- width : 50,
- renderer : function(v) {
- var state = v * 1 > 0 ? '-checked' : '';
-
- return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
-
- }
- },
- {
- xtype: 'ColumnModel',
- xns: Roo.grid,
- dataIndex : 'item_active',
- header : 'is Active?',
- width : 50,
- renderer : function(v) {
- var state = v * 1 > 0 ? '-checked' : '';
-
- return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
-
- }
- },
- {
- xtype: 'ColumnModel',
- xns: Roo.grid,
- align : 'right',
- dataIndex : 'last_purchase_price',
- header : 'Last purchase price',
- width : 120,
- renderer : function(v,x,r) {
-
- return String.format('{0}{1}', r.data.last_purchase_price_curr_name, Roo.util.Format.number(v,2)) ;
-
- }
- },
- {
- xtype: 'ColumnModel',
- xns: Roo.grid,
- dataIndex : 'item_prodcat_id_prodcat_code',
- header : 'Item prodcat',
- width : 100,
- renderer : function(v,x,r) {
- return String.format('{0}/{1}', r.data.item_type, v);
- }
- },
- {
- xtype: 'ColumnModel',
- xns: Roo.grid,
- align : 'right',
- dataIndex : 'item_actcost',
- header : 'Cost',
- width : 75,
- renderer : function(v,x,r) {
-
- return String.format('{0}{1}', r.data.item_curr_name, Roo.util.Format.number(v,2)) ;
-
- }
- },
- {
- xtype: 'ColumnModel',
- xns: Roo.grid,
- align : 'right',
- dataIndex : 'item_base_cost',
- header : 'Cost (base)',
- width : 75,
- renderer : function(v,x,r) {
-
- return String.format('{0}{1}', r.data.item_base_curr, Roo.util.Format.number(v,2)) ;
-
- }
- },
- {
- xtype: 'ColumnModel',
- xns: Roo.grid,
- align : 'right',
- dataIndex : 'item_stock_balance',
- header : 'Balance',
- width : 100,
- renderer : function(v) { return String.format('{0}', v ? parseInt( v) : ''); }
- }
- ]
+
+ _strings : {
+ 'be53a0541a6d36f6ecb879fa2c584b08' :"Image",
+ '41e902bb1b2db625736ede3bacc41fe0' :"is Sold?",
+ 'ce4ee01637f4279d02d0f232459dc9a4' :"Purchased",
+ '1be6f9eb563f3bf85c78b4219bf09de9' :"Brand",
+ 'aa554e9e2270df2127bfe9096f1bd9ce' :"Displaying item{0} - {1} of {2}",
+ 'ce5bf551379459c1c61d2a204061c455' :"Location",
+ '44ca8ce0e02dee5d520525ac21bcbee9' :"Sync Product from HK (Based on Search)",
+ '068f80c7519d0528fb08e82137a72131' :"Products",
+ '68f43fdcf074903d65da764642a4b968' :"is Active?",
+ '759d259249621c817551c5fe726d5c57' :"itemloc",
+ '89217b1527e14cced20e78111a8f5027' :"Item prodcat",
+ 'e924991fc4c883bc237e69efe884d674' :"Download Sales Report",
+ 'ee3585dbcb1e8f8826f3403c1e9d898c' :"Rename SKU",
+ '20b4f77bd00b4f63a49ec8e08f3bf6a6' :"Cost",
+ 'fe78f3efbfa84d8485d589031596c5b8' :"Pallet",
+ 'ec211f7c20af43e742bf2570c3cb84f9' :"Add",
+ '19029645d5286771ac708d1bcd118bf4' :"Displaying itemloc{0} - {1} of {2}",
+ '1243daf593fa297e07ab03bf06d925af' :"Searching...",
+ '99a808d8d16122d70e44bd7f709d30fb' :"Balance",
+ '9a8faafb674c03474827bcb6fcde43a3' :"Search Product",
+ 'f1c3ca6cadc4a9f57a08d5f7482a3f83' :"No item found",
+ 'd6ea9efa48916e9563d76ddc233ebe2a' :"Sync Product from HK (New Products Only)",
+ 'ec53a8c4f07baed5d8825072c89799be' :"Status",
+ '2cfd827c6e37453fe1ddde82a5bd9474' :"No itemloc found",
+ 'd8ab3576a67fe0cc175ee77d57d0fd85' :"Pickface",
+ '5bc3fd20294c17c9803942958fd7f26d' :"Show Inactive",
+ '70cd7e06502a63356290711ec3b11223' :"Upload new products and costs",
+ 'c6ca371871d835c79c8654b5cd788cc7' :"Product Group",
+ '695dbdb13fad32669a68d8fec8541c7f' :"Download Standard costs",
+ '156567f65fc207d39cadbf045687c521' :"Itemloc qty",
+ 'c2f1d503b95bf9f3aa4d775a216c5c73' :"Sync Product Data from HK",
+ '36c454c4130e4444e8410f11d6d998f0' :"Tools - Upload/Download",
+ 'b5a7adde1af5c87d7fd797b6245c2a39' :"Description",
+ '7fee866379427143414dd7a72e56414b' :"Report start :",
+ 'a9e35d03ee7f31f5bb199379a6d3547a' :"Select Brand",
+ '35be52be39d3efcd0cd2b3721fc3c298' :"Cost (base)",
+ '750587d31c68779e7f615c190a9dc23f' :"Last purchase price",
+ 'b2ee912b91d69b435159c7c3f6df7f5f' :"Number",
+ '173cf046739c17fd7c97ec3540d58807' :"(function() { return (new Date()).format('Y') + '-01-01'; })()",
+ 'c20ad4d76fe97759aa27a0c99bff6710' :"12"
+ },
+
+ part : ["Xtuple", "Item" ],
+ order : '001-Pman.Tab.XtupleItem',
+ region : 'center',
+ parent : 'Pman.Tab.XtupleManage',
+ name : "Pman.Tab.XtupleItem",
+ disabled : false,
+ permname : '',
+ _tree : function()
+ {
+ var _this = this;
+ var MODULE = this;
+ return {
+ background : false,
+ region : 'center',
+ title : _this._strings['068f80c7519d0528fb08e82137a72131'] /* Products */,
+ xns : Roo,
+ '|xns' : 'Roo',
+ xtype : 'NestedLayoutPanel',
+ layout : {
+ xns : Roo,
+ '|xns' : 'Roo',
+ xtype : 'BorderLayout',
+ center : {
+ xns : Roo,
+ '|xns' : 'Roo',
+ xtype : 'LayoutRegion'
+ },
+ east : {
+ split : true,
+ width : 200,
+ xns : Roo,
+ '|xns' : 'Roo',
+ xtype : 'LayoutRegion'
+ },
+ items : [
+ {
+ background : false,
+ fitContainer : true,
+ fitToframe : true,
+ region : 'center',
+ tableName : 'item',
+ title : _this._strings['068f80c7519d0528fb08e82137a72131'] /* Products */,
+ xns : Roo,
+ '|xns' : 'Roo',
+ xtype : 'GridPanel',
+ listeners : {
+ activate : function() {
+ _this.panel = this;
+ if (_this.grid) {
+ _this.grid.footer.onClick('first');
+ }
+ }
+ },
+ grid : {
+ autoExpandColumn : 'item_descrip1',
+ clicksToEdit : 1,
+ loadMask : true,
+ xns : Roo.grid,
+ '|xns' : 'Roo.grid',
+ xtype : 'EditorGrid',
+ listeners : {
+ afteredit : function (e)
+ {
+
+
+ Roo.log(e);
+ new Pman.Request({
+ url : baseURL +'/Roo/Charass',
+ params : {
+ charass_char_id_char_name : e.field.replace(/^item_char_/,'').toUpperCase(),
+ charass_value : e.value,
+ charass_target_type : 'I',
+ charass_default : 1,
+ charass_target_id : e.record.data.item_id
+ },
+ method : 'POST'
+ });
+
+
+ e.record.commit();
+
+
+
+ },
+ cellclick : function (_self, row, col, e)
+ {
+ var di = _this.grid.colModel.getDataIndex(col);
+
+ var rec = _this.grid.ds.getAt(row);
+
+
+ if (di == 'item_active') {
+
+ var nv = rec.data.item_active ? 0 : 1;
+ new Pman.Request({
+ mask : 'Saving',
+ url : baseURL + '/Roo/Item',
+ params : {
+ item_id : rec.data.item_id,
+ item_active : nv
+ },
+ success : function() {
+ rec.set('item_active', nv);
+ }
+ });
+ return;
+
+
+ }
+
+ if(di == 'itemsrc_active'){
+
+
+
+
+ if(rec.data.itemsrc_active * 1){
+ Roo.MessageBox.confirm("Confirm", "Are you sure this product is no longer purchased",
+ function (res) {
+ if(res!='yes') {
+ return;
+ }
+ rec.set('itemsrc_active', 0);
+ rec.commit();
+ });
+ return;
+ }
+
+ Pman.Dialog.XtupleItem.show( { item_id : rec.data.item_id } , function() {
+ _this.grid.footer.onClick('first');
+ });
+ return;
+
+ }
+
+ _this.locgrid.footer.onClick('first');
+
+
+
+
+ },
+ celldblclick : function (_self, rowIndex, columnIndex, e)
+ {
+ var s = _this.grid.ds.getAt(rowIndex);
+
+ Pman.Dialog.XtupleItem.show( { item_id : s.data.item_id } , function() {
+ _this.grid.footer.onClick('first');
+ });
+ },
+ render : function()
+ {
+ _this.grid = this;
+ //_this.dialog = Pman.Dialog.FILL_IN
+ if (_this.panel.active) {
+ this.footer.onClick('first');
+ }
+ }
+ },
+ footer : {
+ displayInfo : true,
+ displayMsg : _this._strings['aa554e9e2270df2127bfe9096f1bd9ce'] /* Displaying item{0} - {1} of {2} */,
+ emptyMsg : _this._strings['f1c3ca6cadc4a9f57a08d5f7482a3f83'] /* No item found */,
+ pageSize : 25,
+ xns : Roo,
+ '|xns' : 'Roo',
+ xtype : 'PagingToolbar',
+ items : [
+ {
+ text : _this._strings['36c454c4130e4444e8410f11d6d998f0'] /* Tools - Upload/Download */,
+ xns : Roo.Toolbar,
+ '|xns' : 'Roo.Toolbar',
+ xtype : 'Button',
+ menu : {
+ xns : Roo.menu,
+ '|xns' : 'Roo.menu',
+ xtype : 'Menu',
+ items : [
+ {
+ text : _this._strings['695dbdb13fad32669a68d8fec8541c7f'] /* Download Standard costs */,
+ xns : Roo.menu,
+ '|xns' : 'Roo.menu',
+ xtype : 'Item',
+ listeners : {
+ click : function (_self, e)
+ {
+ new Pman.Download({
+ method: 'GET',
+ url : baseURL + '/Roo/item',
+ params : {
+ _costgrid : 1
+ }
+ });
+ }
+ }
+ },
+ {
+ text : _this._strings['70cd7e06502a63356290711ec3b11223'] /* Upload new products and costs */,
+ xns : Roo.menu,
+ '|xns' : 'Roo.menu',
+ xtype : 'Item',
+ listeners : {
+ click : function (_self, e)
+ {
+ // Roo.MessageBox.alert("Disabled", "Can you please send Alan the test file for this - there is a problem and we need to fix it before you use this again");
+ // return;
+
+ Pman.Dialog.Image.show(
+ {
+ _url : baseURL+'/Xtuple/Import/Products',
+ timeout : 60000
+
+ },
+ function (data) {
+ var msg = [];
+
+ if (data.updated) {
+ msg.push("Updated " + data.updated + " Products(s)");
+ }
+ if (data.inserted) {
+ msg.push("Added " + data.inserted + " Products(s)");
+ }
+ if (data.skipped) {
+ msg.push("Skipped " + data.skipped);
+ }
+
+ if (!msg.length) {
+ msg.push("No data changed");
+ }
+ Roo.MessageBox.alert("Notice", msg.join("\n"));
+
+ }
+ );
+ }
+ }
+ },
+ {
+ xns : Roo.menu,
+ '|xns' : 'Roo.menu',
+ xtype : 'Separator'
+ },
+ {
+ hidden : (function() {
+
+ return baseURL.match(/hk\.php$/) ? true : false;
+ })(),
+ text : _this._strings['c2f1d503b95bf9f3aa4d775a216c5c73'] /* Sync Product Data from HK */,
+ xns : Roo.menu,
+ '|xns' : 'Roo.menu',
+ xtype : 'Item',
+ listeners : {
+ click : function (_self, e)
+ {
+ Roo.MessageBox.progress ("Syncing Stock", "Sending");
+
+ var offset = 0;
+
+ function runSync() {
+
+ new Pman.Request( {
+ url : baseURL+'/Roo/Item',
+ method : 'GET',
+ timeout: 60000,
+ params : {
+ _syncFromHK : 1,
+ offset : offset
+ },
+ success : function(res) {
+ Roo.log(res);
+ if (!res.data.total) {
+ Roo.MessageBox.hide();
+ return;
+ }
+ offset += res.data.limit;
+ Roo.MessageBox.updateProgress ( offset / res.data.total, "Done " + offset + '/' + res.data.total);
+ runSync();
+ }
+
+
+ });
+ }
+ runSync();
+ }
+ }
+ },
+ {
+ hidden : (function() {
+
+ return baseURL.match(/hk\.php$/) ? true : false;
+ })(),
+ text : _this._strings['d6ea9efa48916e9563d76ddc233ebe2a'] /* Sync Product from HK (New Products Only) */,
+ xns : Roo.menu,
+ '|xns' : 'Roo.menu',
+ xtype : 'Item',
+ listeners : {
+ click : function (_self, e)
+ {
+ Roo.MessageBox.progress ("Syncing Stock", "Sending");
+
+ var offset = 0;
+
+
+
+ new Pman.Request( {
+ url : baseURL+'/Roo/Item',
+ method : 'GET',
+ params : {
+ _syncFromHK : 1,
+ _new_only : 1
+ },
+ success : function(res) {
+ Roo.log(res);
+
+ Roo.MessageBox.hide();
+ _this.grid.footer.onClick('refresh');
+
+
+ }
+
+
+ });
+
+ }
+ }
+ },
+ {
+ hidden : (function() {
+
+ return baseURL.match(/hk\.php$/) ? true : false;
+ })(),
+ text : _this._strings['44ca8ce0e02dee5d520525ac21bcbee9'] /* Sync Product from HK (Based on Search) */,
+ xns : Roo.menu,
+ '|xns' : 'Roo.menu',
+ xtype : 'Item',
+ listeners : {
+ click : function (_self, e)
+ {
+ Roo.MessageBox.progress ("Syncing Stock", "Sending");
+
+ var offset = 0;
+
+
+
+ new Pman.Request( {
+ url : baseURL+'/Roo/Item',
+ method : 'GET',
+ params : {
+ _syncFromHK : 1,
+ item_number : _this.search.getValue()
+ },
+ success : function(res) {
+ Roo.log(res);
+
+ Roo.MessageBox.hide();
+ _this.grid.footer.onClick('refresh');
+
+
+ }
+
+
+ });
+
+ }
+ }
+ }
+ ]
+ }
+ }
+ ]
+ },
+ toolbar : {
+ xns : Roo,
+ '|xns' : 'Roo',
+ xtype : 'Toolbar',
+ items : [
+ {
+ allowBlank : true,
+ alwaysQuery : true,
+ displayField : 'charass_value',
+ editable : true,
+ emptyText : _this._strings['a9e35d03ee7f31f5bb199379a6d3547a'] /* Select Brand */,
+ forceSelection : true,
+ listWidth : 300,
+ loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
+ minChars : 2,
+ pageSize : 20,
+ qtip : _this._strings['a9e35d03ee7f31f5bb199379a6d3547a'] /* Select Brand */,
+ queryParam : 'query[charass_value]',
+ selectOnFocus : true,
+ tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{charass_value}</b> </div>',
+ triggerAction : 'all',
+ width : 150,
+ xns : Roo.form,
+ '|xns' : 'Roo.form',
+ xtype : 'ComboBox',
+ listeners : {
+ render : function (_self)
+ {
+ _this.brandSel = _self;
+ },
+ select : function (combo, record, index)
+ {
+ _this.grid.footer.onClick('first');
+ }
+ },
+ store : {
+ remoteSort : true,
+ sortInfo : { field : 'charass_value' , direction : 'ASC' },
+ xns : Roo.data,
+ '|xns' : 'Roo.data',
+ xtype : 'Store',
+ listeners : {
+ beforeload : function (_self, o)
+ {
+ o.params = o.params || {};
+ // staff can see all logs, other companies can only see their own.
+ // look for all of the charass 's with the same type= eg. brand.
+
+ o.params.charass_char_id_char_name = 'BRAND';
+ o.params.charass_target_type ='I';
+ o.params._distinct = 'charass_value';
+ o.params._columns = 'charass_value';
+
+ }
+ },
+ proxy : {
+ method : 'GET',
+ url : baseURL + '/Roo/Charass.php',
+ xns : Roo.data,
+ '|xns' : 'Roo.data',
+ xtype : 'HttpProxy'
+ },
+ reader : {
+ fields : [
+ {
+ 'name': 'id',
+ 'type': 'int'
+ },
+ {
+ 'name': 'person_name',
+ 'type': 'string'
+ },
+ {
+ 'name': 'event_when',
+ 'type': 'date',
+ 'dateFormat': 'Y-m-d'
+ },
+ {
+ 'name': 'action',
+ 'type': 'string'
+ },
+ {
+ 'name': 'ipaddr',
+ 'type': 'string'
+ },
+ {
+ 'name': 'on_id',
+ 'type': 'int'
+ },
+ {
+ 'name': 'on_table',
+ 'type': 'string'
+ },
+ {
+ 'name': 'person_id',
+ 'type': 'int'
+ },
+ {
+ 'name': 'remarks',
+ 'type': 'string'
+ },
+ {
+ 'name': 'person_id_id',
+ 'type': 'int'
+ },
+ {
+ 'name': 'person_id_office_id',
+ 'type': 'int'
+ },
+ {
+ 'name': 'person_id_name',
+ 'type': 'string'
+ },
+ {
+ 'name': 'person_id_phone',
+ 'type': 'string'
+ },
+ {
+ 'name': 'person_id_fax',
+ 'type': 'string'
+ },
+ {
+ 'name': 'person_id_email',
+ 'type': 'string'
+ },
+ {
+ 'name': 'person_id_company_id',
+ 'type': 'int'
+ },
+ {
+ 'name': 'person_id_role',
+ 'type': 'string'
+ },
+ {
+ 'name': 'person_id_active',
+ 'type': 'int'
+ },
+ {
+ 'name': 'person_id_remarks',
+ 'type': 'string'
+ },
+ {
+ 'name': 'person_id_passwd',
+ 'type': 'string'
+ },
+ {
+ 'name': 'person_id_owner_id',
+ 'type': 'int'
+ },
+ {
+ 'name': 'person_id_lang',
+ 'type': 'string'
+ },
+ {
+ 'name': 'person_id_no_reset_sent',
+ 'type': 'int'
+ },
+ {
+ 'name': 'person_id_action_type',
+ 'type': 'string'
+ },
+ {
+ 'name': 'person_id_project_id',
+ 'type': 'int'
+ },
+ {
+ 'name': 'person_id_deleted_by',
+ 'type': 'int'
+ },
+ {
+ 'name': 'person_id_deleted_dt',
+ 'type': 'date'
+ }
+ ],
+ id : 'id',
+ root : 'data',
+ totalProperty : 'total',
+ xns : Roo.data,
+ '|xns' : 'Roo.data',
+ xtype : 'JsonReader'
+ }
+ }
+ },
+ {
+ emptyText : _this._strings['9a8faafb674c03474827bcb6fcde43a3'] /* Search Product */,
+ xns : Roo.form,
+ '|xns' : 'Roo.form',
+ xtype : 'TextField',
+ listeners : {
+ render : function (_self)
+ {
+ _this.search = _self;
+ },
+ specialkey : function (_self, e)
+ {
+ _this.grid.footer.onClick('first');
+ }
+ }
+ },
+ {
+ cls : 'x-btn-icon',
+ icon : rootURL + '/Pman/templates/images/search.gif',
+ xns : Roo.Toolbar,
+ '|xns' : 'Roo.Toolbar',
+ xtype : 'Button',
+ listeners : {
+ click : function (_self, e)
+ {
+ _this.grid.footer.onClick('first');
+ }
+ }
+ },
+ {
+ cls : 'x-btn-icon',
+ icon : rootURL + '/Pman/templates/images/edit-clear.gif',
+ xns : Roo.Toolbar,
+ '|xns' : 'Roo.Toolbar',
+ xtype : 'Button',
+ listeners : {
+ click : function (_self, e)
+ {
+ _this.search.setValue('');
+
+
+
+ _this.grid.footer.onClick('first');
+ }
+ }
+ },
+ {
+ xns : Roo.Toolbar,
+ '|xns' : 'Roo.Toolbar',
+ xtype : 'Separator'
+ },
+ {
+ enableToggle : true,
+ text : _this._strings['5bc3fd20294c17c9803942958fd7f26d'] /* Show Inactive */,
+ xns : Roo.Toolbar,
+ '|xns' : 'Roo.Toolbar',
+ xtype : 'Button',
+ listeners : {
+ render : function (_self)
+ {
+ _this.active = _self;
+ },
+ toggle : function (_self, pressed)
+ {
+
+ this.setText(pressed ? "Hide Inactive" : "Show Inactive");
+ (function() { _this.grid.footer.onClick('first'); }).defer(100);
+ }
+ }
+ },
+ {
+ xns : Roo.Toolbar,
+ '|xns' : 'Roo.Toolbar',
+ xtype : 'Fill'
+ },
+ {
+ cls : 'x-btn-text-icon',
+ icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
+ text : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'] /* Add */,
+ xns : Roo.Toolbar,
+ '|xns' : 'Roo.Toolbar',
+ xtype : 'Button',
+ listeners : {
+ click : function()
+ {
+
+ Pman.Dialog.XtupleItem.show( { item_id : 0 } , function() {
+ _this.grid.footer.onClick('first');
+ });
+ }
+ }
+ },
+ {
+ text : _this._strings['ee3585dbcb1e8f8826f3403c1e9d898c'] /* Rename SKU */,
+ xns : Roo.Toolbar,
+ '|xns' : 'Roo.Toolbar',
+ xtype : 'Button',
+ listeners : {
+ click : function()
+ {
+ var s = _this.grid.selModel.getSelectedCell();
+ if (!s) {
+ Roo.MessageBox.alert("Error", "Select a product");
+ return;
+ }
+ var rec = _this.grid.ds.getAt(s[0]);
+
+ var params = [];
+
+ Roo.MessageBox.prompt(
+ "Rename SKU",
+ "Warning changing SKU names affects historical data, and should only be done if you are sure that this is ok",
+ function(r,v) {
+ if (r != 'ok') {
+ return;
+
+ }
+ params = {
+ _rename_sku : v,
+ item_id : rec.data.item_id,
+ _check : 1
}
- },
- {
- xtype: 'GridPanel',
- xns: Roo,
- listeners : {
- activate : function() {
- _this.locpanel = this;
-
+
+ change(params);
+
+ return;
+
+
+
+ }
+ );
+
+ var change = function(params){
+ new Pman.Request({
+ url : baseURL + '/Roo/Item',
+ mask : "Renaming",
+ method : 'POST',
+ params : params,
+ success : function(res) {
+ Roo.log(res);
+ _this.grid.footer.onClick('refresh');
+ if(typeof(res.data) == 'string'){
+ Roo.MessageBox.alert("Notice", 'SKU has been renamed');
+ return
}
+ var offices = [];
+ Roo.each(res.data, function(o){
+ offices.push(Pman.Xtuple.offices[o]);
+ })
+ Roo.MessageBox.alert("Notice", 'SKU has been renamed in ' + offices.join(", "));
+
},
- background : true,
- fitContainer : true,
- fitToframe : true,
- region : 'east',
- tableName : 'itemloc',
- title : "itemloc",
- grid : {
- xtype: 'Grid',
- xns: Roo.grid,
- listeners : {
- render : function()
- {
- _this.locgrid = this;
- //_this.dialog = Pman.Dialog.FILL_IN
-
- },
- rowdblclick : function (_self, rowIndex, e)
- {
- if (!_this.dialog) return;
- _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {
- _this.grid.footer.onClick('first');
- });
- }
- },
- autoExpandColumn : 'location_name',
- loadMask : true,
- dataSource : {
- xtype: 'Store',
- xns: Roo.data,
- listeners : {
- beforeload : function (_self, o)
- {
- var sel = _this.grid.selModel.getSelectedCell();
- if (!sel) {
- this.removeAll();
- return false;
- }
- var rec = _this.grid.ds.getAt(sel[0]);
- o.params._stock_for_item_id = rec.data.item_id;
- //o.params['!itemloc_qty'] = 0;
-
-
- }
- },
- remoteSort : true,
- sortInfo : { field : 'location_name', direction: 'ASC' },
- proxy : {
- xtype: 'HttpProxy',
- xns: Roo.data,
- method : 'GET',
- url : baseURL + '/Roo/location.php'
- },
- reader : {
- xtype: 'JsonReader',
- xns: Roo.data,
- totalProperty : 'total',
- root : 'data',
- id : 'id',
- fields : [
- {
- 'name': 'itemloc_id',
- 'type': 'int'
- },
- {
- 'name': 'itemloc_itemsite_id',
- 'type': 'int'
- },
- {
- 'name': 'itemloc_location_id',
- 'type': 'int'
- },
- {
- 'name': 'itemloc_qty',
- 'type': 'float'
- },
- {
- 'name': 'itemloc_expiration',
- 'type': 'date',
- 'dateFormat': 'Y-m-d'
- },
- {
- 'name': 'itemloc_consolflag',
- 'type': 'int'
- },
- {
- 'name': 'itemloc_ls_id',
- 'type': 'int'
- },
- {
- 'name': 'itemloc_warrpurc',
- 'type': 'date',
- 'dateFormat': 'Y-m-d'
+ failure : function(res) {
+ Roo.log(res);
+ try {
+ if (res.errors.confirm.length) {
+ var offices = [];
+ Roo.each(res.errors.confirm, function(o){
+ offices.push(Pman.Xtuple.offices[o]);
+ })
+ Roo.MessageBox.confirm(
+ "Confirm",
+ " Do you want to change the name in " + offices.join(", ") + "?",
+ function(x) {
+ if (x != 'yes') {
+ Roo.MessageBox.alert("Notice", 'SKU was not changed');
+ return;
+ }
+ delete params['_check'];
+ params._can_change_sku = 1;
+ change(params);
}
- ]
- }
- },
- footer : {
- xtype: 'PagingToolbar',
- xns: Roo,
- pageSize : 25,
- displayInfo : true,
- displayMsg : "Displaying itemloc{0} - {1} of {2}",
- emptyMsg : "No itemloc found"
- },
- colModel : [
- {
- xtype: 'ColumnModel',
- xns: Roo.grid,
- dataIndex : 'location_name',
- header : 'Location',
- width : 75,
- renderer : function(v) { return String.format('{0}', v); }
- },
- {
- xtype: 'ColumnModel',
- xns: Roo.grid,
- dataIndex : 'itemloc_realqty',
- header : 'Itemloc qty',
- width : 75,
- renderer : function(v) { return String.format('{0}', v*1 ? (v*1).toFixed(0) : ''); }
+ );
+ return;
}
- ]
+ } catch(e) { }
+ Roo.MessageBox.alert("Error", res.errorMsg);
+
}
- }
- ],
- center : {
- xtype: 'LayoutRegion',
- xns: Roo
- },
- east : {
- xtype: 'LayoutRegion',
- xns: Roo,
- split : true,
- width : 200
+ });
+ }
+
+ }
+ }
+ },
+ {
+ xns : Roo.Toolbar,
+ '|xns' : 'Roo.Toolbar',
+ xtype : 'Separator'
+ },
+ {
+ text : _this._strings['7fee866379427143414dd7a72e56414b'] /* Report start : */,
+ xns : Roo.Toolbar,
+ '|xns' : 'Roo.Toolbar',
+ xtype : 'TextItem'
+ },
+ {
+ format : 'd/M/Y',
+ useIso : true,
+ value : (function() { return (new Date()).format('Y') + '-01-01'; })(),
+ xns : Roo.form,
+ '|xns' : 'Roo.form',
+ xtype : 'DateField',
+ listeners : {
+ render : function (_self)
+ {
+ _this.dateFrom = _self;
+ }
+ }
+ },
+ {
+ allowBlank : false,
+ displayField : 'fname',
+ editable : false,
+ fieldLabel : _this._strings['ec53a8c4f07baed5d8825072c89799be'] /* Status */,
+ hiddenName : 'cm_status',
+ listWidth : 200,
+ mode : 'local',
+ name : 'cm_status_name',
+ triggerAction : 'all',
+ value : 12,
+ valueField : 'ftype',
+ width : 150,
+ xns : Roo.form,
+ '|xns' : 'Roo.form',
+ xtype : 'ComboBox',
+ listeners : {
+ render : function (_self)
+ {
+ _this.datespan = _self;
+ }
+ },
+ store : {
+ data : [
+ [ '1', "Single Month Sales"],
+ [ '3', "Quarter Sales"],
+ [ '6', "Half year Sales"] ,
+ [ '12', "Full Year Sales"]
+ ],
+ fields : [ 'ftype', 'fname'],
+ xns : Roo.data,
+ '|xns' : 'Roo.data',
+ xtype : 'SimpleStore'
+ }
+ },
+ {
+ text : _this._strings['e924991fc4c883bc237e69efe884d674'] /* Download Sales Report */,
+ xns : Roo.Toolbar,
+ '|xns' : 'Roo.Toolbar',
+ xtype : 'Button',
+ listeners : {
+ click : function (_self, e)
+ {
+ if (!_this.brandSel.getValue().length) {
+ Roo.MessageBox.alert("Error", "Select a brand to download");
+ return;
}
+
+ new Pman.Download({
+ url : baseURL + '/Xtuple/Reports/SalesByCountryItemYear',
+ params: {
+ date_from : _this.dateFrom.getValue(),
+ brand : _this.brandSel.getValue(),
+ span : _this.datespan.getValue()
+ }
+ });
+
+
+ }
+ }
+ }
+ ]
+ },
+ dataSource : {
+ remoteSort : true,
+ sortInfo : { field : 'item_number', direction: 'ASC' },
+ xns : Roo.data,
+ '|xns' : 'Roo.data',
+ xtype : 'Store',
+ listeners : {
+ beforeload : function (_self, o)
+ {
+ o.params._with_prodcat = 1;
+ o.params._with_char = 1;
+ o.params._with_itemsrc_active = 1;
+ o.params._with_last_purchase_price = 1;
+ o.params._with_image = 1;
+ var s = _this.search.getValue();
+ if (s.length) {
+ o.params['query[number_or_name]'] = s;
+ }
+ if (!_this.active.pressed) {
+ o.params.item_active = 1;
+ }
+ if (_this.brandSel.getValue().length) {
+ o.params._with_brand = _this.brandSel.getValue()
+ }
+
+ o.params._with_stock_balance = 1;
+ },
+ load : function (_self, records, options)
+ {
+
+ var cm = _this.grid.getColumnModel();
+ if(records.length){
+ cm.setColumnHeader(cm.getIndexByDataIndex('item_stock_balance'),records[0].data.default_location_name);
+ }
+ },
+ update : function (_self, record, operation)
+ {
+ if(operation != 'commit'){
+ return;
+ }
+
+ var nv = record.data.itemsrc_active ? 0 : 1;
+ new Pman.Request({
+ mask : 'Saving',
+ url : baseURL + '/Roo/Itemsrc',
+ params : {
+ _update_by_item : 1,
+ item_id : record.data.item_id,
+ itemsrc_active : nv
+ },
+ success : function(res) {
+ record.set('itemsrc_active', nv);
+ }
+ });
+ }
+ },
+ proxy : {
+ method : 'GET',
+ url : baseURL + '/Roo/item.php',
+ xns : Roo.data,
+ '|xns' : 'Roo.data',
+ xtype : 'HttpProxy'
+ },
+ reader : {
+ fields : [
+ {
+ 'name': 'item_id',
+ 'type': 'int'
+ },
+ {
+ 'name': 'item_number',
+ 'type': 'string'
+ },
+ {
+ 'name': 'item_descrip1',
+ 'type': 'string'
+ },
+ {
+ 'name': 'item_descrip2',
+ 'type': 'string'
+ },
+ {
+ 'name': 'item_classcode_id',
+ 'type': 'int'
+ },
+ {
+ 'name': 'item_picklist',
+ 'type': 'int'
+ },
+ {
+ 'name': 'item_comments',
+ 'type': 'string'
+ },
+ {
+ 'name': 'item_sold',
+ 'type': 'int'
+ },
+ {
+ 'name': 'item_fractional',
+ 'type': 'int'
+ },
+ {
+ 'name': 'item_active',
+ 'type': 'int'
+ },
+ {
+ 'name': 'item_type',
+ 'type': 'string'
+ },
+ {
+ 'name': 'item_prodweight',
+ 'type': 'float'
+ },
+ {
+ 'name': 'item_packweight',
+ 'type': 'float'
+ },
+ {
+ 'name': 'item_prodcat_id',
+ 'type': 'int'
+ },
+ {
+ 'name': 'item_exclusive',
+ 'type': 'int'
+ },
+ {
+ 'name': 'item_listprice',
+ 'type': 'float'
+ },
+ {
+ 'name': 'item_config',
+ 'type': 'int'
+ },
+ {
+ 'name': 'item_extdescrip',
+ 'type': 'string'
+ },
+ {
+ 'name': 'item_upccode',
+ 'type': 'string'
+ },
+ {
+ 'name': 'item_maxcost',
+ 'type': 'float'
+ },
+ {
+ 'name': 'item_inv_uom_id',
+ 'type': 'int'
+ },
+ {
+ 'name': 'item_price_uom_id',
+ 'type': 'int'
+ },
+ {
+ 'name': 'item_warrdays',
+ 'type': 'int'
+ },
+ {
+ 'name': 'item_freightclass_id',
+ 'type': 'int'
+ },
+ {
+ 'name': 'item_tax_recoverable',
+ 'type': 'int'
+ },
+ {
+ 'name': 'item_price_uom_id_uom_id',
+ 'type': 'int'
+ },
+ {
+ 'name': 'item_price_uom_id_uom_name',
+ 'type': 'string'
+ },
+ {
+ 'name': 'item_price_uom_id_uom_descrip',
+ 'type': 'string'
+ },
+ {
+ 'name': 'item_price_uom_id_uom_item_weight',
+ 'type': 'int'
+ },
+ {
+ 'name': 'item_inv_uom_id_uom_id',
+ 'type': 'int'
+ },
+ {
+ 'name': 'item_inv_uom_id_uom_name',
+ 'type': 'string'
+ },
+ {
+ 'name': 'item_inv_uom_id_uom_descrip',
+ 'type': 'string'
+ },
+ {
+ 'name': 'item_inv_uom_id_uom_item_weight',
+ 'type': 'int'
+ },
+ {
+ 'name': 'item_freightclass_id_freightclass_id',
+ 'type': 'int'
+ },
+ {
+ 'name': 'item_freightclass_id_freightclass_code',
+ 'type': 'string'
+ },
+ {
+ 'name': 'item_freightclass_id_freightclass_descrip',
+ 'type': 'string'
+ },
+ {
+ 'name': 'item_classcode_id_classcode_id',
+ 'type': 'int'
+ },
+ {
+ 'name': 'item_classcode_id_classcode_code',
+ 'type': 'string'
+ },
+ {
+ 'name': 'item_classcode_id_classcode_descrip',
+ 'type': 'string'
+ },
+ {
+ 'name': 'item_classcode_id_classcode_mfg',
+ 'type': 'int'
+ },
+ {
+ 'name': 'item_classcode_id_classcode_creator',
+ 'type': 'string'
+ },
+ {
+ 'name': 'item_classcode_id_classcode_created',
+ 'type': 'date'
+ },
+ {
+ 'name': 'item_classcode_id_classcode_modifier',
+ 'type': 'string'
+ },
+ {
+ 'name': 'item_classcode_id_classcode_modified',
+ 'type': 'date'
+ },
+ {
+ 'name': 'item_classcode_id_classcode_type',
+ 'type': 'string'
+ }
+ ],
+ id : 'id',
+ root : 'data',
+ totalProperty : 'total',
+ xns : Roo.data,
+ '|xns' : 'Roo.data',
+ xtype : 'JsonReader'
+ }
+ },
+ colModel : [
+ {
+ dataIndex : 'item_image_id',
+ header : _this._strings['be53a0541a6d36f6ecb879fa2c584b08'] /* Image */,
+ renderer : function(v,x,r) { return String.format('<img src="{0}/Images/Thumb/50/{1}/{2}" height="50">', baseURL, v, r.data.item_image_filename); },
+ sortable : false,
+ width : 150,
+ xns : Roo.grid,
+ '|xns' : 'Roo.grid',
+ xtype : 'ColumnModel'
+ },
+ {
+ dataIndex : 'item_char_brand',
+ header : _this._strings['1be6f9eb563f3bf85c78b4219bf09de9'] /* Brand */,
+ renderer : function(v) { return String.format('{0}', v); },
+ sortable : true,
+ width : 100,
+ xns : Roo.grid,
+ '|xns' : 'Roo.grid',
+ xtype : 'ColumnModel',
+ editor : {
+ xns : Roo.grid,
+ '|xns' : 'Roo.grid',
+ xtype : 'GridEditor',
+ field : {
+ allowBlank : true,
+ alwaysQuery : true,
+ displayField : 'charass_value',
+ editable : true,
+ forceSelection : false,
+ listWidth : 300,
+ loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
+ minChars : 2,
+ pageSize : 20,
+ qtip : _this._strings['a9e35d03ee7f31f5bb199379a6d3547a'] /* Select Brand */,
+ queryParam : 'query[charass_value]',
+ selectOnFocus : true,
+ tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{charass_value}</b> </div>',
+ triggerAction : 'all',
+ width : 150,
+ xns : Roo.form,
+ '|xns' : 'Roo.form',
+ xtype : 'ComboBox',
+ store : {
+ remoteSort : true,
+ sortInfo : { field : 'charass_value' , direction : 'ASC' },
+ xns : Roo.data,
+ '|xns' : 'Roo.data',
+ xtype : 'Store',
+ listeners : {
+ beforeload : function (_self, o)
+ {
+ o.params = o.params || {};
+ // staff can see all logs, other companies can only see their own.
+ // look for all of the charass 's with the same type= eg. brand.
+
+ o.params.charass_char_id_char_name = 'BRAND';
+ o.params.charass_target_type ='I';
+ o.params._distinct = 'charass_value';
+ o.params._columns = 'charass_value';
+
+ }
+ },
+ proxy : {
+ method : 'GET',
+ url : baseURL + '/Roo/Charass.php',
+ xns : Roo.data,
+ '|xns' : 'Roo.data',
+ xtype : 'HttpProxy'
+ },
+ reader : {
+ fields : [
+ {
+ 'name': 'id',
+ 'type': 'int'
+ },
+ {
+ 'name': 'person_name',
+ 'type': 'string'
+ },
+ {
+ 'name': 'event_when',
+ 'type': 'date',
+ 'dateFormat': 'Y-m-d'
+ },
+ {
+ 'name': 'action',
+ 'type': 'string'
+ },
+ {
+ 'name': 'ipaddr',
+ 'type': 'string'
+ },
+ {
+ 'name': 'on_id',
+ 'type': 'int'
+ },
+ {
+ 'name': 'on_table',
+ 'type': 'string'
+ },
+ {
+ 'name': 'person_id',
+ 'type': 'int'
+ },
+ {
+ 'name': 'remarks',
+ 'type': 'string'
+ },
+ {
+ 'name': 'person_id_id',
+ 'type': 'int'
+ },
+ {
+ 'name': 'person_id_office_id',
+ 'type': 'int'
+ },
+ {
+ 'name': 'person_id_name',
+ 'type': 'string'
+ },
+ {
+ 'name': 'person_id_phone',
+ 'type': 'string'
+ },
+ {
+ 'name': 'person_id_fax',
+ 'type': 'string'
+ },
+ {
+ 'name': 'person_id_email',
+ 'type': 'string'
+ },
+ {
+ 'name': 'person_id_company_id',
+ 'type': 'int'
+ },
+ {
+ 'name': 'person_id_role',
+ 'type': 'string'
+ },
+ {
+ 'name': 'person_id_active',
+ 'type': 'int'
+ },
+ {
+ 'name': 'person_id_remarks',
+ 'type': 'string'
+ },
+ {
+ 'name': 'person_id_passwd',
+ 'type': 'string'
+ },
+ {
+ 'name': 'person_id_owner_id',
+ 'type': 'int'
+ },
+ {
+ 'name': 'person_id_lang',
+ 'type': 'string'
+ },
+ {
+ 'name': 'person_id_no_reset_sent',
+ 'type': 'int'
+ },
+ {
+ 'name': 'person_id_action_type',
+ 'type': 'string'
+ },
+ {
+ 'name': 'person_id_project_id',
+ 'type': 'int'
+ },
+ {
+ 'name': 'person_id_deleted_by',
+ 'type': 'int'
+ },
+ {
+ 'name': 'person_id_deleted_dt',
+ 'type': 'date'
+ }
+ ],
+ id : 'id',
+ root : 'data',
+ totalProperty : 'total',
+ xns : Roo.data,
+ '|xns' : 'Roo.data',
+ xtype : 'JsonReader'
+ }
+ }
+ }
+ }
+ },
+ {
+ dataIndex : 'item_char_productgroup',
+ header : _this._strings['c6ca371871d835c79c8654b5cd788cc7'] /* Product Group */,
+ renderer : function(v) { return String.format('{0}', v); },
+ sortable : true,
+ width : 100,
+ xns : Roo.grid,
+ '|xns' : 'Roo.grid',
+ xtype : 'ColumnModel',
+ editor : {
+ xns : Roo.grid,
+ '|xns' : 'Roo.grid',
+ xtype : 'GridEditor',
+ field : {
+ allowBlank : true,
+ alwaysQuery : true,
+ displayField : 'charass_value',
+ editable : true,
+ forceSelection : false,
+ listWidth : 300,
+ loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
+ minChars : 2,
+ pageSize : 20,
+ qtip : _this._strings['a9e35d03ee7f31f5bb199379a6d3547a'] /* Select Brand */,
+ queryParam : 'query[charass_value]',
+ selectOnFocus : true,
+ tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{charass_value}</b> </div>',
+ triggerAction : 'all',
+ width : 150,
+ xns : Roo.form,
+ '|xns' : 'Roo.form',
+ xtype : 'ComboBox',
+ store : {
+ remoteSort : true,
+ sortInfo : { field : 'charass_value' , direction : 'ASC' },
+ xns : Roo.data,
+ '|xns' : 'Roo.data',
+ xtype : 'Store',
+ listeners : {
+ beforeload : function (_self, o)
+ {
+ o.params = o.params || {};
+ // staff can see all logs, other companies can only see their own.
+ // look for all of the charass 's with the same type= eg. brand.
+
+ o.params.charass_char_id_char_name = 'PRODUCTGROUP';
+ o.params.charass_target_type ='I';
+ o.params._distinct = 'charass_value';
+ o.params._columns = 'charass_value';
+ }
+ },
+ proxy : {
+ method : 'GET',
+ url : baseURL + '/Roo/Charass.php',
+ xns : Roo.data,
+ '|xns' : 'Roo.data',
+ xtype : 'HttpProxy'
+ },
+ reader : {
+ fields : [
+ {
+ 'name': 'id',
+ 'type': 'int'
+ },
+ {
+ 'name': 'person_name',
+ 'type': 'string'
+ },
+ {
+ 'name': 'event_when',
+ 'type': 'date',
+ 'dateFormat': 'Y-m-d'
+ },
+ {
+ 'name': 'action',
+ 'type': 'string'
+ },
+ {
+ 'name': 'ipaddr',
+ 'type': 'string'
+ },
+ {
+ 'name': 'on_id',
+ 'type': 'int'
+ },
+ {
+ 'name': 'on_table',
+ 'type': 'string'
+ },
+ {
+ 'name': 'person_id',
+ 'type': 'int'
+ },
+ {
+ 'name': 'remarks',
+ 'type': 'string'
+ },
+ {
+ 'name': 'person_id_id',
+ 'type': 'int'
+ },
+ {
+ 'name': 'person_id_office_id',
+ 'type': 'int'
+ },
+ {
+ 'name': 'person_id_name',
+ 'type': 'string'
+ },
+ {
+ 'name': 'person_id_phone',
+ 'type': 'string'
+ },
+ {
+ 'name': 'person_id_fax',
+ 'type': 'string'
+ },
+ {
+ 'name': 'person_id_email',
+ 'type': 'string'
+ },
+ {
+ 'name': 'person_id_company_id',
+ 'type': 'int'
+ },
+ {
+ 'name': 'person_id_role',
+ 'type': 'string'
+ },
+ {
+ 'name': 'person_id_active',
+ 'type': 'int'
+ },
+ {
+ 'name': 'person_id_remarks',
+ 'type': 'string'
+ },
+ {
+ 'name': 'person_id_passwd',
+ 'type': 'string'
+ },
+ {
+ 'name': 'person_id_owner_id',
+ 'type': 'int'
+ },
+ {
+ 'name': 'person_id_lang',
+ 'type': 'string'
+ },
+ {
+ 'name': 'person_id_no_reset_sent',
+ 'type': 'int'
+ },
+ {
+ 'name': 'person_id_action_type',
+ 'type': 'string'
+ },
+ {
+ 'name': 'person_id_project_id',
+ 'type': 'int'
+ },
+ {
+ 'name': 'person_id_deleted_by',
+ 'type': 'int'
+ },
+ {
+ 'name': 'person_id_deleted_dt',
+ 'type': 'date'
+ }
+ ],
+ id : 'id',
+ root : 'data',
+ totalProperty : 'total',
+ xns : Roo.data,
+ '|xns' : 'Roo.data',
+ xtype : 'JsonReader'
}
- };
- }
+ }
+ }
+ }
+ },
+ {
+ dataIndex : 'item_number',
+ header : _this._strings['b2ee912b91d69b435159c7c3f6df7f5f'] /* Number */,
+ renderer : function(v) { return String.format('<B>{0}</B>', v); },
+ sortable : true,
+ width : 100,
+ xns : Roo.grid,
+ '|xns' : 'Roo.grid',
+ xtype : 'ColumnModel'
+ },
+ {
+ dataIndex : 'item_char_pickface_location',
+ header : _this._strings['d8ab3576a67fe0cc175ee77d57d0fd85'] /* Pickface */,
+ renderer : function(v) { return String.format('{0}', v); },
+ sortable : true,
+ width : 100,
+ xns : Roo.grid,
+ '|xns' : 'Roo.grid',
+ xtype : 'ColumnModel',
+ editor : {
+ xns : Roo.grid,
+ '|xns' : 'Roo.grid',
+ xtype : 'GridEditor',
+ field : {
+ xns : Roo.form,
+ '|xns' : 'Roo.form',
+ xtype : 'TextField'
+ }
+ }
+ },
+ {
+ dataIndex : 'item_char_pallet_location',
+ header : _this._strings['fe78f3efbfa84d8485d589031596c5b8'] /* Pallet */,
+ renderer : function(v) { return String.format('{0}', v); },
+ sortable : true,
+ width : 100,
+ xns : Roo.grid,
+ '|xns' : 'Roo.grid',
+ xtype : 'ColumnModel',
+ editor : {
+ xns : Roo.grid,
+ '|xns' : 'Roo.grid',
+ xtype : 'GridEditor',
+ field : {
+ xns : Roo.form,
+ '|xns' : 'Roo.form',
+ xtype : 'TextField'
+ }
+ }
+ },
+ {
+ dataIndex : 'item_descrip1',
+ header : _this._strings['b5a7adde1af5c87d7fd797b6245c2a39'] /* Description */,
+ renderer : function(v) { return String.format('{0}', v); },
+ sortable : true,
+ width : 200,
+ xns : Roo.grid,
+ '|xns' : 'Roo.grid',
+ xtype : 'ColumnModel'
+ },
+ {
+ dataIndex : 'itemsrc_active',
+ header : _this._strings['ce4ee01637f4279d02d0f232459dc9a4'] /* Purchased */,
+ renderer : function(v) {
+ var state = v * 1 > 0 ? '-checked' : '';
+
+ return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
+
+ },
+ sortable : true,
+ width : 55,
+ xns : Roo.grid,
+ '|xns' : 'Roo.grid',
+ xtype : 'ColumnModel'
+ },
+ {
+ dataIndex : 'item_sold',
+ header : _this._strings['41e902bb1b2db625736ede3bacc41fe0'] /* is Sold? */,
+ renderer : function(v) {
+ var state = v * 1 > 0 ? '-checked' : '';
+
+ return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
+
+ },
+ sortable : true,
+ width : 50,
+ xns : Roo.grid,
+ '|xns' : 'Roo.grid',
+ xtype : 'ColumnModel'
+ },
+ {
+ dataIndex : 'item_active',
+ header : _this._strings['68f43fdcf074903d65da764642a4b968'] /* is Active? */,
+ renderer : function(v) {
+ var state = v * 1 > 0 ? '-checked' : '';
+
+ return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
+
+ },
+ sortable : true,
+ width : 50,
+ xns : Roo.grid,
+ '|xns' : 'Roo.grid',
+ xtype : 'ColumnModel'
+ },
+ {
+ align : 'right',
+ dataIndex : 'last_purchase_price',
+ header : _this._strings['750587d31c68779e7f615c190a9dc23f'] /* Last purchase price */,
+ renderer : function(v,x,r) {
+
+ return String.format('{0}{1}', r.data.last_purchase_price_curr_name, Roo.util.Format.number(v,2)) ;
+
+ },
+ width : 120,
+ xns : Roo.grid,
+ '|xns' : 'Roo.grid',
+ xtype : 'ColumnModel'
+ },
+ {
+ dataIndex : 'item_prodcat_id_prodcat_code',
+ header : _this._strings['89217b1527e14cced20e78111a8f5027'] /* Item prodcat */,
+ renderer : function(v,x,r) {
+ return String.format('{0}/{1}', r.data.item_type, v);
+ },
+ width : 100,
+ xns : Roo.grid,
+ '|xns' : 'Roo.grid',
+ xtype : 'ColumnModel'
+ },
+ {
+ align : 'right',
+ dataIndex : 'item_actcost',
+ header : _this._strings['20b4f77bd00b4f63a49ec8e08f3bf6a6'] /* Cost */,
+ renderer : function(v,x,r) {
+
+ return String.format('{0}{1}', r.data.item_curr_name, Roo.util.Format.number(v,2)) ;
+
+ },
+ width : 75,
+ xns : Roo.grid,
+ '|xns' : 'Roo.grid',
+ xtype : 'ColumnModel'
+ },
+ {
+ align : 'right',
+ dataIndex : 'item_base_cost',
+ header : _this._strings['35be52be39d3efcd0cd2b3721fc3c298'] /* Cost (base) */,
+ renderer : function(v,x,r) {
+
+ return String.format('{0}{1}', r.data.item_base_curr, Roo.util.Format.number(v,2)) ;
+
+ },
+ width : 75,
+ xns : Roo.grid,
+ '|xns' : 'Roo.grid',
+ xtype : 'ColumnModel'
+ },
+ {
+ align : 'right',
+ dataIndex : 'item_stock_balance',
+ header : _this._strings['99a808d8d16122d70e44bd7f709d30fb'] /* Balance */,
+ renderer : function(v) { return String.format('{0}', v ? parseInt( v) : ''); },
+ width : 100,
+ xns : Roo.grid,
+ '|xns' : 'Roo.grid',
+ xtype : 'ColumnModel'
+ }
+ ]
+ }
+ },
+ {
+ background : true,
+ fitContainer : true,
+ fitToframe : true,
+ region : 'east',
+ tableName : 'itemloc',
+ title : _this._strings['759d259249621c817551c5fe726d5c57'] /* itemloc */,
+ xns : Roo,
+ '|xns' : 'Roo',
+ xtype : 'GridPanel',
+ listeners : {
+ activate : function() {
+ _this.locpanel = this;
+
+ }
+ },
+ grid : {
+ autoExpandColumn : 'location_name',
+ loadMask : true,
+ xns : Roo.grid,
+ '|xns' : 'Roo.grid',
+ xtype : 'Grid',
+ listeners : {
+ render : function()
+ {
+ _this.locgrid = this;
+ //_this.dialog = Pman.Dialog.FILL_IN
+
+ },
+ rowdblclick : function (_self, rowIndex, e)
+ {
+ if (!_this.dialog) return;
+ _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {
+ _this.grid.footer.onClick('first');
+ });
+ }
+ },
+ footer : {
+ displayInfo : true,
+ displayMsg : _this._strings['19029645d5286771ac708d1bcd118bf4'] /* Displaying itemloc{0} - {1} of {2} */,
+ emptyMsg : _this._strings['2cfd827c6e37453fe1ddde82a5bd9474'] /* No itemloc found */,
+ pageSize : 25,
+ xns : Roo,
+ '|xns' : 'Roo',
+ xtype : 'PagingToolbar'
+ },
+ dataSource : {
+ remoteSort : true,
+ sortInfo : { field : 'location_name', direction: 'ASC' },
+ xns : Roo.data,
+ '|xns' : 'Roo.data',
+ xtype : 'Store',
+ listeners : {
+ beforeload : function (_self, o)
+ {
+ var sel = _this.grid.selModel.getSelectedCell();
+ if (!sel) {
+ this.removeAll();
+ return false;
+ }
+ var rec = _this.grid.ds.getAt(sel[0]);
+ o.params._stock_for_item_id = rec.data.item_id;
+ //o.params['!itemloc_qty'] = 0;
+
+
+ }
+ },
+ proxy : {
+ method : 'GET',
+ url : baseURL + '/Roo/location.php',
+ xns : Roo.data,
+ '|xns' : 'Roo.data',
+ xtype : 'HttpProxy'
+ },
+ reader : {
+ fields : [
+ {
+ 'name': 'itemloc_id',
+ 'type': 'int'
+ },
+ {
+ 'name': 'itemloc_itemsite_id',
+ 'type': 'int'
+ },
+ {
+ 'name': 'itemloc_location_id',
+ 'type': 'int'
+ },
+ {
+ 'name': 'itemloc_qty',
+ 'type': 'float'
+ },
+ {
+ 'name': 'itemloc_expiration',
+ 'type': 'date',
+ 'dateFormat': 'Y-m-d'
+ },
+ {
+ 'name': 'itemloc_consolflag',
+ 'type': 'int'
+ },
+ {
+ 'name': 'itemloc_ls_id',
+ 'type': 'int'
+ },
+ {
+ 'name': 'itemloc_warrpurc',
+ 'type': 'date',
+ 'dateFormat': 'Y-m-d'
+ }
+ ],
+ id : 'id',
+ root : 'data',
+ totalProperty : 'total',
+ xns : Roo.data,
+ '|xns' : 'Roo.data',
+ xtype : 'JsonReader'
+ }
+ },
+ colModel : [
+ {
+ dataIndex : 'location_name',
+ header : _this._strings['ce5bf551379459c1c61d2a204061c455'] /* Location */,
+ renderer : function(v) { return String.format('{0}', v); },
+ width : 75,
+ xns : Roo.grid,
+ '|xns' : 'Roo.grid',
+ xtype : 'ColumnModel'
+ },
+ {
+ dataIndex : 'itemloc_realqty',
+ header : _this._strings['156567f65fc207d39cadbf045687c521'] /* Itemloc qty */,
+ renderer : function(v) { return String.format('{0}', v*1 ? (v*1).toFixed(0) : ''); },
+ width : 75,
+ xns : Roo.grid,
+ '|xns' : 'Roo.grid',
+ xtype : 'ColumnModel'
+ }
+ ]
+ }
+ }
+ ]
+ }
+ }; }
});