_this.saveBtn.show();
_this.form.findField('pohead_agent_username').setValue(Pman.Login.authUser.name);
_this.form.findField('pohead_orderdate').setValue(new Date());
+ _this.form.findField('pohead_bg_arrival_est_day').setValue(new Date());
+ _this.form.findField('pohead_bg_available_est_day').setValue(new Date());
+ _this.form.findField('pohead_bg_available_latest_day').setValue(new Date());
return;
}
_this.dialog.setTitle("Edit Purchase Order");
return;
}
if (action.type == 'load') {
+ _this.dontClose = false;
if(_this.data.office){
_this.uploadBtn.disabled = true;
}
var cid = this.findField('pohead_id').getValue()*1;
- if (cid) {
+ if (cid && !_this.dontClose) {
_this.dialog.hide();
return;
}
Roo.log(action);
+ _this.dontClose = false;
_this.data.pohead_id = action.result.data.pohead_id;
this.fireEvent('actioncomplete', this, {
type: 'setdata',
o.params = o.params || {};
// set more here
o.params.location_netable = 1;
+ o.params._viewType = 'local';
}
},
remoteSort : true,
}
},
remoteSort : true,
- sortInfo : { direction : 'ASC', field: 'terms_id' },
+ sortInfo : { direction : 'ASC', field: 'terms_descrip' },
proxy : {
xtype: 'HttpProxy',
xns: Roo.data,
if (_this.grid) {
_this.grid.footer.onClick('first');
}
+ },
+ deactivate : function (_self)
+ {
+ if(_this.grid){
+ var ar = [];
+
+ _this.grid.ds.each(function(r) {
+ ar.push({
+ poitem_id : r.data.poitem_id,
+ poitem_itemsite_id : r.data.poitem_itemsite_id,
+ poitem_unitprice : r.data.poitem_unitprice,
+ poitem_qty_ordered : r.data.poitem_qty_ordered
+ });
+
+ });
+
+ _this.form.findField('items').setValue(JSON.stringify(ar));
+ }
+ _this.dontClose = true;
+ _this.form.doAction("submit");
+
}
},
background : true,
},
beforeedit : function (e)
{
- var r = e.record.data.is_receipted * 1;
+ var r = e.record.data.poitem_qty_received * 1;
if(r > 0){
Roo.MessageBox.alert("Error", "This item has been receipted");
o.params.poitem_pohead_id = hid;
o.params._with_item = 1;
- o.params.is_receipted = 1;
o.params._roo_office = _this.data.office ? _this.data.office : baseURL.split('/').pop().substr(0,2);
},
Roo.MessageBox.alert("Error", "Select a cell");
return;
}
- _this.grid.stopEditing()
+ _this.grid.stopEditing();
var r = _this.grid.ds.getAt(cs[0]);
- if(r.data.is_receipted * 1 > 0){
+ if(r.data.poitem_qty_received * 1 > 0){
Roo.MessageBox.alert("Error", "This item has been receipted");
return;
}
qtip : "Select item",
queryParam : 'query[number]',
selectOnFocus : true,
- 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>',
+ tpl : '<div class="x-grid-cell-text x-btn button"><b>{itemsite_item_id_item_number}</b> - {itemsite_item_id_item_descrip1} </div>',
triggerAction : 'all',
typeAhead : false,
valueField : 'item_number',
field : {
xtype: 'NumberField',
xns: Roo.form,
+ allowBlank : false,
allowDecimals : false,
decimalPrecision : 0,
minValue : 1,
o.params._with_item = 1;
+ },
+ load : function (_self, records, options)
+ {
+ _this.gltransgrid.footer.onClick('first');
}
},
remoteSort : true,
width : 50,
renderer : function(v,x,r)
{
+
+
+ var recv = (v- r.data.poitem_qty_returned);
+ if (recv != r.data.tx_qty) {
+ return String.format('<s style="color:red;font-weight:bold">{0}</s>{1} ', recv,
+ (r.data.tx_qty *1).toFixed(0) ) ;
+ }
return String.format('{0}', (v- r.data.poitem_qty_returned)) ;
}
var s = _this.itemgrid.getSelectionModel().getSelected();
if(!s){
- Roo.MessageBox.alert('Error', 'Please select a item');
+ this.removeAll();
return false;
}
{
xtype: 'Button',
xns: Roo.Toolbar,
- listeners : {
- click : function()
- {
- var pohead_number = _this.form.findField('pohead_number').getValue();
- var pohead_id = _this.form.findField('pohead_id').getValue();
-
- var addv = function(){
- new Pman.Request({
- url : baseURL + '/Roo/pohead.php',
- method :'POST',
- params : {
- pohead_id : pohead_id,
- _variance : 1
+ text : "Apply fixes",
+ menu : {
+ xtype: 'Menu',
+ xns: Roo.menu,
+ items : [
+ {
+ xtype: 'Item',
+ xns: Roo.menu,
+ listeners : {
+ click : function()
+ {
+ var pohead_number = _this.form.findField('pohead_number').getValue();
+ var pohead_id = _this.form.findField('pohead_id').getValue();
+
+
+ new Pman.Request({
+ url : baseURL + '/Roo/pohead.php',
+ mask : 'sending',
+ method :'POST',
+ params : {
+ pohead_id : pohead_id,
+ _recv_fix : 1
+
+ },
+ success : function(res) {
+ Roo.MessageBox.alert('Notice', 'DONE');
+ }
+ });
+
+
+
+
- },
- success : function(res) {
- Roo.MessageBox.alert('Notice', 'DONE');
}
- });
- }
-
- Roo.MessageBox.confirm(
- "Confirm",
- "Are you sure to add all the variance for " + pohead_number + " ?",
- function(r) {
- if (r != 'yes') {
- return;
+ },
+ cls : 'x-btn-text-icon',
+ text : "Repost goods reciept",
+ icon : rootURL + '/Pman/templates/images/trash.gif'
+ },
+ {
+ xtype: 'Separator',
+ xns: Roo.menu
+ },
+ {
+ xtype: 'Item',
+ xns: Roo.menu,
+ listeners : {
+ click : function()
+ {
+ var pohead_number = _this.form.findField('pohead_number').getValue();
+ var pohead_id = _this.form.findField('pohead_id').getValue();
+
+ var fixit = function(){
+ new Pman.Request({
+ url : baseURL + '/Roo/pohead.php',
+ method :'POST',
+ params : {
+ pohead_id : pohead_id,
+ _unitcost : 1
+
+ },
+ success : function(res) {
+ Roo.MessageBox.alert('Notice', 'DONE');
+ }
+ });
+ }
+
+ Roo.MessageBox.confirm(
+ "Confirm",
+ "Are you sure to fix the unit cost of " + pohead_number + " ?",
+ function(r) {
+ if (r != 'yes') {
+ return;
+ }
+
+ fixit();
+ return;
+ }
+ );
+
+
}
-
- addv();
- return;
- }
- );
-
-
- }
- },
- cls : 'x-btn-text-icon',
- text : "Add All Variance",
- icon : Roo.rootURL + 'images/default/tree/leaf.gif'
- },
- {
- xtype: 'Button',
- xns: Roo.Toolbar,
- listeners : {
- click : function()
- {
- var s = _this.gltransgrid.getSelectionModel().getSelected();
-
- if(!s){
- Roo.MessageBox.alert('Error','Please select a transaction');
- return;
- }
-
- if(s.data.gltrans_misc_id == -1){
- Roo.MessageBox.alert('Error','Please select a transaction not variance');
- return;
- }
-
- var addit = function(){
- new Pman.Request({
- url : baseURL + '/Roo/Gltrans.php',
- method :'POST',
- params : {
- gltrans_id : s.data.gltrans_id,
- _variance : 1
+ },
+ cls : 'x-btn-text-icon',
+ text : "Fix Unit Cost",
+ icon : rootURL + '/Pman/templates/images/trash.gif'
+ },
+ {
+ xtype: 'Separator',
+ xns: Roo.menu
+ },
+ {
+ xtype: 'Item',
+ xns: Roo.menu,
+ listeners : {
+ click : function()
+ {
+ var pohead_number = _this.form.findField('pohead_number').getValue();
+ var pohead_id = _this.form.findField('pohead_id').getValue();
+
+ var addv = function(){
+ new Pman.Request({
+ url : baseURL + '/Roo/pohead.php',
+ method :'POST',
+ params : {
+ pohead_id : pohead_id,
+ _variance : 1
+
+ },
+ success : function(res) {
+ Roo.MessageBox.alert('Notice', 'DONE');
+ }
+ });
+ }
- },
- success : function(res) {
- if(res.data == 0){
- Roo.MessageBox.alert('Error','Variance already exist');
+ Roo.MessageBox.confirm(
+ "Confirm",
+ "Are you sure to add all the variance for " + pohead_number + " ?",
+ function(r) {
+ if (r != 'yes') {
+ return;
+ }
+
+ addv();
+ return;
+ }
+ );
+
+
+ }
+ },
+ cls : 'x-btn-text-icon',
+ text : "Add All Variance",
+ icon : Roo.rootURL + 'images/default/tree/leaf.gif'
+ },
+ {
+ xtype: 'Item',
+ xns: Roo.menu,
+ listeners : {
+ click : function()
+ {
+ var s = _this.gltransgrid.getSelectionModel().getSelected();
+
+ if(!s){
+ Roo.MessageBox.alert('Error','Please select a transaction');
+ return;
+ }
+
+ if(s.data.gltrans_misc_id != -1){
+ Roo.MessageBox.alert('Error','Just allow to delete the variance');
+ return;
+ }
+
+ var delit = function(){
+ new Pman.Request({
+ url : baseURL + '/Roo/Gltrans.php',
+ method :'POST',
+ params : {
+ gltrans_id : s.data.gltrans_id,
+ _del : 1
+
+ },
+ success : function(res) {
+ _this.gltransgrid.footer.onClick('refresh');
+
+ }
+ });
}
- _this.gltransgrid.footer.onClick('refresh');
+
+ Roo.MessageBox.confirm(
+ "Confirm",
+ "Are you sure to delete ?",
+ function(r) {
+ if (r != 'yes') {
+ return;
+ }
+
+ delit();
+ return;
+ }
+ );
+
}
- });
- }
-
- Roo.MessageBox.confirm(
- "Confirm",
- "Are you sure to add a variance ?",
- function(r) {
- if (r != 'yes') {
- return;
+ },
+ cls : 'x-btn-text-icon',
+ text : "Delete Variance",
+ icon : rootURL + '/Pman/templates/images/trash.gif'
+ },
+ {
+ xtype: 'Item',
+ xns: Roo.menu,
+ listeners : {
+ click : function()
+ {
+ var pohead_number = _this.form.findField('pohead_number').getValue();
+ var pohead_id = _this.form.findField('pohead_id').getValue();
+
+ var delv = function(){
+ new Pman.Request({
+ url : baseURL + '/Roo/pohead.php',
+ method :'POST',
+ params : {
+ pohead_id : pohead_id,
+ _del : 1
+
+ },
+ success : function(res) {
+ Roo.MessageBox.alert('Notice', 'DONE');
+ }
+ });
+ }
+
+ Roo.MessageBox.confirm(
+ "Confirm",
+ "Are you sure to delete the variance on voucher of " + pohead_number + " ?",
+ function(r) {
+ if (r != 'yes') {
+ return;
+ }
+
+ delv();
+ return;
+ }
+ );
+
+
}
-
- addit();
- return;
- }
- );
-
-
- }
- },
- cls : 'x-btn-text-icon',
- text : "Add Variance",
- icon : Roo.rootURL + 'images/default/tree/leaf.gif'
- },
- {
- xtype: 'Button',
- xns: Roo.Toolbar,
- listeners : {
- click : function()
- {
- var s = _this.gltransgrid.getSelectionModel().getSelected();
-
- if(!s){
- Roo.MessageBox.alert('Error','Please select a transaction');
- return;
- }
-
- if(s.data.gltrans_misc_id != -1){
- Roo.MessageBox.alert('Error','Just allow to delete the variance');
- return;
- }
-
- var delit = function(){
- new Pman.Request({
- url : baseURL + '/Roo/Gltrans.php',
- method :'POST',
- params : {
- gltrans_id : s.data.gltrans_id,
- _del : 1
+ },
+ cls : 'x-btn-text-icon',
+ text : "Delete Varinace on voucher",
+ icon : rootURL + '/Pman/templates/images/trash.gif'
+ },
+ {
+ xtype: 'Separator',
+ xns: Roo.menu
+ },
+ {
+ xtype: 'Item',
+ xns: Roo.menu,
+ listeners : {
+ click : function()
+ {
+ var pohead_number = _this.form.findField('pohead_number').getValue();
+ var pohead_id = _this.form.findField('pohead_id').getValue();
+
+ var addv = function(){
+ new Pman.Request({
+ url : baseURL + '/Roo/pohead.php',
+ method :'POST',
+ params : {
+ pohead_id : pohead_id,
+ _fix_voids : 1
+
+ },
+ success : function(res) {
+ Roo.MessageBox.alert('Notice', 'DONE');
+ }
+ });
+ }
+
+ Roo.MessageBox.confirm(
+ "Confirm",
+ "Are you sure to add all the fix the voids for " + pohead_number + " ?",
+ function(r) {
+ if (r != 'yes') {
+ return;
+ }
+
+ addv();
+ return;
+ }
+ );
- },
- success : function(res) {
- _this.gltransgrid.footer.onClick('refresh');
}
- });
+ },
+ cls : 'x-btn-text-icon',
+ text : "Recalculate voids",
+ icon : Roo.rootURL + 'images/default/tree/leaf.gif'
}
-
- Roo.MessageBox.confirm(
- "Confirm",
- "Are you sure to delete ?",
- function(r) {
- if (r != 'yes') {
- return;
- }
-
- delit();
- return;
- }
- );
-
-
- }
- },
- cls : 'x-btn-text-icon',
- text : "Delete Variance",
- icon : rootURL + '/Pman/templates/images/trash.gif'
+ ]
+ }
},
{
xtype: 'Button',
listeners : {
click : function()
{
- var pohead_number = _this.form.findField('pohead_number').getValue();
- var pohead_id = _this.form.findField('pohead_id').getValue();
-
- var fixit = function(){
- new Pman.Request({
- url : baseURL + '/Roo/pohead.php',
- method :'POST',
- params : {
- pohead_id : pohead_id,
- _unitcost : 1
-
- },
- success : function(res) {
- Roo.MessageBox.alert('Notice', 'DONE');
- }
- });
+ var s = _this.gltransgrid.selModel.getSelected();
+ if (!s) {
+ Roo.MessageBox.alert("Error", "Select an item to reverse");
+ return;
}
- Roo.MessageBox.confirm(
- "Confirm",
- "Are you sure to fix the unit cost of " + pohead_number + " ?",
- function(r) {
- if (r != 'yes') {
- return;
- }
-
- fixit();
- return;
- }
- );
-
-
- }
- },
- cls : 'x-btn-text-icon',
- text : "Fix Unit Cost",
- icon : rootURL + '/Pman/templates/images/trash.gif'
- },
- {
- xtype: 'Button',
- xns: Roo.Toolbar,
- listeners : {
- click : function()
- {
- var pohead_number = _this.form.findField('pohead_number').getValue();
- var pohead_id = _this.form.findField('pohead_id').getValue();
-
- var delv = function(){
+ var fixit = function(){
new Pman.Request({
- url : baseURL + '/Roo/pohead.php',
+ url : baseURL + '/Roo/invdetail.php',
method :'POST',
params : {
- pohead_id : pohead_id,
- _del : 1
-
+
+ _reverse : s.data.invdetail_id
},
success : function(res) {
Roo.MessageBox.alert('Notice', 'DONE');
Roo.MessageBox.confirm(
"Confirm",
- "Are you sure to delete the variance on voucher of " + pohead_number + " ?",
+ "Are you sure to reverse that line",
function(r) {
if (r != 'yes') {
return;
}
- delv();
+ fixit();
return;
}
);
}
},
cls : 'x-btn-text-icon',
- text : "Delete Varinace on voucher",
+ text : "Reverse",
icon : rootURL + '/Pman/templates/images/trash.gif'
}
]
{
xtype: 'ColumnModel',
xns: Roo.grid,
+ align : 'right',
+ dataIndex : 'location_name',
+ header : 'Location',
+ width : 60,
+ renderer : function(v,x,r) {
+
+
+ return String.format('{0}', v);
+
+ }
+ },
+ {
+ xtype: 'ColumnModel',
+ xns: Roo.grid,
+ align : 'right',
dataIndex : 'gltrans_amount',
header : 'Amount',
width : 100,
- renderer : function(v) { return String.format('{0}', v); }
+ renderer : function(v,x,r) {
+ return String.format('{0}', v);
+
+ }
+ },
+ {
+ xtype: 'ColumnModel',
+ xns: Roo.grid,
+ align : 'right',
+ dataIndex : 'invdetail_qty',
+ header : 'Qty',
+ width : 60,
+ renderer : function(v,x,r) {
+ var f = r.data.invfifo_void * 1 ? '<s>{0}</s>' : '{0}';
+
+ return String.format(f, (v*1).toFixed(0));
+
+ }
},
{
xtype: 'ColumnModel',
return false;
}
o.params._split_sales = _this.glsalesbtn.pressed ? 1 : 0;
+ },
+ load : function (_self, records, options)
+ {
+ _this.gltxdgrid.footer.onClick('first');
}
},
remoteSort : true,
},
autoExpandColumn : 'gltrans_notes',
loadMask : true,
+ toolbar : {
+ xtype: 'Toolbar',
+ xns: Roo,
+ items : [
+ {
+ xtype: 'Button',
+ xns: Roo.Toolbar,
+ listeners : {
+ render : function (_self)
+ {
+ _this.glvoidshow = _self;
+ },
+ click : function (_self, e)
+ {
+ (function() { _this.gltxgrid.footer.onClick('first'); }).defer(100);
+ }
+ },
+ enableToggle : true,
+ pressed : true,
+ text : "Hide Void"
+ },
+ {
+ xtype: 'Fill',
+ xns: Roo.Toolbar
+ },
+ {
+ xtype: 'Button',
+ xns: Roo.Toolbar,
+ listeners : {
+ click : function (_self, e)
+ {
+ new Pman.Request( {
+ url : baseURL + '/Roo/Gltrans',
+ method : 'GET',
+ mask: 'sending',
+ params : {
+ pohead_id : _this.form.findField('pohead_id').getValue(),
+ _autovoid : 1
+ },
+ success : function() {
+ _this.gltxpanel.footer.onClick('first');
+ }
+
+
+ });
+ }
+ },
+ text : "AutoVoid"
+ }
+ ]
+ },
dataSource : {
xtype: 'Store',
xns: Roo.data,
}
},
text : "Download"
- },
- {
- xtype: 'Button',
- xns: Roo.Toolbar,
- listeners : {
- render : function (_self)
- {
- _this.glvoidshow = _self;
- },
- click : function (_self, e)
- {
- (function() { _this.gltxgrid.footer.onClick('first'); }).defer(100);
- }
- },
- enableToggle : true,
- pressed : true,
- text : "Hide Void"
}
]
},
header : 'Doc#',
width : 75,
renderer : function(v,x,r) {
+
+ var style = '';
+ if (r.data.gltrans_misc_id > 0 && (r.data.invdetail_id *1) < 1) {
+ style = ' style="color:red;font-weight:bold"';
+ }
if (r.data.gltrans_deleted) {
- return String.format('<s>{0}</s>', v);
+ return String.format('<s'+style+'>{0}</s>', v);
}
- return String.format('{0}', v);
+ return String.format('<span' + style + '>{0}</span>', v);
}
},
{
{
if(_this.grid){
var ar = [];
-
+ var err = false;
_this.grid.ds.each(function(r) {
+ if(r.data.poitem_unitprice < 1){
+ err = true;
+ return;
+ }
ar.push({
poitem_id : r.data.poitem_id,
poitem_itemsite_id : r.data.poitem_itemsite_id,
});
});
-
+
+ if(err){
+ Roo.MessageBox.alert('Error','Unit Price does not allow $0' );
+ return;
+ }
+
_this.form.findField('items').setValue(JSON.stringify(ar));
}