報表中表頭資料根據明細資料動態生成的實現.

<問題表述>
報表要實現的功能;

=>表頭部分:
客戶名稱: xxxxxxxxxxxxxxxxx                                   貨物名稱: PREPREG
                                                                                                    COPPER CLAD LAMINATE
                                                                                                    (EPOXY LAMINATE)

...........................................
=>表身部分:
項目  產品編號         產品名稱            數量                 ......................
-------------------------------------------------------------------------------------------------------
1       7456ABA951     XXXX              .....................
2       7456ABA951     XXXX              .....................
3       87653BA951     XXXX              .....................
-----------------
-------------------------------------------------------------------------------------------------------

說明:
1) 產品編號以'7'開頭的為PREPREG; 產品編號以'8'開頭的為COPPER CLAD LAMINATE;
2) 若明細資料里有以'7'開頭的產品,則表頭部分貨物名稱:要顯示PREPREG;若沒有就不要顯示;
同理:若明細資料里有以'8'開頭的產品,則表頭部分貨物名稱:要顯示
COPPER CLAD LAMINATE
                                                                                                                 (EPOXY LAMINATE)
           若沒有就不要顯示

如此可能有三種情況出現:
1) 兩種產品都有,則如上圖報表格式那樣;
2) 只有PREPREG產品;
3) 只有COPPER CLAD LAMINATE產品;

只有PREPREG產品 報表格式如下:
=>表頭部分:
客戶名稱: xxxxxxxxxxxxxxxxx
                                   貨物名稱: PREPREG
                                                                                                   


=>表身部分:
項目  產品編號         產品名稱            數量                 ......................
-------------------------------------------------------------------------------------------------------
1       7456ABA951     XXXX              .....................
2       7456ABA951     XXXX              .....................
-----------------
-------------------------------------------------------------------------------------------------------

只有COPPER CLAD LAMINATE產品 報表格式如下:
=>表頭部分:
客戶名稱: xxxxxxxxxxxxxxxxx
                                   貨物名稱
                                                                                                    COPPER CLAD LAMINATE
                                                                                                    (EPOXY LAMINATE)


=>表身部分:
項目  產品編號         產品名稱            數量                 ......................
-------------------------------------------------------------------------------------------------------
1       84436ABA951     XXXX              .....................
2       8453434A951      XXXX              .....................
-----------------
-------------------------------------------------------------------------------------------------------

<解決辦法>
1) 根據產品分類的規則,把每筆明細分為PP(PREPREG)和CCL(COPPER CLAD LAMINATE)
2) 統計明細資料里有
PREPREGCOPPER CLAD LAMINATE筆數;
3) 根據相應PP和CCL的筆數來顯示相應的貨物名稱;
PS: 目前我還沒有想到更好的辦法,這種辦法有點麻煩;

<具體做法>
1)定義iPP,iCCL;
iPP :=
if Mid({QR_CUSTOMER_INVOICE/.CATALOG_NO},1,1) = '7' then
 1
else 0;
iCCL :=
if Mid({QR_CUSTOMER_INVOICE/.CATALOG_NO},1,1) = '8' then
 1
else 0;
2) 對相應的iPP,iCCL匯總,然後定義iTotalPP,iTotalCCL 等於相應的iPP,iCCL匯總和;
iTotalPP := Sum ({@ipp}, {QR_CUSTOMER_INVOICE/.GROUP_ID})
iTotalCCL := Sum ({@iCcl}, {QR_CUSTOMER_INVOICE/.GROUP_ID})
3) 定義sCommodityPP,sCommodityCclUp,sCommodityCclDown;
sCommodityPP := if{@iTotalPp} > 0  then  'PREPREG';
sCommodityCclUp := if{@iTotalCcl} > 0 then  'COPPER CLAD LAMINATE';
sCommodityCclDown := if{@iTotalCcl} > 0 then  '(EPOXY LAMINATE)';

阅读更多
个人分类: 6> Crystal Reports
上一篇ZT: 批处理应用
下一篇IFS自帶報表字體設置
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