范例:

代码:

#add-point:input段落 name="ui_dialog.input"
INPUT BY NAME g_master.bdate,g_master.edate,g_master.l_group
ATTRIBUTE(WITHOUT DEFAULTS) AFTER FIELD edate
IF NOT cl_null(g_master.edate) AND NOT cl_null(g_master.bdate) THEN
IF g_master.edate < g_master.bdate THEN
LET g_master.edate = NULL
DISPLAY g_master.edate TO edate
NEXT FIELD edate
END IF
END IF END INPUT
#end add-point

  

#add-point:construct段落 name="ui_dialog.construct"
CONSTRUCT BY NAME g_master.wc ON pmdo001,imaa009,pmaa080,pmdl004 ON ACTION controlp INFIELD pmdo001
INITIALIZE g_qryparam.* TO NULL
LET g_qryparam.state = 'c'
LET g_qryparam.reqry = FALSE
CALL q_imaf001() #呼叫開窗
DISPLAY g_qryparam.return1 TO pmdo001 #顯示到畫面上
NEXT FIELD pmdo001 #返回原欄位 ON ACTION controlp INFIELD imaa009
INITIALIZE g_qryparam.* TO NULL
LET g_qryparam.state = 'c'
LET g_qryparam.reqry = FALSE
CALL q_rtax001() #呼叫開窗
DISPLAY g_qryparam.return1 TO imaa009 #顯示到畫面上
NEXT FIELD imaa009 #返回原欄位 ON ACTION controlp INFIELD pmaa080
INITIALIZE g_qryparam.* TO NULL
LET g_qryparam.state = 'c'
LET g_qryparam.reqry = FALSE
LET g_qryparam.arg1 = '251'
CALL q_oocq002() #呼叫開窗
DISPLAY g_qryparam.return1 TO pmaa080 #顯示到畫面上
NEXT FIELD pmaa080 #返回原欄位 ON ACTION controlp INFIELD pmdl004
INITIALIZE g_qryparam.* TO NULL
LET g_qryparam.state = 'c'
LET g_qryparam.reqry = FALSE
CALL q_pmaa001_3() #呼叫開窗
DISPLAY g_qryparam.return1 TO pmdl004 #顯示到畫面上
NEXT FIELD pmdl004 #返回原欄位 END CONSTRUCT
#end add-point

  

双击汇总,打开对应报表;

#add-point:page1自定義行為 name="ui_dialog.body.page1.action"
ON ACTION modify_detail
LET l_wc_web = l_wc
LET l_wc_web = cl_replace_str(l_wc_web,"pmdo001","imaa001")
LET l_wc_web = cl_replace_str(l_wc_web,"pmdl004","pmaa001")
CASE g_master.l_group
WHEN '1'
CALL apmr006_x01(l_wc_web)
WHEN '2'
CALL apmr006_x02(l_wc_web)
WHEN '3'
CALL apmr006_x03(l_wc_web)
WHEN '4'
CALL apmr006_x04(l_wc_web)
WHEN '5'
CALL apmr006_x05(l_wc_web)
END CASE
#end add-point

  

