how to i can add a filter the customer is be blocked ?
Please Help Me?
the customer be blocked:
following is the origin code:
Documentation()
#01 2008-11-03 Johnson: For James Jiang(for Scott.Kahn)
#02 2008-12-20 Johnson(Jessica): for FOLUK
#03 2009-02-13 Johnson: Add new field for Alan Johnson(UK)
#04 2009-06-06 Johnson: Add new field for Alan Johnson(UK)
Item - OnPreDataItem()
//IF NOT Exportxls THEN
//CurrReport.BREAK;
Window.OPEN(
STRSUBSTNO(Text000, TABLECAPTION) +
‘@1@@@@@@@@@@@@@@@@@@@@@’);
Window.UPDATE(1,0);
CLEAR(TempExcelBuffer);
Pointer := 0;
TotalRecNo := COUNT;
SheetNo := 0;
EnterCell(SheetNo,1,1,‘Available to Despatch’,TRUE,FALSE,FALSE,’’,0);
EnterCell(SheetNo,3,1,STRSUBSTNO(’<= %1’, EndDate),TRUE,FALSE,FALSE,’’,0);
RowNo := g_detailRow;
EnterCell(SheetNo, RowNo, g_detailCol+ 0, ‘Order Required Date <=%1 from Location %2.’,FALSE,FALSE,FALSE,’’,0);
RowNo += 1;
EnterCell(SheetNo, RowNo, g_detailCol+ 0, ‘Stock Location’,TRUE,FALSE,FALSE,’’,0);
EnterCell(SheetNo, RowNo, g_detailCol+ 1, ‘Order Date’,TRUE,FALSE,FALSE,’’,0);
EnterCell(SheetNo, RowNo, g_detailCol+ 2, ‘Order Type’,TRUE,FALSE,FALSE,’’,0);
EnterCell(SheetNo, RowNo, g_detailCol+ 3, ‘Order No.’,TRUE,FALSE,FALSE,’’,0);
EnterCell(SheetNo, RowNo, g_detailCol+ 4, ‘Customer Account’,TRUE,FALSE,FALSE,’’,0);
EnterCell(SheetNo, RowNo, g_detailCol+ 5, ‘Customer Name’,TRUE,FALSE,FALSE,’’,0);
EnterCell(SheetNo, RowNo, g_detailCol+ 6, ‘Delivery Address #1’,TRUE,FALSE,FALSE,’’,0);
EnterCell(SheetNo, RowNo, g_detailCol+ 7, ‘Required Date’,TRUE,FALSE,FALSE,’’,0);
EnterCell(SheetNo, RowNo, g_detailCol+ 8, ‘Product Code’,TRUE,FALSE,FALSE,’’,0);
EnterCell(SheetNo, RowNo, g_detailCol+ 9, ‘Product Description’,TRUE,FALSE,FALSE,’’,0);
EnterCell(SheetNo, RowNo, g_detailCol+10, ‘Q/S Qty.’,TRUE,FALSE,FALSE,’’,0);
EnterCell(SheetNo, RowNo, g_detailCol+11, ‘Total Stock’,TRUE,FALSE,FALSE,’’,0);
EnterCell(SheetNo, RowNo, g_detailCol+12, ‘To Send’,TRUE,FALSE,FALSE,’’,0);
EnterCell(SheetNo, RowNo, g_detailCol+13, ‘Shortage’,TRUE,FALSE,FALSE,’’,0);
EnterCell(SheetNo, RowNo, g_detailCol+14, ‘Line Cube’,TRUE,FALSE,FALSE,’’,0);
EnterCell(SheetNo, RowNo, g_detailCol+15, ‘Area’,TRUE,FALSE,FALSE,’’,0);
EnterCell(SheetNo, RowNo, g_detailCol+16, ‘Postcode’,TRUE,FALSE,FALSE,’’,0);
EnterCell(SheetNo, RowNo, g_detailCol+17, ‘Always set to 0’,TRUE,FALSE,FALSE,’’,0);
EnterCell(SheetNo, RowNo, g_detailCol+18, ‘Customer order number’,TRUE,FALSE,FALSE,’’,0);
EnterCell(SheetNo, RowNo, g_detailCol+19, ‘Line Price’,TRUE,FALSE,FALSE,’’,0);
EnterCell(SheetNo, RowNo, g_detailCol+20, ‘Line Amount’,TRUE,FALSE,FALSE,’’,0);
//#03 S
EnterCell(SheetNo, RowNo, g_detailCol+21, ‘Despatch Load Ref.’,TRUE,FALSE,FALSE,’’,0);
//#03 E
//#04 S
EnterCell(SheetNo, RowNo, g_detailCol+22, ‘Special Instructions’,TRUE,FALSE,FALSE,’’,0);
//#04 E
SETFILTER(“Location Filter”, g_Loc);
Item - OnAfterGetRecord()
Pointer += 1;
Window.UPDATE(1,ROUND(Pointer / TotalRecNo * 10000,1));
CALCFIELDS(“Inventory on Special Date”, “Qty. on Purch. Order”, “Qty. on Sales Order”);
IF (“Inventory on Special Date” = 0) AND (“Qty. on Purch. Order” = 0) AND (“Qty. on Sales Order” = 0) THEN
CurrReport.SKIP;
Snapshot.RESET;
Snapshot.DELETEALL;
SalesLine.SETRANGE(“Document Type”, SalesLine.“Document Type”::Order);
SalesLine.SETRANGE(Type, SalesLine.Type::Item);
SalesLine.SETRANGE(“No.”, “No.”);
SalesLine.SETFILTER(Quantity, ‘<>0’);
SalesLine.SETFILTER(“Location Code”, g_Loc);
SalesLine.SETFILTER(“Shipment Date”, ‘…%1’, EndDate);
IF SalesLine.FIND(’-’) THEN
REPEAT
IF ABS(SalesLine.Quantity) > ABS(SalesLine.“Quantity Shipped”) THEN
BEGIN
Snapshot.INIT;
Snapshot.“Analysis Type” := 2;
Snapshot.USERID := USERID;
Snapshot.“Document Type” := Snapshot.“Document Type”::Order;
Snapshot.“Document No.” := SalesLine.“Document No.”;
Snapshot.“Line No.” := SalesLine.“Line No.”;
Snapshot.Type := SalesLine.Type::Item;
Snapshot.“No.” := SalesLine.“No.”;
Snapshot.Quantity := SalesLine.Quantity;
Snapshot.“Shipment Date” := SalesLine.“Shipment Date”;
Snapshot.INSERT;
END;
UNTIL SalesLine.NEXT = 0;
g_Inv := “Inventory on Special Date” + “Qty. on Purch. Order”;
g_Bal := g_Inv;
Snapshot.SETCURRENTKEY(“Analysis Type”,USERID,“No.”,“Shipment Date”,“Document No.”);
IF Snapshot.FIND(’-’) THEN
REPEAT
RowNo += 1;
IF SalesHeader.GET(SalesHeader.“Document Type”::Order, Snapshot.“Document No.”) THEN
BEGIN
IF NOT SalesLine.GET(SalesHeader.“Document Type”, SalesHeader.“No.”, Snapshot.“Line No.”) THEN
SalesLine.INIT;
END ELSE BEGIN
SalesHeader.INIT;
SalesLine.INIT;
END;
EnterCell(SheetNo, RowNo, g_detailCol+ 0, SalesLine.“Location Code”,FALSE,FALSE,FALSE,’’,0);
EnterCell(SheetNo, RowNo, g_detailCol+ 1, FORMAT(SalesHeader.“Order Date”),FALSE,FALSE,FALSE,’’,0);
EnterCell(SheetNo, RowNo, g_detailCol+ 2, ‘O’,FALSE,FALSE,FALSE,’’,0);
EnterCell(SheetNo, RowNo, g_detailCol+ 3, SalesLine.“Document No.”,FALSE,FALSE,FALSE,’’,0);
EnterCell(SheetNo, RowNo, g_detailCol+ 4, SalesLine.“Sell-to Customer No.”,FALSE,FALSE,FALSE,’’,0);
EnterCell(SheetNo, RowNo, g_detailCol+ 5, SalesHeader.“Sell-to Customer Name”,FALSE,FALSE,FALSE,’’,0);
EnterCell(SheetNo, RowNo, g_detailCol+ 6, SalesHeader.“Ship-to Address” + ’ ’ + SalesHeader.“Ship-to Address 2”
,FALSE,FALSE,FALSE,’’,0);
EnterCell(SheetNo, RowNo, g_detailCol+ 7, FORMAT(SalesHeader.“Shipment Date”),FALSE,FALSE,FALSE,’’,0);
EnterCell(SheetNo, RowNo, g_detailCol+ 8, SalesLine.“No.”,FALSE,FALSE,FALSE,’’,0);
EnterCell(SheetNo, RowNo, g_detailCol+ 9, SalesLine.Description,FALSE,FALSE,FALSE,’’,0);
EnterCell(SheetNo, RowNo, g_detailCol+10, FORMAT(SalesLine.Quantity-SalesLine.“Quantity Shipped”),FALSE,FALSE,FALSE,’’,0);
EnterCell(SheetNo, RowNo, g_detailCol+11, FORMAT(g_Bal),FALSE,FALSE,FALSE,’’,0);
IF g_Bal > 0 THEN
BEGIN
IF g_Bal > SalesLine.Quantity THEN
BEGIN
EnterCell(SheetNo, RowNo, g_detailCol+12, FORMAT(SalesLine.Quantity),FALSE,FALSE,FALSE,’’,0);
g_Bal := g_Bal - SalesLine.Quantity;
END ELSE BEGIN
EnterCell(SheetNo, RowNo, g_detailCol+12, FORMAT(g_Bal),FALSE,FALSE,FALSE,’’,0);
g_Bal := 0;
END;
END;
EnterCell(SheetNo, RowNo, g_detailCol+13, ‘=ROUND(’+GetRange(RowNo, g_detailCol+12)+’-’
+GetRange(RowNo, g_detailCol+10)+’,2)’,FALSE,FALSE,FALSE,’’,0);
EnterCell(SheetNo, RowNo, g_detailCol+14, ‘=ROUND(’+FORMAT(SalesLine.CalcCubage)+’/’+FORMAT(SalesLine.Quantity)+’’
+GetRange(RowNo, g_detailCol+12)+’,2)’,FALSE,FALSE,FALSE,’’,0);
EnterCell(SheetNo, RowNo, g_detailCol+15, SalesHeader.Area,FALSE,FALSE,FALSE,’’,0);
EnterCell(SheetNo, RowNo, g_detailCol+16, SalesHeader.“Sell-to Post Code”,FALSE,FALSE,FALSE,’’,0);
EnterCell(SheetNo, RowNo, g_detailCol+17, ‘0’,FALSE,FALSE,FALSE,’’,0);
EnterCell(SheetNo, RowNo, g_detailCol+18, SalesHeader.“External Document No.”,FALSE,FALSE,FALSE,’’,0);
EnterCell(SheetNo, RowNo, g_detailCol+19, FORMAT(SalesLine.“Unit Price”),FALSE,FALSE,FALSE,’’,0);
EnterCell(SheetNo, RowNo, g_detailCol+20, ‘=ROUND(’+GetRange(RowNo, g_detailCol+12)+’’+GetRange(RowNo, g_detailCol+19)+’,2)’,
FALSE,FALSE,FALSE,’’,0);
//#03 S
EnterCell(SheetNo, RowNo, g_detailCol+21, SalesHeader.“Despatch Load Ref.”,FALSE,FALSE,FALSE,’’,0);
//#03 E
//#04 S
EnterCell(SheetNo, RowNo, g_detailCol+22, STRSUBSTNO(’%1 %2 %3 %4’, SalesHeader.“External No. 1”, SalesHeader.“External No. 2”,
SalesHeader.“External No. 3”, SalesHeader.“External No. 4”,SalesHeader.“External No. 5”),FALSE,FALSE,FALSE,’’,0);
//#04 E
UNTIL Snapshot.NEXT = 0;
Item - OnPostDataItem()
IF Exportxls THEN
Window.CLOSE;
UpdateRequestForm()
IF Option = Option::“Update Workbook” THEN BEGIN
RequestOptionsForm.FileName.ENABLED(TRUE);
RequestOptionsForm.SheetName.ENABLED(TRUE);
END ELSE BEGIN
FileName := ‘’;
SheetName := ‘’;
RequestOptionsForm.FileName.ENABLED(FALSE);
RequestOptionsForm.SheetName.ENABLED(FALSE);
END;
DateToSC(Inputdate : Date) OutDate : Text[50]
CASE DATE2DMY(Inputdate,2) OF
1: Text01:=‘Jan.’;
2: Text01:=‘Feb.’;
3: Text01:=‘Mar.’;
4: Text01:=‘Apr.’;
5: Text01:=‘May.’;
6: Text01:=‘Jun.’;
7: Text01:=‘Jul.’;
8: Text01:=‘Aug.’;
9: Text01:=‘Sept.’;
10: Text01:=‘Oct.’;
11: Text01:=‘Nov.’;
12: Text01:=‘Dec.’;
END;
OutDate:=Text01+’ '+DELSTR(FORMAT(DATE2DMY(Inputdate,3)),1,2);
//+DELSTR(FORMAT(DATE2DMY(Inputdate,3)),1,2);
EnterCell(SheetNo : Integer;RowNo : Integer;ColumnNo : Integer;CellValue : Text[250];Bold : Boolean;Italic : Boolean;UnderLine : Boolean
CLEAR(TempExcelBuffer);
TempExcelBuffer.SETRANGE(Sheets, SheetNo);
TempExcelBuffer.SETRANGE(“Row No.”, RowNo);
TempExcelBuffer.SETRANGE(“Column No.”, ColumnNo);
IF (CellValue = ‘0’) OR (CellValue = ‘’) THEN
BEGIN
IF TempExcelBuffer.FIND(’-’) THEN
TempExcelBuffer.DELETE;
END ELSE BEGIN
IF TempExcelBuffer.FIND(’-’) THEN
BEGIN
TempExcelBuffer.“Cell Value as Text” := CellValue;
TempExcelBuffer.MODIFY;
END ELSE BEGIN
TempExcelBuffer.INIT;
TempExcelBuffer.VALIDATE(“Row No.”,RowNo);
TempExcelBuffer.VALIDATE(“Column No.”,ColumnNo);
TempExcelBuffer.“Cell Value as Text” := CellValue;
TempExcelBuffer.Formula := ‘’;
TempExcelBuffer.Bold := Bold;
TempExcelBuffer.Italic := Italic;
TempExcelBuffer.Underline := UnderLine;
TempExcelBuffer.“Font Name” := FontName;
TempExcelBuffer.“Font Size” := FontSize;
TempExcelBuffer.Sheets := SheetNo;
TempExcelBuffer.INSERT;
END;
END;
GetCell(SheetNo : Integer;RowNo : Integer;ColumnNo : Integer) : Text[255]
TempExcelBuffer.SETRANGE(Sheets, SheetNo);
TempExcelBuffer.SETRANGE(“Row No.”, RowNo);
TempExcelBuffer.SETRANGE(“Column No.”, ColumnNo);
TempExcelBuffer.SETFILTER(“Cell Value as Text”, ‘’);
IF TempExcelBuffer.FIND(’-’) THEN
BEGIN
EXIT(TempExcelBuffer.“Cell Value as Text”);
END ELSE
EXIT(’’);
GetCell1(SheetNo : Integer;RowNo : Integer;ColumnNo : Integer) : Decimal
CLEAR(TempExcelBuffer);
TempExcelBuffer.SETRANGE(Sheets, SheetNo);
TempExcelBuffer.SETRANGE(“Row No.”, RowNo);
TempExcelBuffer.SETRANGE(“Column No.”, ColumnNo);
IF TempExcelBuffer.FIND(’-’) THEN
BEGIN
EVALUATE(g_value, TempExcelBuffer.“Cell Value as Text”);
EXIT(g_value);
END ELSE
EXIT(0);
GetSheetCount() : Integer
CLEAR(TempExcelBuffer);
TempExcelBuffer.SETCURRENTKEY(Sheets, “Row No.”);
TempExcelBuffer.SETFILTER(Sheets, ‘’);
TempExcelBuffer.SETFILTER(“Row No.”, ‘’);
TempExcelBuffer.SETFILTER(“Column No.”, ‘’);
IF TempExcelBuffer.FIND(’+’) THEN
BEGIN
EXIT(TempExcelBuffer.Sheets);
END ELSE
EXIT(0);
GetRange(RowNo : Integer;ColumnNo : Integer) : Text[255]
CLEAR(p_TempExcelBuffer);
p_TempExcelBuffer.SETRANGE(Sheets, 100);
p_TempExcelBuffer.SETRANGE(“Row No.”, RowNo);
p_TempExcelBuffer.SETRANGE(“Column No.”, ColumnNo);
IF NOT p_TempExcelBuffer.FIND(’-’) THEN
BEGIN
p_TempExcelBuffer.INIT;
p_TempExcelBuffer.Sheets := 100;
p_TempExcelBuffer.VALIDATE(“Row No.”, RowNo);
p_TempExcelBuffer.VALIDATE(“Column No.”, ColumnNo);
END;
EXIT(p_TempExcelBuffer.xlColID + p_TempExcelBuffer.xlRowID);