1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
|
import C_HRS_FUNC:*; import C_COMMON_FUNC:UTILITY:*;
Local array of array of any &arrRptPar; Local array of any &arrRptHead;
Local number &seqNo; Local array of any &tmpArr; Local string &orderId;
&arrRptPar = CreateArrayRept(CreateArrayAny(), 0).Clone(); &arrRptHead = CreateArrayAny(); &arrData = CreateArrayAny(); &tmpArr = CreateArrayAny();
&oReport = create C_HRS_FUNC:REPORT(); &oUtility = create C_HRS_FUNC:UTILITY(); &oUtility2 = create C_COMMON_FUNC:UTILITY();
&orderId = ZL_RUN_CTL_AET.ZL_ORDERID.Value; &seqNo = 0;
Local File &rptFile = GetTempFile(%FilePath | &strTmplateId | "_" | %Date | ".xls", "w", "u", %FilePath_Absolute);
Local File &log = GetTempFile(%FilePath | "log" | %Date | ".txt", "w", "u", %FilePath_Absolute);
Rem 求出报表描述名称; &arrRptPar.Push(CreateArrayAny("报表名称", "订单明细表"));
Rem 取报表的制表人(OPRID+空格+OPRID对应员工的NAME_FORMAL); SQLExec("SELECT NAME_DISPLAY FROM PS_PERSONAL_DATA WHERE EMPLID = :1", %EmployeeId, &strRptPersonNm); &strRptPersonNm = %OperatorId | " " | &strRptPersonNm;
&arrRptPar.Push(CreateArrayAny("制表人", &strRptPersonNm)); &arrRptPar.Push(CreateArrayAny("制表日期", String(%Date)));
&arrRptPar.Push(CreateArrayAny("订单ID", &orderId));
Rem 设置报表格式信息; &oReport.AddXlsHeader(&rptFile); Rem 打印报表头信息; &oReport.WritePara(&rptFile, &arrRptPar);
Rem 初始化报表标题信息; &arrRptHead.Push("序号"); &arrRptHead.Push("订单编号"); &arrRptHead.Push("订单描述"); &arrRptHead.Push("订单子编号"); &arrRptHead.Push("订单类型"); &arrRptHead.Push("订单说明"); &arrRptHead.Push("订单数量"); &arrRptHead.Push("订单单价"); &arrRptHead.Push("订单金额");
&oReport.WriteColName(&rptFile, &arrRptHead);
Local array of any &tArr;
Local SQL &rowSql = CreateSQL(SQL.ZL_QUERY_SQL, &orderId);
While &rowSql.Fetch(&tmpArr) &seqNo = &seqNo + 1; &rptFile.WriteLine("<tr>"); &oReport.WriteCellData(&rptFile, &seqNo, "30"); &oReport.WriteCellData(&rptFile, &tmpArr [1], "30"); &oReport.WriteCellData(&rptFile, &tmpArr [2], "30"); &oReport.WriteCellData(&rptFile, &tmpArr [3], "30"); &tArr = &oUtility2.GetXlatValue("ZL_ORDER_SUBTYPE", String(&tmpArr [4]), %Date); &oReport.WriteCellData(&rptFile, &tArr [1], "30"); &oReport.WriteCellData(&rptFile, &tmpArr [5], "30"); &oReport.WriteCellData(&rptFile, &tmpArr [6], "30"); &oReport.WriteCellData(&rptFile, &tmpArr [7], "30"); &oReport.WriteCellData(&rptFile, &tmpArr [8], "30"); &rptFile.WriteLine("</tr>"); End-While;
&oReport.WriteEnding(&rptFile);
rem &log.Delete(); &log.Close(); &rptFile.Close();
|