#+ 單身陣列填充
PRIVATE FUNCTION cpmq006_b_fill()
#add-point:b_fill段define-客製 name="b_fill.define_customerization" #end add-point
DEFINE ls_wc STRING
DEFINE l_pid LIKE type_t.chr50
DEFINE ls_sql_rank STRING
#add-point:b_fill段define-標準 (請盡量不要在客製環境修改此段落內容, 否則將後續patch的調整需人工處理) name="b_fill.define" #end add-point #add-point:b_fill段sql_before name="b_fill.sql_before"
CALL cl_set_comp_visible("b_pmdl004,b_pmdl004_desc,b_pmdl002,b_pmdl002_desc,b_pmdl003,b_pmdl003_desc,b_pmdo001,b_pmdo001_desc,b_pmdo001_desc_1,b_imaa009,b_imaa009_desc",FALSE)
CASE g_master.l_group
WHEN '1' #供应商编码
CALL cl_set_comp_visible("b_pmdl004,b_pmdl004_desc",TRUE)
WHEN '2' #采购人员
CALL cl_set_comp_visible("b_pmdl002,b_pmdl002_desc",TRUE)
WHEN '3' #采购部门
CALL cl_set_comp_visible("b_pmdl003,b_pmdl003_desc",TRUE)
WHEN '4' #产品分类
CALL cl_set_comp_visible("b_imaa009,b_imaa009_desc",TRUE)
WHEN '5' #料件编号
CALL cl_set_comp_visible("b_pmdo001,b_pmdo001_desc,b_pmdo001_desc_1",TRUE)
END CASE IF cl_null(g_master.wc) THEN
LET g_master.wc = " pmdlsite = '",g_site CLIPPED,"' AND pmdlent = '",g_enterprise CLIPPED,"' "
ELSE
LET g_master.wc = g_master.wc CLIPPED," AND pmdlsite = '",g_site CLIPPED,"' AND pmdlent = '",g_enterprise CLIPPED,"' "
END IF LET g_master.wc = g_master.wc CLIPPED," AND (pmdl005 = '1' OR pmdl005 = '2' OR pmdl005 = '3' OR pmdl005 = '5' ) AND pmdlstus='Y'" IF NOT cl_null(g_master.bdate) THEN
LET g_master.wc = g_master.wc , " AND pmdldocdt >= to_date( '",g_master.bdate,"','yy/mm/dd') "
END IF IF NOT cl_null(g_master.edate) THEN
LET g_master.wc = g_master.wc , " AND pmdldocdt <= to_date('",g_master.edate,"','yy/mm/dd') "
END IF LET l_wc = g_master.wc
#end add-point IF cl_null(g_wc_filter) THEN
LET g_wc_filter = " 1=1"
END IF
IF cl_null(g_wc) THEN
LET g_wc = " 1=1"
END IF
IF cl_null(g_wc2) THEN
LET g_wc2 = " 1=1"
END IF LET ls_wc = g_wc, " AND ", g_wc2, " AND ", g_wc_filter CALL g_pmdl_d.clear() #add-point:陣列清空 name="b_fill.array_clear" #end add-point LET g_cnt = l_ac
IF g_cnt = 0 THEN
LET g_cnt = 1
END IF
LET l_ac = 1 # b_fill段sql組成及FOREACH撰寫
#應用 qs04 樣板自動產生(Version:9)
#+ b_fill段資料取得(包含sql組成及FOREACH段撰寫)
LET ls_sql_rank = "SELECT UNIQUE pmdl004,'',pmdl002,'',pmdl003,'','','','','','','','','','' ,DENSE_RANK() OVER( ORDER BY pmdl_t.pmdldocno) AS RANK FROM pmdl_t", #table2
" LEFT JOIN pmdn_t ON pmdnent = pmdlent AND pmdldocno = pmdndocno", "",
" WHERE pmdlent= ? AND 1=1 AND ", ls_wc
LET ls_sql_rank = ls_sql_rank, cl_sql_add_filter("pmdl_t"),
" ORDER BY pmdl_t.pmdldocno" #add-point:b_fill段rank_sql_after name="b_fill.rank_sql_after"
LET ls_sql_rank = " SELECT pmdl004,pmaal003,pmdl002,ooag011,pmdl003,ooefl003,pmdo001,imaal003,imaal004,imaa009,rtaxl003,pmdo006,pmdo033 ",
" FROM pmdo_t ",
" LEFT JOIN pmdn_t ON pmdnent=pmdoent AND pmdndocno=pmdodocno AND pmdnseq=pmdoseq ",
" LEFT JOIN pmdl_t ON pmdlent=pmdnent AND pmdldocno=pmdndocno ",
" LEFT JOIN imaa_t ON imaaent=pmdnent AND imaa001=pmdn001 ",
" LEFT JOIN pmaa_t ON pmaaent=pmdlent AND pmaa001=pmdl004 ",
" LEFT JOIN pmaal_t ON pmaalent=pmdlent AND pmaal001=pmdl004 AND pmaal002='zh_CN' ",
" LEFT JOIN ooag_t ON ooagent=pmdlent AND ooag001=pmdl002 ",
" LEFT JOIN ooefl_t ON ooeflent=pmdlent AND ooefl001=pmdl003 AND ooefl002='zh_CN' ",
" LEFT JOIN imaal_t ON imaaent=pmdnent AND imaal001=pmdn001 AND imaal002='zh_CN' ",
" LEFT JOIN rtaxl_t ON rtaxlent=imaaent AND rtaxl001=imaa009 AND rtaxl002='zh_CN' ",
" WHERE ",l_wc CLIPPED
{
#end add-point LET g_sql = "SELECT COUNT(1) FROM (",ls_sql_rank,")" PREPARE b_fill_cnt_pre FROM g_sql #總筆數
EXECUTE b_fill_cnt_pre USING g_enterprise INTO g_tot_cnt
FREE b_fill_cnt_pre #add-point:b_fill段rank_sql_after_count name="b_fill.rank_sql_after_count"
}
LET g_sql = "SELECT COUNT(1) FROM (",ls_sql_rank,")" PREPARE b_fill_cnt_pre FROM g_sql #總筆數
EXECUTE b_fill_cnt_pre INTO g_tot_cnt
FREE b_fill_cnt_pre
#end add-point CASE g_detail_page_action
WHEN "detail_first"
LET g_pagestart = 1 WHEN "detail_previous"
LET g_pagestart = g_pagestart - g_num_in_page
IF g_pagestart < 1 THEN
LET g_pagestart = 1
END IF WHEN "detail_next"
LET g_pagestart = g_pagestart + g_num_in_page
IF g_pagestart > g_tot_cnt THEN
LET g_pagestart = g_tot_cnt - (g_tot_cnt mod g_num_in_page) + 1
WHILE g_pagestart > g_tot_cnt
LET g_pagestart = g_pagestart - g_num_in_page
END WHILE
END IF WHEN "detail_last"
LET g_pagestart = g_tot_cnt - (g_tot_cnt mod g_num_in_page) + 1
WHILE g_pagestart > g_tot_cnt
LET g_pagestart = g_pagestart - g_num_in_page
END WHILE OTHERWISE
LET g_pagestart = 1 END CASE LET g_sql = "SELECT pmdl004,'',pmdl002,'',pmdl003,'','','','','','','','','',''",
" FROM (",ls_sql_rank,")",
" WHERE RANK >= ",g_pagestart,
" AND RANK < ",g_pagestart + g_num_in_page #add-point:b_fill段sql_after name="b_fill.sql_after"
LET g_sql = " WITH t1 AS ( ",
" SELECT pmdl004,pmaal003,pmdl002,ooag011,pmdl003,ooefl003,pmdo001,imaal003,imaal004,imaa009,rtaxl003,pmdo006,pmdo033 ",
" FROM pmdo_t ",
" LEFT JOIN pmdn_t ON pmdnent=pmdoent AND pmdndocno=pmdodocno AND pmdnseq=pmdoseq ",
" LEFT JOIN pmdl_t ON pmdlent=pmdnent AND pmdldocno=pmdndocno ",
" LEFT JOIN imaa_t ON imaaent=pmdnent AND imaa001=pmdn001 ",
" LEFT JOIN pmaa_t ON pmaaent=pmdlent AND pmaa001=pmdl004 ",
" LEFT JOIN pmaal_t ON pmaalent=pmdlent AND pmaal001=pmdl004 AND pmaal002='zh_CN' ",
" LEFT JOIN ooag_t ON ooagent=pmdlent AND ooag001=pmdl002 ",
" LEFT JOIN ooefl_t ON ooeflent=pmdlent AND ooefl001=pmdl003 AND ooefl002='zh_CN' ",
" LEFT JOIN imaal_t ON imaaent=pmdnent AND imaal001=pmdn001 AND imaal002='zh_CN' ",
" LEFT JOIN rtaxl_t ON rtaxlent=imaaent AND rtaxl001=imaa009 AND rtaxl002='zh_CN' ",
" WHERE pmdoent=? AND ",l_wc CLIPPED," ) " CASE g_master.l_group
WHEN '1' #供应商编码
LET g_sql = g_sql, " SELECT pmdl004,pmaal003,'','','','','','','','','',SUM(pmdo006),to_char(SUM(pmdo006)/(SELECT SUM(pmdo006) FROM t1)*100,'fm990.99')||'%',SUM(pmdo033),to_char(SUM(pmdo033)/(SELECT SUM(pmdo033) FROM t1)*100,'fm990.99')||'%' ",
" FROM t1 ",
" GROUP BY pmdl004,pmaal003 ",
" ORDER BY pmdl004 "
WHEN '2' #采购人员
LET g_sql = g_sql, " SELECT '','',pmdl002,ooag011,'','','','','','','',SUM(pmdo006),to_char(SUM(pmdo006)/(SELECT SUM(pmdo006) FROM t1)*100,'fm990.99')||'%',SUM(pmdo033),to_char(SUM(pmdo033)/(SELECT SUM(pmdo033) FROM t1)*100,'fm990.99')||'%' ",
" FROM t1 ",
" GROUP BY pmdl002,ooag011 ",
" ORDER BY pmdl002 "
WHEN '3' #采购部门
LET g_sql = g_sql, " SELECT '','','','',pmdl003,ooefl003,'','','','','',SUM(pmdo006),to_char(SUM(pmdo006)/(SELECT SUM(pmdo006) FROM t1)*100,'fm990.99')||'%',SUM(pmdo033),to_char(SUM(pmdo033)/(SELECT SUM(pmdo033) FROM t1)*100,'fm990.99')||'%' ",
" FROM t1 ",
" GROUP BY pmdl003,ooefl003 ",
" ORDER BY pmdl003 "
WHEN '4' #产品分类
LET g_sql = g_sql, " SELECT '','','','','','','','','',imaa009,rtaxl003,SUM(pmdo006),to_char(SUM(pmdo006)/(SELECT SUM(pmdo006) FROM t1)*100,'fm990.99')||'%',SUM(pmdo033),to_char(SUM(pmdo033)/(SELECT SUM(pmdo033) FROM t1)*100,'fm990.99')||'%' ",
" FROM t1 ",
" GROUP BY imaa009,rtaxl003 ",
" ORDER BY imaa009 "
WHEN '5' #料件编号
LET g_sql = g_sql, " SELECT '','','','','','',pmdo001,imaal003,imaal004,'','',SUM(pmdo006),to_char(SUM(pmdo006)/(SELECT SUM(pmdo006) FROM t1)*100,'fm990.99')||'%',SUM(pmdo033),to_char(SUM(pmdo033)/(SELECT SUM(pmdo033) FROM t1)*100,'fm990.99')||'%' ",
" FROM t1 ",
" GROUP BY pmdo001,imaal003,imaal004 ",
" ORDER BY pmdo001 "
END CASE
#end add-point LET g_sql = cl_sql_add_mask(g_sql) #遮蔽特定資料
PREPARE cpmq006_pb FROM g_sql
DECLARE b_fill_curs CURSOR FOR cpmq006_pb OPEN b_fill_curs USING g_enterprise FOREACH b_fill_curs INTO g_pmdl_d[l_ac].pmdl004,g_pmdl_d[l_ac].pmdl004_desc,g_pmdl_d[l_ac].pmdl002,
g_pmdl_d[l_ac].pmdl002_desc,g_pmdl_d[l_ac].pmdl003,g_pmdl_d[l_ac].pmdl003_desc,g_pmdl_d[l_ac].pmdo001,
g_pmdl_d[l_ac].pmdo001_desc,g_pmdl_d[l_ac].pmdo001_desc_1,g_pmdl_d[l_ac].imaa009,g_pmdl_d[l_ac].imaa009_desc,
g_pmdl_d[l_ac].l_sum_cnt,g_pmdl_d[l_ac].l_sum_cntb,g_pmdl_d[l_ac].l_sum_money,g_pmdl_d[l_ac].l_sum_moneyb IF SQLCA.sqlcode THEN
INITIALIZE g_errparam TO NULL
LET g_errparam.extend = "FOREACH:"
LET g_errparam.code = SQLCA.sqlcode
LET g_errparam.popup = TRUE
CALL cl_err() EXIT FOREACH
END IF #add-point:b_fill段資料填充 name="b_fill.fill" #end add-point CALL cpmq006_detail_show("'1'") CALL cpmq006_pmdl_t_mask() IF l_ac > g_max_rec THEN
IF g_error_show = 1 THEN
INITIALIZE g_errparam TO NULL
LET g_errparam.extend = ""
LET g_errparam.code = 9035
LET g_errparam.popup = TRUE
CALL cl_err() END IF
EXIT FOREACH
END IF
LET l_ac = l_ac + 1 END FOREACH #應用 qs05 樣板自動產生(Version:3)
#+ b_fill段其他table資料取得(包含sql組成及資料填充) #add-point:b_fill段資料填充(其他單身) name="b_fill.others.fill" #end add-point CALL g_pmdl_d.deleteElement(g_pmdl_d.getLength()) #add-point:陣列長度調整 name="b_fill.array_deleteElement" #end add-point LET g_error_show = 0 LET g_detail_cnt = g_pmdl_d.getLength()
LET l_ac = g_cnt
LET g_cnt = 0 #應用 qs06 樣板自動產生(Version:3)
#+ b_fill段CURSOR釋放
CLOSE b_fill_curs
FREE cpmq006_pb #調整單身index指標,避免翻頁後指到空白筆數
CALL cpmq006_detail_index_setting() #重新計算單身筆數並呈現
CALL cpmq006_detail_action_trans() LET l_ac = 1
IF g_pmdl_d.getLength() > 0 THEN
CALL cpmq006_b_fill2()
END IF CALL cpmq006_filter_show('pmdl004','b_pmdl004')
CALL cpmq006_filter_show('pmdl002','b_pmdl002')
CALL cpmq006_filter_show('pmdl003','b_pmdl003')
CALL cpmq006_filter_show('pmdo001','b_pmdo001')
CALL cpmq006_filter_show('imaa009','b_imaa009')
CALL cpmq006_filter_show('pmdlstus','b_pmdlstus') END FUNCTION

  

