納品書印刷の一例             <TOP>


A4用紙縦置きで納品書(控)・納品書・請求書を印刷します。

3枚の伝票の境界には点線を入れます。

フォント・文字色(必要はありませんがテスト用)の設定ができます。フォントサイズはプログラム上で指定していますので無効です。

フォーム画面(納品書控えのみ表示)

印字例

'================================================================
'= 納品書印刷の一例
'================================================================
#include "Windows.bi"

Var Shared MAINFORM As Object
Var Shared PIC As Object
Var Shared PRT As Object

PRINTERObject PRT
Var Shared PRM As PRINTPARAM
Var Shared FFONT As FONT            'フォント構造体
Var Shared F_NAME$ As String
Var Shared RGBCOLOR As Long

MAINFORM.ATTACH GETHWND
PIC.ATTACH GETDLGITEM("PICTURE1")

Declare Sub TEST_DRAW edecl ()

'================================================================
'=
'================================================================
Declare Sub MAINFORM_START edecl ()
Sub MAINFORM_START()
    SETWINDOWTEXT "納品書印字例"
    line(16,16)-(860,422),,15,bf
    F_NAME$ = "MS ゴシック"
    RGBCOLOR = RGB(0,0,0)
    PIC.SETFORECOLOR RGBCOLOR
    PIC.SETFONTNAME F_NAME$
    PIC.SETMAPMODE 2
    PIC.TEST_DRAW
End Sub

