delRow.onControlClicked = function(row) {
var SortedIndices=[];
for (i=0;i<CellText.length;i++){ SortedIndices.push(i) }
obj.onHeaderClicked = function(event, index){
window.setTimeout(function(){
SortedIndices = obj.getRowIndices();
},30);
}
var startrow = obj.getSelectedRows();
if( Number(startrow)>-1){
for (i=SortedIndices.length-1;i>=0;i--){
if(SortedIndices[i] == startrow){ SortedIndices.splice(i, 1); break}
}
obj.setRowCount(obj.getRowCount()-1);
obj.setRowIndices(SortedIndices);
}
}
delRow.onControlClicked = function(row) {
if(obj.getSelectedRows()=='') {alert('WARNING! You must select a row to delete');return false;}
var insertindex=obj.getSelectedRows([0]);
if(obj.getCellValue(19,insertindex)=='true' || obj.getCellValue(21,insertindex)=='true' || obj.getCellValue(22,insertindex)=='true'){alert('WARNING! You can not delete a row that has been completed, backordered or invoiced'); return false;}
if(obj.getCellValue(19,insertindex)==true){alert('WARNING! You can not delete a row that has been completed, backordered or invoiced'); return false;}
if(obj.getCellValue(21,insertindex)==true){alert('WARNING! You can not delete a row that has been completed, backordered or invoiced'); return false;}
if(obj.getCellValue(22,insertindex)==true){alert('WARNING! You can not delete a row that has been completed, backordered or invoiced'); return false;}
var Row = 0;
var gridArray = new Array();
for(i=0;i<=obj.getRowCount();i++)
{
//alert(i+" "+insertindex);
if(i!=insertindex)
{
//alert('here');
gridArray[Row] = new Array();
gridArray[Row][1] = obj.getCellText(0,i);
gridArray[Row][2] = obj.getCellText(1,i);
gridArray[Row][3] = obj.getCellValue(2,i);
gridArray[Row][4] = obj.getCellValue(3,i);
gridArray[Row][5] = obj.getCellValue(4,i);
gridArray[Row][6] = obj.getCellText(5,i);
gridArray[Row][7] = obj.getCellText(6,i);
gridArray[Row][8] = obj.getCellText(7,i);
gridArray[Row][9] = obj.getCellText(20,i);
gridArray[Row][10] = obj.getCellText(24,i);
gridArray[Row][11] = obj.getCellValue(19,i);
gridArray[Row][12] = obj.getCellValue(21,i);
gridArray[Row][13] = obj.getCellValue(22,i);
Row++
}
}
//for(i=0;i<gridArray.length;i++) {
//document.write(gridArray[0][6]);
//}
//Script for the DocumentLoader Body Information
obj.setCellText([]);
obj.refresh();
var cellLen = gridArray.length -1;
for(i=0;i<=gridArray.length;i++) {
obj.setCellText(gridArray[i][1],0,i);//SKU
obj.setCellText(gridArray[i][2],1,i);//Line Description
obj.setCellText(gridArray[i][3],2,i);//Unit Price
obj.setCellValue(gridArray[i][3],2,i);//Unit Price
obj.setCellData(gridArray[i][3],2,i);//Unit Price
obj.setCellData(gridArray[i][4],3,i);//Qty
obj.setCellData(gridArray[i][5],4,i);//Discount
obj.setCellData(gridArray[i][6],5,i);//Line Nett
obj.setCellText(gridArray[i][7],6,i);//Centre
obj.setCellText(gridArray[i][8],7,i);//VAT
obj.setCellText(gridArray[i][9],20,i);//InStk
obj.setCellText(gridArray[i][10],24,i);//Location
obj.setCellValue(gridArray[i][11],19,i);//Complete
obj.setCellValue(gridArray[i][12],21,i);//Backorder
obj.setCellValue(gridArray[i][13],22,i);//Invoiced
if(gridArray[i][13]=='true'){for(x=0;x<30;x++){obj.setCellEditable(false, x, i);obj.getRowTemplate(i).setStyle("background","#81BEF7");}}
if(gridArray[i][11]=='true'){for(x=0;x<30;x++){obj.setCellEditable(false, x, i);}}
obj.setRowCount(cellLen);
obj.refresh();
obj.setSelectedRows([insertindex]);
obj.setCurrentRow(insertindex);
obj.setSelectedColumns([0]);
obj.setCurrentColumn(0);
try{obj.setSelectedRows([insertindex]);}catch(e){;}
gGirdId = obj.getId();
try{setTimeout("document.getElementById(gGirdId).focus();",500);}catch(e){;}
}
}
print.onControlClicked = function printReport() {
for(var i=0;i<obj.getRowCount();i++) {
var c1 = obj.getCellText(0, obj.getRowPosition(i) );
var c2 = obj.getCellText(1, obj.getRowPosition(i) );
var c3 = obj.getCellText(2, obj.getRowPosition(i) );
}
var a = new AW.HTTP.Request;
a.setParameter("C1", c1);
a.setParameter("C2", c2);
a.setParameter("C3", c3);
a.setURL("HTTPResponse.php");
a.setRequestMethod("POST");
a.request();
// pause(100); // pause removed if request out of loop
}
obj.deleteRow(obj.getCurrentRow());
var SortedIndices=[];
var delRow = new AW.UI.Button;
delRow.setStyle("width","60px");
delRow.setControlText("Delete");
delRow.setControlTooltip('<?Php print tooltip($_SESSION['Company'],1550,$linkPyramid); ?>');
delRow.onControlClicked = function(row) {
for (i=0;i<CellText.length;i++){ SortedIndices.push(i) }
obj.onHeaderClicked = function(event, index){
window.setTimeout(function(){
SortedIndices = obj.getRowIndices();
},30);
}
var startrow = obj.getSelectedRows();
if( Number(startrow)>-1){
for (i=SortedIndices.length-1;i>=0;i--){
if(SortedIndices[i] == startrow){ SortedIndices.splice(i, 1); break}
}
obj.setRowCount(obj.getRowCount()-1);
obj.setRowIndices(SortedIndices);
}
}
var SortedIndices=[];
for (i=0;i<obj.getRowCount();i++){ SortedIndices.push(i) }
obj.onHeaderClicked = function(event, index){
window.setTimeout(function(){
SortedIndices = obj.getRowIndices();
},30);
}
var delRow = new AW.UI.Button;
delRow.setStyle("width","60px");
delRow.setControlText("Delete");
// delRow.setControlTooltip('print tooltip($_SESSION['Company'],1550,$linkPyramid); ?>');
delRow.onControlClicked = function(row) {
var startrow = obj.getSelectedRows();
if( Number(startrow)>-1){
for (i=SortedIndices.length-1;i>=0;i--){
if(SortedIndices[i] == startrow){ SortedIndices.splice(i, 1); break}
}
obj.setRowCount(obj.getRowCount()-1);
obj.setRowIndices(SortedIndices);
}
}
This topic is archived.