#+ 單身陣列填充2
PRIVATE FUNCTION cpmq006_b_fill2()
#add-point:b_fill2段define-客製 name="b_fill2.define_customerization" #end add-point
DEFINE li_ac LIKE type_t.num10
#add-point:b_fill2段define-標準 (請盡量不要在客製環境修改此段落內容, 否則將後續patch的調整需人工處理) name="b_fill2.define" #end add-point #add-point:FUNCTION前置處理 name="b_fill2.before_function" #end add-point LET li_ac = l_ac #單身組成
#應用 qs07 樣板自動產生(Version:6)
#+ b_fill2段table資料取得(包含sql組成及資料填充)
#Page2
CALL g_pmdl2_d.clear() #add-point:陣列清空 name="b_fill2.array_clear"
{
#end add-point #table2
#為避免影響執行效能,若是按上下筆就不重組SQL
IF g_action_choice <> "fetch" OR cl_null(g_action_choice) THEN
LET g_sql = "SELECT UNIQUE '','','','','','','','','','','','','','','','','','','','','','',
'','','','','','','','','','',pmdnud001,pmdn015,pmdn045,pmdn049,'',pmdn051,'' FROM pmdn_t", "",
" WHERE pmdnent=? AND pmdndocno=?" IF NOT cl_null(g_wc2_table2) THEN
LET g_sql = g_sql CLIPPED," AND ",g_wc2_table2 CLIPPED
END IF LET g_sql = g_sql, " ORDER BY pmdn_t.pmdnseq" #add-point:單身填充前 name="b_fill2.before_fill2"
}
LET g_sql = " SELECT pmdldocno,pmdldocdt,pmdl004,pmaal003,pmdl002,ooag011,pmdl003,ooefl003,pmdl005,pmdlud002,pmdlstus,pmdoseq, ",
" pmdoseq1,pmdoseq2,pmdo003,pmdo001,imaal003,imaal004,pmdo004,pmdo005,pmdo006,pmdo011,pmdo012,pmdo013,pmdo009, ",
" pmdo015,pmdo016,pmdo017,pmdo040,pmdo019,pmdo024,pmdo033,pmdnud001,pmdn015,pmdn045,pmdn049,oq1.oocql004,pmdn051,oq2.oocql004 ",
" FROM pmdo_t ",
" LEFT JOIN pmdn_t ON pmdnent=pmdoent AND pmdndocno=pmdodocno AND pmdnseq=pmdoseq ",
" LEFT JOIN pmdl_t ON pmdlent=pmdnent AND pmdldocno=pmdndocno ",
" LEFT JOIN imaa_t ON imaaent=pmdnent AND imaa001=pmdn001 ",
" LEFT JOIN pmaa_t ON pmaaent=pmdlent AND pmaa001=pmdl004 ",
" LEFT JOIN pmaal_t ON pmaalent=pmdlent AND pmaal001=pmdl004 AND pmaal002='zh_CN' ",
" LEFT JOIN ooag_t ON ooagent=pmdlent AND ooag001=pmdl002 ",
" LEFT JOIN ooefl_t ON ooeflent=pmdlent AND ooefl001=pmdl003 AND ooefl002='zh_CN' ",
" LEFT JOIN imaal_t ON imaaent=pmdnent AND imaal001=pmdn001 AND imaal002='zh_CN' ",
" LEFT JOIN rtaxl_t ON rtaxlent=imaaent AND rtaxl001=imaa009 AND rtaxl002='zh_CN' ",
" LEFT JOIN oocql_t oq1 ON oq1.oocqlent=pmdnent AND oq1.oocql001='265' AND oq1.oocql002=pmdn049 AND oq1.oocql003='zh_CN' ",
" LEFT JOIN oocql_t oq2 ON oq2.oocqlent=pmdnent AND oq2.oocql001 IN ('258','317') AND oq2.oocql002=pmdn051 AND oq2.oocql003='zh_CN' ",
" WHERE ",l_wc CLIPPED CASE g_master.l_group
WHEN '1' #供应商编码
LET g_sql = g_sql, " AND pmdl004 = '",g_pmdl_d[g_detail_idx].pmdl004,"' "
WHEN '2' #采购人员
LET g_sql = g_sql, " AND pmdl002 = '",g_pmdl_d[g_detail_idx].pmdl002,"' "
WHEN '3' #采购部门
LET g_sql = g_sql, " AND pmdl003 = '",g_pmdl_d[g_detail_idx].pmdl003,"' "
WHEN '4' #产品分类
LET g_sql = g_sql, " AND imaa009 = '",g_pmdl_d[g_detail_idx].imaa009,"' "
WHEN '5' #料件编号
LET g_sql = g_sql, " AND pmdo001 = '",g_pmdl_d[g_detail_idx].pmdo001,"' "
END CASE {
#end add-point LET g_sql = cl_sql_add_mask(g_sql) #遮蔽特定資料
PREPARE cpmq006_pb2 FROM g_sql
DECLARE b_fill_curs2 CURSOR FOR cpmq006_pb2
END IF OPEN b_fill_curs2 USING g_enterprise,g_pmdl_d[g_detail_idx].pmdldocno LET l_ac = 1
FOREACH b_fill_curs2 INTO g_pmdl2_d[l_ac].pmdldocno,g_pmdl2_d[l_ac].pmdldocdt,g_pmdl2_d[l_ac].pmdl004,
g_pmdl2_d[l_ac].pmdl004_2_desc,g_pmdl2_d[l_ac].pmdl002,g_pmdl2_d[l_ac].pmdl002_2_desc,g_pmdl2_d[l_ac].pmdl003,
g_pmdl2_d[l_ac].pmdl003_2_desc,g_pmdl2_d[l_ac].pmdl005,g_pmdl2_d[l_ac].pmdlud002,g_pmdl2_d[l_ac].pmdlstus,
g_pmdl2_d[l_ac].pmdoseq,g_pmdl2_d[l_ac].pmdoseq1,g_pmdl2_d[l_ac].pmdoseq2,g_pmdl2_d[l_ac].pmdo003,
g_pmdl2_d[l_ac].pmdo001,g_pmdl2_d[l_ac].pmdo001_2_desc,g_pmdl2_d[l_ac].pmdo001_2_desc_1,g_pmdl2_d[l_ac].pmdo004,
g_pmdl2_d[l_ac].pmdo005,g_pmdl2_d[l_ac].pmdo006,g_pmdl2_d[l_ac].pmdo011,g_pmdl2_d[l_ac].pmdo012,
g_pmdl2_d[l_ac].pmdo013,g_pmdl2_d[l_ac].pmdo009,g_pmdl2_d[l_ac].pmdo015,g_pmdl2_d[l_ac].pmdo016,
g_pmdl2_d[l_ac].pmdo017,g_pmdl2_d[l_ac].pmdo040,g_pmdl2_d[l_ac].pmdo019,g_pmdl2_d[l_ac].pmdo024,
g_pmdl2_d[l_ac].pmdo033,g_pmdl2_d[l_ac].pmdnud001,g_pmdl2_d[l_ac].pmdn015,g_pmdl2_d[l_ac].pmdn045,
g_pmdl2_d[l_ac].pmdn049,g_pmdl2_d[l_ac].pmdn049_2_desc,g_pmdl2_d[l_ac].pmdn051,g_pmdl2_d[l_ac].pmdn051_2_desc IF SQLCA.sqlcode THEN
INITIALIZE g_errparam TO NULL
LET g_errparam.extend = "FOREACH:"
LET g_errparam.code = SQLCA.sqlcode
LET g_errparam.popup = TRUE
CALL cl_err() EXIT FOREACH
END IF #add-point:b_fill2段資料填充 name="b_fill2.fill2"
} LET g_sql = cl_sql_add_mask(g_sql) #遮蔽特定資料
PREPARE cpmq006_pb2 FROM g_sql
DECLARE b_fill_curs2 CURSOR FOR cpmq006_pb2 OPEN b_fill_curs2 LET l_ac = 1
FOREACH b_fill_curs2 INTO g_pmdl2_d[l_ac].pmdldocno,g_pmdl2_d[l_ac].pmdldocdt,g_pmdl2_d[l_ac].pmdl004,
g_pmdl2_d[l_ac].pmdl004_2_desc,g_pmdl2_d[l_ac].pmdl002,g_pmdl2_d[l_ac].pmdl002_2_desc,g_pmdl2_d[l_ac].pmdl003,
g_pmdl2_d[l_ac].pmdl003_2_desc,g_pmdl2_d[l_ac].pmdl005,g_pmdl2_d[l_ac].pmdlud002,g_pmdl2_d[l_ac].pmdlstus,
g_pmdl2_d[l_ac].pmdoseq,g_pmdl2_d[l_ac].pmdoseq1,g_pmdl2_d[l_ac].pmdoseq2,g_pmdl2_d[l_ac].pmdo003,
g_pmdl2_d[l_ac].pmdo001,g_pmdl2_d[l_ac].pmdo001_2_desc,g_pmdl2_d[l_ac].pmdo001_2_desc_1,g_pmdl2_d[l_ac].pmdo004,
g_pmdl2_d[l_ac].pmdo005,g_pmdl2_d[l_ac].pmdo006,g_pmdl2_d[l_ac].pmdo011,g_pmdl2_d[l_ac].pmdo012,
g_pmdl2_d[l_ac].pmdo013,g_pmdl2_d[l_ac].pmdo009,g_pmdl2_d[l_ac].pmdo015,g_pmdl2_d[l_ac].pmdo016,
g_pmdl2_d[l_ac].pmdo017,g_pmdl2_d[l_ac].pmdo040,g_pmdl2_d[l_ac].pmdo019,g_pmdl2_d[l_ac].pmdo024,
g_pmdl2_d[l_ac].pmdo033,g_pmdl2_d[l_ac].pmdnud001,g_pmdl2_d[l_ac].pmdn015,g_pmdl2_d[l_ac].pmdn045,
g_pmdl2_d[l_ac].pmdn049,g_pmdl2_d[l_ac].pmdn049_2_desc,g_pmdl2_d[l_ac].pmdn051,g_pmdl2_d[l_ac].pmdn051_2_desc IF SQLCA.sqlcode THEN
INITIALIZE g_errparam TO NULL
LET g_errparam.extend = "FOREACH:"
LET g_errparam.code = SQLCA.sqlcode
LET g_errparam.popup = TRUE
CALL cl_err() EXIT FOREACH
END IF
#end add-point CALL cpmq006_detail_show("'2'") CALL cpmq006_pmdn_t_mask() IF l_ac > g_max_rec THEN
INITIALIZE g_errparam TO NULL
LET g_errparam.extend = ""
LET g_errparam.code = 9035
LET g_errparam.popup = TRUE
CALL cl_err() EXIT FOREACH
END IF
LET l_ac = l_ac + 1 END FOREACH #Page2
CALL g_pmdl2_d.deleteElement(g_pmdl2_d.getLength()) #add-point:陣列長度調整 name="b_fill2.array_deleteElement" #end add-point #Page2
LET li_ac = g_pmdl2_d.getLength() DISPLAY li_ac TO FORMONLY.cnt
LET g_detail_idx2 = 1
DISPLAY g_detail_idx2 TO FORMONLY.idx #add-point:單身填充後 name="b_fill2.after_fill" #end add-point LET l_ac = li_ac END FUNCTION

  

