[Main] dbuse(true) initparam(printMode,reportId,dt_from,dt_to,uri_no,tokui_cd,syohin_nm,han_name,outputfile) deforgpage(blank) defheadarea(hed) defbodyarea(mei) subroutine(SelectRecords) loop(PrintNormal,@rs1,Key1,Key2) printreport($printMode,true,false) #------------------------------------------------- # Key1設定ルーチン #------------------------------------------------- [KeyInfo_key1] keyvalue(@rs1.mitsumori_no) keybreakproc(GroupBegin_key1,GroupEnd_key1) #------------------------------------------------- # Key1開始時 #------------------------------------------------- [GroupBegin_key1] deforgpage(blank) #Importするかどうか,FormatNormalするかどうか pageopen(true,false) deforgpage(formats) resetorg() #setdouble($row_count,10) #ヘッダ処理 putcell(6,2,取引先名:) putcell(7,2,工事名称:) putcell(9,2,No.) putcell(9,3,品名) putcell(9,4,型式) putcell(9,5,仕様) putcell(9,6,メーカー名) putcell(9,7,数量) putcell(9,8,単価) putcell(9,9,見積金額) putcell(9,10,原価) putcell(9,11,仕入金額) putcell(4,10,@rs1.mitsumori_no) putcell(6,3,@rs1.tok_nm) putcell(7,3,@rs1.title1) putcell(8,3,@rs1.title2) #明細開始行番号 formatspecialrow(9,0,9,1) setdouble($row_no,10) setdouble($start_row,$row_no) #------------------------------------------------- # Key1終了時 #------------------------------------------------- [GroupEnd_key1] #FormatNormalするかどうか #putformula($_row,4,SUM\x28R8C:R[-1]C\x29) #putformula($_row,5,SUM\x28R8C:R[-1]C\x29) #putformula($_row,6,SUM\x28R8C:R[-1]C\x29) #putformula($_row,7,\x28\x28RC[-3]\x2dRC[ -2]\x29\x2fRC[-3]\x29\x2a100) #= (( RC[-3] - RC[-2] ) / RC[-3] ) * 100 ) #putline(,,合計金額) setdouble($ttlrow,$row_no) concatenate($formula_str1,SUMIF\x28R,$start_row,C\x5b-3\x5d:R\x5b-2\x5dC\x5b-3\x5d\x2c\x22\x3c\x3e小計\x22\x2cR,$start_row,C:R\x5b-2\x5dC\x29) concatenate($formula_str2,SUMIF\x28R,$start_row,C\x5b-5\x5d:R\x5b-2\x5dC\x5b-5\x5d\x2c\x22\x3c\x3e小計\x22\x2cR,$start_row,C:R\x5b-2\x5dC\x29) #=SUMIF(R10C[-3]:R[-2]C[-3],"<>小計",R10C:R[-2]C) #=SUMIF(R10C[-5]:R[-2]C[-5],"<>小計",R10C:R[-2]C) putformula($ttlrow,9,$formula_str1) putformula($ttlrow,11,$formula_str2) #putline(,,,,,* * *合計* * *) putcell($ttlrow,6,* * *合計* * *) pageclose(false) #------------------------------------------------- # Key2設定ルーチン #------------------------------------------------- [KeyInfo_key2] keyvalue(@rs1.cat_cd) keybreakproc(GroupBegin_key2,GroupEnd_key2) #------------------------------------------------- # Key2開始時 #------------------------------------------------- [GroupBegin_key2] setdouble($cat_gokei_kingaku,@rs1.cat_gokei_kingaku) setdouble($cat_sir_gokei_kingaku,@rs1.cat_sir_gokei_kingaku) concatenate($cat_cd_nm,@rs1.cat_cd_nm) #setchar($cat_cd_nm,@rs1.rs1.cat_cd_nm) #------------------------------------------------- # Key2終了時 #------------------------------------------------- [GroupEnd_key2] #putline(,) #putline(,) #putline(,) #putline(,) #putline(,) #putcell($count,2,備考:) formatspecialrow($row_no,0,50,1) putline(,,,,,,,,$cat_gokei_kingaku#,,$cat_sir_gokei_kingaku#) putcell($row_no,4,$cat_cd_nm) putcell($row_no,6,小計) #putline() putline() sum($row_no,2) #[Type2] #formatspecialrow($row_no,0,50,1) #putline(,,,@rs1.cat_cd_nm,,小計,,,@rs1.cat_gokei_kingaku,,@rs1.cat_sir_gokei_kingaku) #putline() #sum($row_no,2) #------------------------------------------------- # SQL実行 #------------------------------------------------- [SelectRecords] new($param) #addparam($param,$s_id) addparam($param,$dt_from) addparam($param,$dt_to) addparam($param,$uri_no) addparam($param,$tokui_cd) addparam($param,$syohin_nm) addparam($param,$han_name) dbselect(SelectRecords,@rs1,$param) #------------------------------------------------- # 明細表示処理 #------------------------------------------------- [PrintNormal] formatspecialrow($row_no,0,51,1) putline(,,,,,,@rs1.jucyu_gokei_su#,@rs1.tanka#,@rs1.mitsu_kingaku#,@rs1.genka_gaku#,@rs1.sir_gaku#) #putcell($row_count,2,@rs1.s_row_no) #putcell($row_count,3,@rs1.hin_nm) #putcell($row_count,4,@rs1.hosoku2) #putcell($row_count,5,@rs1.meisai_biko) #putcell($row_count,6,@rs1.hosoku1) putcell($row_no,2,@rs1.s_row_no) putcell($row_no,3,@rs1.hin_nm) putcell($row_no,4,@rs1.hosoku2) putcell($row_no,5,@rs1.meisai_biko) putcell($row_no,6,@rs1.hosoku1) sum($row_no,1)