'================================================================
'=
'================================================================
Sub TEST_DRAW()
    Var LX As Integer             'X軸オフセット
    Var LY As Integer             'Y軸オフセット
    Var ZL As Integer             '枠(Left)
    Var ZU As Integer             '枠(Top)
    Var ZR As Integer             '枠(Right)
    Var ZB As Integer             '枠(Bottom)
    Var ZC As Integer             '行間

    SETFORECOLOR RGBCOLOR
    ZA$(1) = "A"
    ZA$(2) = "B"
    ZA$(3) = "C"
    ZB$(1) = "納品書(控)"
    ZB$(2) = "納  品  書"
    ZB$(3) = "請  求  書"
    ZC$(1) = "下記の通り納品致しました。"
    ZC$(2) = "下記の通り納品致しました。"
    ZC$(3) = "下記の通りご請求申しあげます。"

    '------------------------------
    '納品書(控)・納品書・請求書
    '------------------------------
    For CT = 1 To 3
        goSub *PRT_STYLE
    Next
    Exit Sub

    '------------------------------
    *PRT_STYLE
    '------------------------------
    *PRT_LOC
    If CT = 1 Then
        LY = 0
    Else If CT = 2 Then
        LY = 990
    Else
        LY = 1980
    End If

    ZL = 900 : ZU = 0 : ZR = 1350 : ZB = 60 : ZC = 20
    If CT = 1 Then
        SETDRAWWIDTH 2
        goto *JP
    Else If CT = 2 Then
        SETFILLCOLOR &HE0E0E0
        SETDRAWWIDTH 2
    Else If CT = 3 Then
        SETFILLCOLOR &HC0C0C0
        SETDRAWWIDTH 3
    End If
    line(ZL+5,ZU+5+LY)-(ZR-5,ZB-5+LY),preset,,bf

    *JP
    SETFORECOLOR &H0
    line  (ZL+ZC,ZU   +LY)-(ZR-ZC,ZU+LY)        '  ━━
    circle(ZL+ZC,ZU+ZC+LY),ZC,,,.5,.75          '┏ 
    circle(ZR-ZC,ZU+ZC+LY),ZC,,,.75,0           '      ┓
    line  (ZL   ,ZU+ZC+LY)-(ZL,ZB-ZC+LY)        '┃
    line  (ZR   ,ZU+ZC+LY)-(ZR,ZB-ZC+LY)        '      ┃
    circle(ZL+ZC,ZB-ZC+LY),ZC,,,.25,.5          '┗
    circle(ZR-ZC,ZB-ZC+LY),ZC,,,0,.25           '      ┛
    line  (ZL+ZC,ZB   +LY)-(ZR-ZC,ZB+LY)        '  ━━
    SETDRAWWIDTH 0

    SETFILLCOLOR &HE0E0E0
    line( 175, 315+LY)-(1925, 365+LY),preset,,bf

    '------------------------------
    '外枠角丸 
    '------------------------------
    ZL = 170 : ZU = 310 : ZR = 1930 : ZB = 770
    SETDRAWWIDTH 3
    line  (ZL+ZC,ZU   +LY)-(ZR-ZC,ZU+LY)        '  ━━
    circle(ZL+ZC,ZU+ZC+LY),ZC,,,.5,.75          '┏ 
    circle(ZR-ZC,ZU+ZC+LY),ZC,,,.75,0           '      ┓
    line  (ZL   ,ZU+ZC+LY)-(ZL,ZB-ZC+LY)        '┃
    circle(ZL+ZC,ZB-ZC+LY),ZC,,,.25,.5          '┗
    line  (ZL+ZC,ZB   +LY)-(ZR,ZB+LY)           '  ━━
    ZB = 850 : ZR = 1930
    line  (ZR   ,ZU+ZC+LY)-(ZR,ZB-ZC+LY)        '      ┃
    circle(ZR-ZC,ZB-ZC+LY),ZC,,,0,.25           '      ┛
    ZL = 950
    line  (ZL+ZC,ZB   +LY)-(ZR-ZC,ZB+LY)        '  ━━
    circle(ZL+ZC,ZB-ZC+LY),ZC,,,.25,.5          '┗
    ZU = 770
    line  (ZL   ,ZU+LY)-(ZL,ZB-ZC+LY)           '┃
    SETDRAWWIDTH 0

    For I = 370 To 690 step 80
        line( 170,I+LY)-(ZR,I+LY)
    Next

    line( 170, 850+LY)-( 900, 850+LY)

    line(1800,  80+LY)-(1930,  80+LY)
    line(1380, 260+LY)-(1920, 260+LY)
    line( 820, 310+LY)-( 820, 770+LY)
    line( 970, 310+LY)-( 970, 770+LY)
    line(1070, 310+LY)-(1070, 770+LY)

    line(1340, 310+LY)-(1340, 770+LY)
    line(1670, 310+LY)-(1670, 770+LY)

    line(1060, 770+LY)-(1060, 850+LY)
    line(1110, 770+LY)-(1110, 850+LY)
    line(1380, 770+LY)-(1380, 850+LY)
    line(1430, 770+LY)-(1430, 850+LY)
    line(1610, 770+LY)-(1610, 850+LY)
    line(1660, 770+LY)-(1660, 850+LY)

    SETDRAWSTYLE 4
    line(   0, 940+LY)-(1980, 940+LY)        '……… 切取線
    SETDRAWSTYLE 0
    circle(  60,  45+LY),30                  '○
    line(   0, 445+LY)-(  30, 445+LY)        '-      伝票センター
    SETFONTNAME F_NAME$
    SETFONTSIZE 11
    symbol(  30, 425+LY),ZA$(CT),1,1
    circle(  60, 845+LY),30                  '○

    SETFORECOLOR RGBCOLOR
    SETFONTSIZE 9
    symbol( 170,  40+LY),"お客様コード",1,1
    symbol(1800,  40+LY),"No.",1,1
    symbol(1060,  70+LY),"年",1,1
    symbol(1180,  70+LY),"月",1,1
    symbol(1300,  70+LY),"日",1,1
    SETFONTSIZE 12
    symbol(1380, 105+LY),"株式会社 北海○○販売",1,1
    SETFONTSIZE 9
    symbol(1380, 150+LY),"札幌市白石区本通10丁目南7-13",1,1
    symbol(1380, 185+LY),"電話011-866-1234・FAX011-866-5678",1,1
    symbol(1380, 220+LY),"担当:",1,1
    symbol(1380, 270+LY),ZC$(CT),1,1
    symbol( 170, 810+LY),"摘要:",1,1
    SETFONTSIZE 12
    symbol(1030,   8+LY),ZB$(CT),1,1
    SETFONTSIZE 9
    symbol( 350, 320+LY),"品   名 ・ 品   番",1,1
    symbol( 850, 320+LY),"数  量",1,1
    symbol( 990, 320+LY),"単位",1,1
    symbol(1150, 320+LY),"単  価",1,1
    symbol(1450, 320+LY),"金  額",1,1
    symbol(1730, 320+LY),"備  考",1,1
    symbol( 970, 795+LY),"合計",1,1
    symbol(1070, 780+LY),"税",1,1
    symbol(1070, 810+LY),"抜",1,1
    symbol(1390, 780+LY),"税",1,1
    symbol(1390, 810+LY),"額",1,1
    symbol(1620, 780+LY),"総",1,1
    symbol(1620, 810+LY),"額",1,1
    return
End Sub

'================================================================
'= フォント選択(フォントスタイル・サイズは無効:プログラム上で指定)
'================================================================
Declare Sub BUTTON1_ON edecl ()
Sub BUTTON1_ON()
    FFONT.FFNAME = F_NAME$
    If CHOOSEFONT(FFONT, RGBCOLOR, -1, 0) Then
        F_NAME$ = kLeft$(FFONT.FFNAME,kinstr(FFONT.FFNAME, Chr$(0))-1)
    End If

    PIC.cls
    PIC.TEST_DRAW
End Sub

'================================================================
'= 印刷ダイアログ
'================================================================
Declare Sub BUTTON2_ON edecl ()
Sub BUTTON2_ON()
    PRT.SETUPPRINTERMODE "SETUPPRINTER:",9,1
    If PRT.PRINTDLG(PRM) = 0 Then Exit Sub
    PRT.SETMAPMODE 2
    PRT.STARTDOC "Sample"
    PRT.STARTPAGE

    PRT.TEST_DRAW

    PRT.ENDPAGE
    PRT.ENDDOC
    PRT.CLOSEPRINTER
End Sub

'================================================================
'= 
'================================================================
While 1
    WaitEvent
Wend
Stop
End