[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,Key0,Key1,Key2) printreport($printMode,true,false) #------------------------------------------------- # Key0設定ルーチン #------------------------------------------------- [KeyInfo_Key0] keyvalue(dummy) keybreakproc(GroupBegin_Key0,GroupEnd_Key0) #------------------------------------------------- # Key0開始時 #------------------------------------------------- [GroupBegin_Key0] deforgpage(blank) #Importするかどうか,FormatNormalするかどうか pageopen(true,false) deforgpage(formats) resetorg() #【合計】リセット #集計:前月・残高 setdouble($all_nyukin_yotei_gaku,0) #集計:振込 setdouble($all_nyukin_furikomi,0) #集計:現金 setdouble($all_nyukin_genkin,0) #集計:小切手 setdouble($all_nyukin_kogitte,0) #集計:手形 setdouble($all_nyukin_tegata,0) #集計:相殺 setdouble($all_nyukin_sousai,0) #集計:手数料 setdouble($all_nyukin_tesuryo,0) #集計:その他 setdouble($all_nyukin_sonota,0) #集計:売上 setdouble($all_uri_zeinuki_gaku,0) #集計:消費税 setdouble($all_uri_zei_gaku,0) #集計:売上合計 setdouble($all_uri_zeikomi_gaku,0) #集計:返品合計 setdouble($all_urihen_zeikomi_gaku,0) #集計:今月繰越 setdouble($all_kurikosi_gaku,0) #集計:全体繰越 setdouble($all_kurikosi_all,0) #集計:入金額 setdouble($all_nyukin_gaku,0) #ヘッダ処理_ヘッダー #concatenate($syori_ym_s,対象年月,:,@rs1.syori_ym_s) putcell(1,2,@rs1.syori_ym_s) #空行 #putline(,) putline(,) #------------------------------------------------- # Key0終了時 #------------------------------------------------- [GroupEnd_Key0] formatspecialrow(5,0,6,2) concatenate($goukei,【,合計,】) #集計 putcell(5,2,$goukei) putcell(5,3,'--) putcell(5,4,'--) putcell(5,5,'--) putcell(5,6,'--) putcell(5,7,$all_nyukin_yotei_gaku) putcell(5,8,'--) putcell(5,9,$all_nyukin_furikomi) putcell(5,10,$all_nyukin_genkin) putcell(5,11,$all_nyukin_kogitte) putcell(5,12,'--) putcell(5,13,$all_nyukin_tegata) putcell(5,14,$all_nyukin_tesuryo) putcell(5,15,$all_nyukin_sousai) putcell(5,16,$all_nyukin_sonota) putcell(5,17,$all_uri_zeikomi_gaku) putcell(5,18,$all_urihen_zeikomi_gaku) putcell(5,19,$all_kurikosi_gaku) putcell(5,20,$all_kurikosi_all) pageclose(false) #------------------------------------------------- # Key1設定ルーチン #------------------------------------------------- [KeyInfo_key1] keyvalue(@rs1.uri_row_kai) keybreakproc(GroupBegin_key1,GroupEnd_key1) #------------------------------------------------- # Key1開始時 #------------------------------------------------- [GroupBegin_key1] #【小計】リセット #集計:前月・残高 setdouble($sum_nyukin_yotei_gaku,0) #集計:振込 setdouble($sum_nyukin_furikomi,0) #集計:現金 setdouble($sum_nyukin_genkin,0) #集計:小切手 setdouble($sum_nyukin_kogitte,0) #集計:手形 setdouble($sum_nyukin_tegata,0) #集計:相殺 setdouble($sum_nyukin_sousai,0) #集計:手数料 setdouble($sum_nyukin_tesuryo,0) #集計:その他 setdouble($sum_nyukin_sonota,0) #集計:売上 setdouble($sum_uri_zeinuki_gaku,0) #集計:消費税 setdouble($sum_uri_zei_gaku,0) #集計:売上合計 setdouble($sum_uri_zeikomi_gaku,0) #集計:返品合計 setdouble($sum_urihen_zeikomi_gaku,0) #集計:今月繰越 setdouble($sum_kurikosi_gaku,0) #集計:全体繰越 setdouble($sum_kurikosi_all,0) #集計:入金額 setdouble($sum_nyukin_gaku,0) #------------------------------------------------- # Key1終了時 #------------------------------------------------- [GroupEnd_key1] formatspecialrow($_row,0,8,1) concatenate($syoukei,【,小計,】) #集計 putcell($_row,2,$syoukei) #putline(,,,$sum_zen_seikyu_zan#,$sum_zeinuki_gaku#,$sum_zei_gaku#,$sum_zeikomi_gaku#,,$sum_furikomi#,$sum_genkin#,$sum_kogitte#,$sum_tegata#,,$sum_sousai#,$sum_tesuryo#,$sum_sonota#,$sum_kurikosi_gaku#,) putline(,,,,,,$sum_nyukin_yotei_gaku#,,$sum_nyukin_furikomi#,$sum_nyukin_genkin#,$sum_nyukin_kogitte#,,$sum_nyukin_tegata#,$sum_nyukin_tesuryo#,$sum_nyukin_sousai#,$sum_nyukin_sonota#,$sum_uri_zeikomi_gaku#,$sum_urihen_zeikomi_gaku#,$sum_kurikosi_gaku#,$sum_kurikosi_all#) #【合計用】 #集計:前月・残高 sum($all_nyukin_yotei_gaku,$sum_nyukin_yotei_gaku) #集計:振込 sum($all_nyukin_furikomi,$sum_nyukin_furikomi) #集計:現金 sum($all_nyukin_genkin,$sum_nyukin_genkin) #集計:小切手 sum($all_nyukin_kogitte,$sum_nyukin_kogitte) #集計:手形 sum($all_nyukin_tegata,$sum_nyukin_tegata) #集計:手数料 sum($all_nyukin_tesuryo,$sum_nyukin_tesuryo) #集計:相殺 sum($all_nyukin_sousai,$sum_nyukin_sousai) #集計:その他 sum($all_nyukin_sonota,$sum_nyukin_sonota) #集計:売上 sum($all_uri_zeinuki_gaku,$sum_uri_zeinuki_gaku) #集計:消費税 sum($all_uri_zei_gaku,$sum_uri_zei_gaku) #集計:売上合計 sum($all_uri_zeikomi_gaku,$sum_uri_zeikomi_gaku) #集計:返品合計 sum($all_urihen_zeikomi_gaku,$sum_urihen_zeikomi_gaku) #集計:今月繰越 sum($all_kurikosi_gaku,$sum_kurikosi_gaku) #集計:全体繰越 sum($all_kurikosi_all,$sum_kurikosi_all) #集計:入金額 sum($all_nyukin_gaku,$sum_nyukin_gaku) #改ページ処理 HPAGEBREAK($_row) #------------------------------------------------- # Key2設定ルーチン #------------------------------------------------- [KeyInfo_key2] keyvalue(@rs1.tok_cd) keybreakproc(GroupBegin_key2,GroupEnd_key2) #------------------------------------------------- # Key2開始時 #------------------------------------------------- [GroupBegin_key2] #------------------------------------------------- # Key2終了時 #------------------------------------------------- [GroupEnd_key2] #集計:前月・残高 sum($sum_nyukin_yotei_gaku,$end_nyukin_yotei_gaku) #集計:振込 sum($sum_nyukin_furikomi,$end_nyukin_furikomi) #集計:現金 sum($sum_nyukin_genkin,$end_nyukin_genkin) #集計:小切手 sum($sum_nyukin_kogitte,$end_nyukin_kogitte) #集計:手形 sum($sum_nyukin_tegata,$end_nyukin_tegata) #集計:手数料 sum($sum_nyukin_tesuryo,$end_nyukin_tesuryo) #集計:相殺 sum($sum_nyukin_sousai,$end_nyukin_sousai) #集計:その他 sum($sum_nyukin_sonota,$end_nyukin_sonota) #集計:売上 sum($sum_uri_zeinuki_gaku,$end_uri_zeinuki_gaku) #集計:消費税 sum($sum_uri_zei_gaku,$end_uri_zei_gaku) #集計:売上合計 sum($sum_uri_zeikomi_gaku,$end_uri_zeikomi_gaku) #集計:返品合計 sum($sum_urihen_zeikomi_gaku,$end_urihen_zeikomi_gaku) #集計:今月繰越 sum($sum_kurikosi_gaku,$end_kurikosi_gaku) #集計:全体繰越 sum($sum_kurikosi_all,$end_kurikosi_all) #集計:入金額 sum($sum_nyukin_gaku,$end_nyukin_gaku) #------------------------------------------------- # 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) #------------------------------------------------- # 明細表示処理 #------------------------------------------------- [PrintNormal] #横計変数初期化 setdouble($nyukin_gaku,0) setdouble($kurikosi_gaku,0) setdouble($kurikosi_all,0) #集計:入金額 = 振込+現金+小切手+手形+相殺+手数料+その他 sum($nyukin_gaku,@rs1.nyukin_furikomi) sum($nyukin_gaku,@rs1.nyukin_genkin) sum($nyukin_gaku,@rs1.nyukin_kogitte) sum($nyukin_gaku,@rs1.nyukin_tegata) sum($nyukin_gaku,@rs1.nyukin_sousai) sum($nyukin_gaku,@rs1.nyukin_tesuryo) sum($nyukin_gaku,@rs1.nyukin_sonota) #集計:繰越額 = (繰越残 + 売上合計) - 入金額 sum($kurikosi_gaku,@rs1.nyukin_yotei_gaku) diff($kurikosi_gaku,$nyukin_gaku) #集計:全体繰越 = (前月時点繰越額 + 今月繰越額) sum($kurikosi_all,@rs1.zen_zan) sum($kurikosi_all,$kurikosi_gaku) #【小計】用 #集計:前月・残高 #sum($sum_zen_seikyu_zan,@rs1.zen_seikyu_zan) setdouble($end_nyukin_yotei_gaku,@rs1.nyukin_yotei_gaku) #集計:振込 #sum($sum_furikomi,@rs1.furikomi) setdouble($end_nyukin_furikomi,@rs1.nyukin_furikomi) #集計:現金 #sum($sum_genkin,@rs1.genkin) setdouble($end_nyukin_genkin,@rs1.nyukin_genkin) #集計:小切手 #sum($sum_kogitte,@rs1.kogitte) setdouble($end_nyukin_kogitte,@rs1.nyukin_kogitte) #集計:手形 #sum($sum_tegata,@rs1.tegata) setdouble($end_nyukin_tegata,@rs1.nyukin_tegata) #集計:相殺 #sum($sum_sousai,@rs1.sousai) setdouble($end_nyukin_sousai,@rs1.nyukin_sousai) #集計:手数料 #sum($sum_tesuryo,@rs1.tesuryo) setdouble($end_nyukin_tesuryo,@rs1.nyukin_tesuryo) #集計:その他 #sum($sum_sonota,@rs1.sonota) setdouble($end_nyukin_sonota,@rs1.nyukin_sonota) #集計:売上 #sum($sum_zeinuki_gaku,@rs1.zeinuki_gaku) setdouble($end_uri_zeinuki_gaku,@rs1.uri_zeinuki_gaku) #集計:消費税 #sum($sum_zei_gaku,@rs1.zei_gaku) setdouble($end_uri_zei_gaku,@rs1.uri_zei_gaku) #集計:売上合計 #sum($sum_zeikomi_gaku,@rs1.zeikomi_gaku) setdouble($end_uri_zeikomi_gaku,@rs1.zeikomi_gaku) #集計:返品合計 setdouble($end_urihen_zeikomi_gaku,@rs1.urihen_zeikomi_gaku) #集計:今月繰越 #sum($sum_kurikosi_gaku,$kurikosi_gaku) setdouble($end_kurikosi_gaku,$kurikosi_gaku) #集計:全体繰越 #sum($sum_kurikosi_all,$kurikosi_all) setdouble($end_kurikosi_all,$kurikosi_all) #集計:入金額 #sum($sum_nyukin_gaku,$nyukin_gaku) setdouble($end_nyukin_gaku,$nyukin_gaku) #直前の得意先と同じか判定 #case($type0,$tokCd,@rs1.tok_cd,0,1) #case($type1,$tokCd,@rs1.tok_cd,1,0) #【format】 #iterate(Type0,$type0) #iterate(Type1,$type1) #明細表示処理 formatspecialrow($_row,0,6,1) putcell($_row,2,@rs1.tok_nm_s) #putcell($_row,3,@rs1.nyukin_yotei_ymd) putcell($_row,3,@rs1.syori_ym) putcell($_row,4,@rs1.shime_dd) putcell($_row,5,@rs1.pay_md_s) putcell($_row,6,@rs1.tori_cond) putcell($_row,8,@rs1.nyukin_ymd_cash) putcell($_row,12,@rs1.nyukin_ymd_tegata) #putline(,,,,,,@rs1.zen_seikyu_zan#,,@rs1.furikomi#,@rs1.genkin#,@rs1.kogitte#,,@rs1.tegata#,@rs1.tesuryo#,@rs1.sousai#,@rs1.sonota#,@rs1.zeikomi_gaku#,,,$kurikosi_gaku#,) putline(,,,,,,@rs1.nyukin_yotei_gaku#,,@rs1.nyukin_furikomi#,@rs1.nyukin_genkin#,@rs1.nyukin_kogitte#,,@rs1.nyukin_tegata#,@rs1.nyukin_tesuryo#,@rs1.nyukin_sousai#,@rs1.nyukin_sonota#,@rs1.zeikomi_gaku#,@rs1.urihen_zeikomi_gaku#,$kurikosi_gaku#,$kurikosi_all#) [Type0] formatspecialrow($_row,0,8,1) concatenate($tokCd,@rs1.tok_cd) [Type1] formatspecialrow($_row,0,7,1) setdouble()