[Main] dbuse(true) initparam(printMode,reportId,han_name,bum_cd,bum_nm,tok_cat_cd,tok_cat_nm,sir_cat_cd,sir_cat_nm,dcat_cd_fr,dcat_cd_to,dcat_nm_fr,dcat_nm_to,cat_cd_fr,cat_cd_to,cat_nm_fr,cat_nm_to,syori_ymd_fr,syori_ymd_to,taisyo_y,taisyo_m,tok_cd_fr,tok_cd_to,sir_cd_fr,sir_cd_to,tan_cd_fr,tan_cd_to,tan_nm_fr,tan_nm_to,hin_cd_fr,hin_cd_to,put_on) deforgpage(blank) defheadarea(hed) defbodyarea(mei) subroutine(SelectRecords) #loop(PrintNormal,@rs1,Key1,key2) loop(PrintNormal,@rs1,Key1,Key3) printreport($printMode,true,,BASB0010:BASR0540) #------------------------------------------------- # SQL実行 #------------------------------------------------- [SelectRecords] new($param) addparam($param,$han_name) addparam($param,$bum_cd) addparam($param,$bum_nm) addparam($param,$tok_cat_cd) addparam($param,$tok_cat_nm) addparam($param,$sir_cat_cd) addparam($param,$sir_cat_nm) addparam($param,$dcat_cd_fr) addparam($param,$dcat_cd_to) addparam($param,$dcat_nm_fr) addparam($param,$dcat_nm_to) addparam($param,$cat_cd_fr) addparam($param,$cat_cd_to) addparam($param,$cat_nm_fr) addparam($param,$cat_nm_to) addparam($param,$syori_ymd_fr) addparam($param,$syori_ymd_to) addparam($param,$taisyo_y) addparam($param,$taisyo_m) addparam($param,$tok_cd_fr) addparam($param,$tok_cd_to) addparam($param,$sir_cd_fr) addparam($param,$sir_cd_to) addparam($param,$tan_cd_fr) addparam($param,$tan_cd_to) addparam($param,$tan_nm_fr) addparam($param,$tan_nm_to) addparam($param,$hin_cd_fr) addparam($param,$hin_cd_to) addparam($param,$put_on) dbselect(SelectRecords,@rs1,$param) #------------------------------------------------- # ヘッダ作成処理 #------------------------------------------------- [CleateHeader] #ヘッダ処理_ヘッダ putcell(9,1,$han_name) putcell(11,1,抽出条件:)#debug #putcell(12,25,単位 千円)#debug #ヘッダ処理_明細ヘッダ setdouble($row_head,14) #putcell($row_head,1,大分類) #putcell($row_head,2,分類) #putcell($row_head,3,品番) #putcell($row_head,4,品名) concatenate($st_ymd,$taisyo_y,/,$taisyo_m,/,01) putcell($row_head,7,$st_ymd) #計算式_代入 #concatenate($head_y,EDATE(RC[-1]\x2c1)) #concatenate($head_q,EDATE(RC[-2]\x2c1)) #putformula($row_head,8,$head_y) #putformula($row_head,9,$head_y) #putcell($row_head,10,1Q計) #putformula($row_head,11,$head_q) #putformula($row_head,12,$head_y) #putformula($row_head,13,$head_y) #putcell($row_head,14,2Q計) #putcell($row_head,15,上期計) #putformula($row_head,16,EDATE(RC[-3]\x2c1)) #putformula($row_head,17,$head_y) #putformula($row_head,18,$head_y) #putcell($row_head,19,3Q計) #putformula($row_head,20,$head_q) #putformula($row_head,21,$head_y) #putformula($row_head,22,$head_y) #putcell($row_head,23,4Q計) #putcell($row_head,24,下期計) #putcell($row_head,25,年度計) #------------------------------------------------- # グラフ表示処理 #------------------------------------------------- [SettingGraphData] #総合計を見つける位置 setdouble($lastSearchRowNo,$_row) sum($lastSearchRowNo,-20) putcell(2,2,$lastSearchRowNo) #年度_初期値 setdouble($hyouji_y,$taisyo_y) #年度_開始月 putcell(4,6,$st_ymd) #年度_今年 concatenate($nendo,$hyouji_y,年度) putcell(5,5,$nendo) sum($hyouji_y,-1) putcell(5,6,@rs1.uri01) putcell(5,7,@rs1.uri02) putcell(5,8,@rs1.uri03) putcell(5,9,@rs1.uri04) putcell(5,10,@rs1.uri05) putcell(5,11,@rs1.uri06) putcell(5,12,@rs1.uri07) putcell(5,13,@rs1.uri08) putcell(5,14,@rs1.uri09) putcell(5,15,@rs1.uri10) putcell(5,16,@rs1.uri11) putcell(5,17,@rs1.uri12) #年度_前年度 concatenate($nendo,$hyouji_y,年度) putcell(6,5,$nendo) sum($hyouji_y,-1) putcell(6,6,@rs1.uri01_ly) putcell(6,7,@rs1.uri02_ly) putcell(6,8,@rs1.uri03_ly) putcell(6,9,@rs1.uri04_ly) putcell(6,10,@rs1.uri05_ly) putcell(6,11,@rs1.uri06_ly) putcell(6,12,@rs1.uri07_ly) putcell(6,13,@rs1.uri08_ly) putcell(6,14,@rs1.uri09_ly) putcell(6,15,@rs1.uri10_ly) putcell(6,16,@rs1.uri11_ly) putcell(6,17,@rs1.uri12_ly) #年度_前前年度 concatenate($nendo,$hyouji_y,年度) putcell(7,5,$nendo) putcell(7,6,@rs1.uri01_2ya) putcell(7,7,@rs1.uri02_2ya) putcell(7,8,@rs1.uri03_2ya) putcell(7,9,@rs1.uri04_2ya) putcell(7,10,@rs1.uri05_2ya) putcell(7,11,@rs1.uri06_2ya) putcell(7,12,@rs1.uri07_2ya) putcell(7,13,@rs1.uri08_2ya) putcell(7,14,@rs1.uri09_2ya) putcell(7,15,@rs1.uri10_2ya) putcell(7,16,@rs1.uri11_2ya) putcell(7,17,@rs1.uri12_2ya) #------------------------------------------------- # 横計処理 #------------------------------------------------- [Cleate_colsum] #計算式_代入 concatenate($formula_colsum,(RC[-3]+RC[-2]+RC[-1])) concatenate($formula_colsum_q,(RC[-5]+RC[-1])) concatenate($formula_colsum_y,(RC[-10]+RC[-1])) putformula($_row,10,$formula_colsum)#1Q計 putformula($_row,14,$formula_colsum)#2Q計 putformula($_row,15,$formula_colsum_q)#上期計 putformula($_row,19,$formula_colsum)#3Q計 putformula($_row,23,$formula_colsum)#4Q計 putformula($_row,24,$formula_colsum_q)#下期計 putformula($_row,25,$formula_colsum_y)#年度計 #------------------------------------------------- # 横計粗利処理 #------------------------------------------------- [Cleate_colarasum] #計算式_代入 #concatenate($formula_arasum,IF(ISERROR((((R[-2]C)-((R[-2]C)-(R[-1]C)))/(R[-2]C))*100)\x2c0\x2cROUND((((R[-2]C)-((R[-2]C)-(R[-1]C)))/(R[-2]C))*100\x2c2)\x26\x22\x25\x22)) concatenate($formula_arasum,IF(R[-2]C\x3d0\x2c0\x2cROUND((((R[-2]C)-((R[-2]C)-(R[-1]C)))/(R[-2]C))*100\x2c2))) putformula($_row,10,$formula_arasum)#1Q計 putformula($_row,14,$formula_arasum)#2Q計 putformula($_row,15,$formula_arasum)#上期計 putformula($_row,19,$formula_arasum)#3Q計 putformula($_row,23,$formula_arasum)#4Q計 putformula($_row,24,$formula_arasum)#下期計 putformula($_row,25,$formula_arasum)#年度計 #------------------------------------------------- # 横計対比処理 #------------------------------------------------- [Cleate_coltaihisum] #$zen_row1,-3,-3 #$zen_row2,-4,5 #計算式_代入 #concatenate($formula_taihi,IF(ISERROR(((R[,$zen_row1,]C)/(R[,$zen_row2,]C))*100)\x2c0\x2cROUND(((R[,$zen_row1,]C)/(R[,$zen_row2,]C))*100\x2c2)\x26\x22\x25\x22)) concatenate($formula_taihi,IF(R[,$zen_row2,]C\x3d0\x2c0\x2cROUND(((R[,$zen_row1,]C)/(R[,$zen_row2,]C))*100\x2c2))) putformula($_row,7,$formula_taihi) putformula($_row,8,$formula_taihi) putformula($_row,9,$formula_taihi) putformula($_row,10,$formula_taihi) putformula($_row,11,$formula_taihi) putformula($_row,12,$formula_taihi) putformula($_row,13,$formula_taihi) putformula($_row,14,$formula_taihi) putformula($_row,15,$formula_taihi) putformula($_row,16,$formula_taihi) putformula($_row,17,$formula_taihi) putformula($_row,18,$formula_taihi) putformula($_row,19,$formula_taihi) putformula($_row,20,$formula_taihi) putformula($_row,21,$formula_taihi) putformula($_row,22,$formula_taihi) putformula($_row,23,$formula_taihi) putformula($_row,24,$formula_taihi) putformula($_row,25,$formula_taihi) #------------------------------------------------- # Key1設定ルーチン #------------------------------------------------- [KeyInfo_key1] keyvalue(dummy) keybreakproc(GroupBegin_key1,GroupEnd_key1) #------------------------------------------------- # Key1開始時 #------------------------------------------------- [GroupBegin_key1] deforgpage(blank) #Importするかどうか,FormatNormalするかどうか pageopen(true,false) deforgpage(formats) resetorg() #ヘッダ作成処理 subroutine(CleateHeader) #------------------------------------------------- # Key1終了時 #------------------------------------------------- [GroupEnd_key1] #グラフ作成処理 subroutine(SettingGraphData) pageclose(false) #------------------------------------------------- # Key2設定ルーチン #------------------------------------------------- [KeyInfo_key2] keyvalue(@rs1.cd2) keybreakproc(GroupBegin_key2,GroupEnd_key2) #------------------------------------------------- # Key2開始時 #------------------------------------------------- [GroupBegin_key2] formatspecialrow($_row,0,7,1) #見出し行処理 putcell($_row,1,@rs1.cd2) putcell($_row,2,@rs1.han2) putline() #------------------------------------------------- # Key2終了時 #------------------------------------------------- [GroupEnd_key2] #------------------------------------------------- # Key3設定ルーチン #------------------------------------------------- [KeyInfo_Key3] keyvalue(@rs1.cd2,@rs1.cd) keybreakproc(GroupBegin_Key3,GroupEnd_Key3) #------------------------------------------------- # Key3開始時 #------------------------------------------------- [GroupBegin_Key3] formatspecialrow($_row,0,8,1) #見出し行処理 putcell($_row,2,@rs1.cd) putcell($_row,3,@rs1.han) putline() #------------------------------------------------- # Key3終了時 #------------------------------------------------- [GroupEnd_Key3] #------------------------------------------------- # 明細表示処理 #------------------------------------------------- [PrintNormal] #明細フォーマット表示 formatspecialrow($_row,0,9,14) #3行目処理 #putcell($_row,3,@rs1.hin_cd) #putcell($_row,4,@rs1.hin_nm) #年度に対象年をセット setdouble($hyouji_y,$taisyo_y) concatenate($nendo,$hyouji_y,年度) #putcell($_row,5,$nendo) #横計処理 subroutine(Cleate_colsum) #putcell($_row,6,売上数) putline(,,@rs1.hin_cd#,@rs1.hin_nm#,$nendo#,売上数#,@rs1.uri01_suryo#,@rs1.uri02_suryo#,@rs1.uri03_suryo#,,@rs1.uri04_suryo#,@rs1.uri05_suryo#,@rs1.uri06_suryo#,,,@rs1.uri07_suryo#,@rs1.uri08_suryo#,@rs1.uri09_suryo#,,@rs1.uri10_suryo#,@rs1.uri11_suryo#,@rs1.uri12_suryo#,,) #4行目処理 #横計処理 subroutine(Cleate_colsum) #putcell($_row,6,売上額) putline(,,,,,売上額#,@rs1.uri01#,@rs1.uri02#,@rs1.uri03#,,@rs1.uri04#,@rs1.uri05#,@rs1.uri06#,,,@rs1.uri07#,@rs1.uri08#,@rs1.uri09#,,@rs1.uri10#,@rs1.uri11#,@rs1.uri12#,,) #5行目処理 #横計処理 subroutine(Cleate_colsum) #putcell($_row,6,粗利額) putline(,,,,,粗利額#,@rs1.arari01#,@rs1.arari02#,@rs1.arari03#,,@rs1.arari04#,@rs1.arari05#,@rs1.arari06#,,,@rs1.arari07#,@rs1.arari08#,@rs1.arari09#,,@rs1.arari10#,@rs1.arari11#,@rs1.arari12#,,) #6行目処理 #横計粗利処理 subroutine(Cleate_colarasum) #putcell($_row,6,粗利率) putline(,,,,,粗利率#,@rs1.arari01_ritu#,@rs1.arari02_ritu#,@rs1.arari03_ritu#,,@rs1.arari04_ritu#,@rs1.arari05_ritu#,@rs1.arari06_ritu#,,,@rs1.arari07_ritu#,@rs1.arari08_ritu#,@rs1.arari09_ritu#,,@rs1.arari10_ritu#,@rs1.arari11_ritu#,@rs1.arari12_ritu#,,) #7行目処理 #計算式_代入 setdouble($zen_row1,-3) setdouble($zen_row2,3) #横計対比処理 subroutine(Cleate_coltaihisum) #putcell($_row,6,前年度対比) putline(,,,,,前年度対比#) #8行目処理 #計算式_代入 sum($zen_row1,-1) sum($zen_row2,3) #横計対比処理 subroutine(Cleate_coltaihisum) #putcell($_row,6,前々年度対比) putline(,,,,,前々年度対比#) #9行目処理 #年度の表示調整 sum($hyouji_y,-1) concatenate($nendo,$hyouji_y,年度) #putcell($_row,5,$nendo) #横計処理 subroutine(Cleate_colsum) #putcell($_row,6,売上数) putline(,,,,$nendo#,売上数#,@rs1.uri01_ly_suryo#,@rs1.uri02_ly_suryo#,@rs1.uri03_ly_suryo#,,@rs1.uri04_ly_suryo#,@rs1.uri05_ly_suryo#,@rs1.uri06_ly_suryo#,,,@rs1.uri07_ly_suryo#,@rs1.uri08_ly_suryo#,@rs1.uri09_ly_suryo#,,@rs1.uri10_ly_suryo#,@rs1.uri11_ly_suryo#,@rs1.uri12_ly_suryo#,,) #10行目処理 #横計処理 subroutine(Cleate_colsum) #putcell($_row,6,売上額) putline(,,,,,売上額#,@rs1.uri01_ly#,@rs1.uri02_ly#,@rs1.uri03_ly#,,@rs1.uri04_ly#,@rs1.uri05_ly#,@rs1.uri06_ly#,,,@rs1.uri07_ly#,@rs1.uri08_ly#,@rs1.uri09_ly#,,@rs1.uri10_ly#,@rs1.uri11_ly#,@rs1.uri12_ly#,,) #11行目処理 #横計処理 subroutine(Cleate_colsum) #putcell($_row,6,粗利額) putline(,,,,,粗利額#,@rs1.arari01_ly#,@rs1.arari02_ly#,@rs1.arari03_ly#,,@rs1.arari04_ly#,@rs1.arari05_ly#,@rs1.arari06_ly#,,,@rs1.arari07_ly#,@rs1.arari08_ly#,@rs1.arari09_ly#,,@rs1.arari10_ly#,@rs1.arari11_ly#,@rs1.arari12_ly#,,) #12行目処理 #横計粗利処理 subroutine(Cleate_colarasum) #putcell($_row,6,粗利率) putline(,,,,,粗利率#,@rs1.arari01_ly_ritu#,@rs1.arari02_ly_ritu#,@rs1.arari03_ly_ritu#,,@rs1.arari04_ly_ritu#,@rs1.arari05_ly_ritu#,@rs1.arari06_ly_ritu#,,,@rs1.arari07_ly_ritu#,@rs1.arari08_ly_ritu#,@rs1.arari09_ly_ritu#,,@rs1.arari10_ly_ritu#,@rs1.arari11_ly_ritu#,@rs1.arari12_ly_ritu#,,) #13行目処理 #年度の表示調整 sum($hyouji_y,-1) concatenate($nendo,$hyouji_y,年度) #putcell($_row,5,$nendo) #横計処理 subroutine(Cleate_colsum) #putcell($_row,6,売上数) putline(,,,,$nendo#,売上数#,@rs1.uri01_2ya_suryo#,@rs1.uri02_2ya_suryo#,@rs1.uri03_2ya_suryo#,,@rs1.uri04_2ya_suryo#,@rs1.uri05_2ya_suryo#,@rs1.uri06_2ya_suryo#,,,@rs1.uri07_2ya_suryo#,@rs1.uri08_2ya_suryo#,@rs1.uri09_2ya_suryo#,,@rs1.uri10_2ya_suryo#,@rs1.uri11_2ya_suryo#,@rs1.uri12_2ya_suryo#,,) #14行目処理 #横計処理 subroutine(Cleate_colsum) #putcell($_row,6,売上額) putline(,,,,,売上額#,@rs1.uri01_2ya#,@rs1.uri02_2ya#,@rs1.uri03_2ya#,,@rs1.uri04_2ya#,@rs1.uri05_2ya#,@rs1.uri06_2ya#,,,@rs1.uri07_2ya#,@rs1.uri08_2ya#,@rs1.uri09_2ya#,,@rs1.uri10_2ya#,@rs1.uri11_2ya#,@rs1.uri12_2ya#,,) #15行目処理 #横計処理 subroutine(Cleate_colsum) #putcell($_row,6,粗利額) putline(,,,,,粗利額#,@rs1.arari01_2ya#,@rs1.arari02_2ya#,@rs1.arari03_2ya#,,@rs1.arari04_2ya#,@rs1.arari05_2ya#,@rs1.arari06_2ya#,,,@rs1.arari07_2ya#,@rs1.arari08_2ya#,@rs1.arari09_2ya#,,@rs1.arari10_2ya#,@rs1.arari11_2ya#,@rs1.arari12_2ya#,,) #16行目処理 #横計粗利処理 subroutine(Cleate_colarasum) #putcell($_row,6,粗利率) putline(,,,,,粗利率#,@rs1.arari01_2ya_ritu#,@rs1.arari02_2ya_ritu#,@rs1.arari03_2ya_ritu#,,@rs1.arari04_2ya_ritu#,@rs1.arari05_2ya_ritu#,@rs1.arari06_2ya_ritu#,,,@rs1.arari07_2ya_ritu#,@rs1.arari08_2ya_ritu#,@rs1.arari09_2ya_ritu#,,@rs1.arari10_2ya_ritu#,@rs1.arari11_2ya_ritu#,@rs1.arari12_2ya_ritu#,,)