T100——q查询,子母查询(汇总——明细)练习笔记的更多相关文章

  1. 高级查询子条件查询filter

    Filter Context 在查询过程中,只判断该文档是否满足条件,只有Yes或者No { "query":{ "bool":{ //布尔关键词 " ...

  2. SQL语句汇总(三)——聚合函数、分组、子查询及组合查询

    聚合函数: SQL中提供的聚合函数可以用来统计.求和.求最值等等. 分类: –COUNT:统计行数量 –SUM:获取单个列的合计值 –AVG:计算某个列的平均值 –MAX:计算列的最大值 –MIN:计 ...

  3. SQL语句汇总(三)——聚合函数、分组、子查询及组合查询

    拖了一个星期,终于开始写第三篇了.走起! 聚合函数: SQL中提供的聚合函数可以用来统计.求和.求最值等等. 分类: –COUNT:统计行数量 –SUM:获取单个列的合计值 –AVG:计算某个列的平均 ...

  4. Django框架(九)-- 多表操作:一对一、一对多、多对多的增删改,基于对象/双下划线的跨表查询、聚合查询、分组查询、F查询与Q查询

    一.创建多表模型 一对一:OneToOneField 一对多:ForeignKey 多对多:ManyToManyField 创建表时,会自动添加一个nid字段,并且自增,所以id可以不用手动创建 On ...

  5. Django框架(十)—— 多表操作:一对一、一对多、多对多的增删改,基于对象/双下划线的跨表查询、聚合查询、分组查询、F查询与Q查询

    目录 多表操作:增删改,基于对象/双下划线的跨表查询.聚合查询.分组查询.F查询与Q查询 一.创建多表模型 二.一对多增删改表记录 1.一对多添加记录 2.一对多删除记录 3.一对多修改记录 三.一对 ...

  6. 【MySQL】-2 函数、分组、子查询、联合查询

    函数 Mysql的函数特性没有SQL可移植性强. 大多数情况下支持的函数: 处理文本串的函数: RTrim():处理列值右边的空格 LTrim():处理列值左边的空格   Trim():处理列值的左右 ...

  7. MySQL(八)子查询和分组查询

    一.子查询 1.子查询(subquery):嵌套在其他查询中的查询. 例如:select user_id from usertable where mobile_no in (select mobil ...

  8. Linq to SQL 语法查询(子查询 & in操作 & join )

    var 子查询 = from c in ctx.Customers                    where                        (from o in ctx.Ord ...

  9. Django框架第七篇(模型层)--多表操作:一对多/多对多增删改,跨表查询(基于对象、基于双下划线跨表查询),聚合查询,分组查询,F查询与Q查询

    一.多表操作 一对多字段的增删改(book表和publish表是一对多关系,publish_id字段) 增  create publish_id 传数字   (publish_id是数据库显示的字段名 ...

随机推荐

  1. Codeforces 808 E. Selling Souvenirs(三分)

    E. Selling Souvenirs 题意: n件物品,有重量和价值,重量只有三种1,2,3.问取不超过m重量的物品的价值总和最大是多少.(n<=1e5,w<=3e5) 思路: n*w ...

  2. Could not initialize class sun.awt.X11GraphicsEnvironment异常处理

    原因导致: 经过Google发现很多人也出现同样的问题.从了解了X11GraphicEnvironment这个类的功能入手, 一个Java服务器来处理图片的API基本上是需要运行一个X-server以 ...

  3. JS高级_变量提升和函数提升

    先执行变量提升,后执行函数提升 function a(){} var a console.log(typeof a)//function

  4. PHP 二维数组去重方法

    php二维数组的去重策略,如果需要根据某字段去重(其他字段可能不一致),那么需要使用循环策略,如果去重的都是相同的(字段,值),那么可以用序列化方式. $allComments = array_map ...

  5. 演示Java如何调用Mysql的过程和函数

    这里只演示Java如何调用Mysql的过程和函数 --------------------------------------------------------------------------- ...

  6. Hander创建消息

    每一个消息都需要被指定的Handler处理,通过Handler创建消息便可以完成此功能.Android消息机制中引入了消息池.Handler创建消息时首先查询消息池中是否有消息存在,如果有直接从消息池 ...

  7. Android 中更新 UI 的四种方式

    runOnUiThread handler 的 post handler 的 sendMessage View 自身的 post

  8. Selenium 2自动化测试实战33(带unittest的脚本分析)

    带unittest的脚本分析 #test.py #coding:utf-8 from selenium import webdriver from selenium.webdriver.common. ...

  9. vue+npm+Element插件+路由

    首先安装node.js 之后使用管理员输入命令 然后,就可以使用 npm 命令安装了: npm install -g @vue/cli安装完后,打开命令行窗口,会有一个 vue 命令:vue -v v ...

  10. Scala语法03 - 函数