📄 business_fn.mac
字号:
ld a,(FLG_C)
and a,0y00000000
ld (FLG_C),a
ld a,(FLG_E) ;clear all calculate instruction flags except E_MUP,E_MUL,E_DIV
and a,0y00001111
ld (FLG_E),a
jp no_operation
;==============================================================================
tax2_minus:
;V4.13 @SEB (M_TX2)
;V4.13 jp tax_minus_a ;V2.17
;===============================================================================
; TAX-
;===============================================================================
tax_minus:
;V4.17 @IS_5514_OFF(tax_minus_x) ;V4.12
@IS_5514_ON(tax_minus_x) ;V4.17
@BBS (F_TNKEY,tax_minus_x) ;V4.17
ld a,(FLG_E) ;V4.12
and a,0y00000011 ;V4.12
j ne,no_operation ;V4.12
tax_minus_x:
@SEB (F_REVCAN) ;V4.07
@BBC (SW_EUTX,tax_minus_a) ;not cash conversion, to--->
ld (KEYIN),K_LOCAL ;for cash conversion [local] key function
jp local_key_start
tax_minus_a:
@BBS (F_RATE,tax_plus_0) ;
call tax_equ
@BBS (F_CALER,tax_equ_end) ;V4.11
j cs,no_operation
call ten_to_w2dp ;;tenkey -> W2(no DP adjustment)
cmp (PRE_KEY),K_TXP ;
j eq,tax_min00 ;
;------------------------------------------------------
tax_minus_yuan:
call w2_to_w4 ;backup tenkey buffer
tax_min00: ;
;---------------------------------------------------tax rate---> w1
ld (SYM),S_SPC
@BBS (F_TNKEY,tax_calc_0)
ld (SYM),S_ST
tax_calc_0:
ld hl,W2
call wk_print ;W2(input value) print
call tax_to_w1
ld (SYM),S_TAX
ld hl,W1
call wk_print
;---------------------------------------is [tax+] or [tax-]? [tax+]--->
cmp (KEYIN),K_TXP ;\tax+ key?
j eq,tax_plus_calc ;/ yes -> tax+ calculation [W1<- W1(rate)*W2(input)]
;------------------------------------------------for [tax-]
;tax- calculation........
tax_minus_calc: ;V1.24
;------------------------------------------for stand logic [tax-], tax rate already in stay 'w1'
;V1.33 @S100_W2 ;set 100 to W2
;V1.33 call calc_add ;W1 <- 1 + rate/100
@S100_W2 ;set 1 to W2
call calc_div ;W1 <- 100+rate/100
@S1_W2 ;
call calc_add ;
call ten_to_w2
call exchg_w12
call calc_div ;W1 <- input / (1+rate/100)
ld hl,W1 ;V1.32
call wk_round ;V1.32
;----------------------------------------------------------------------
tax_minus_yy_z1:
@BBS (F_CALER,tax_min99) ;V1.14
call w1_to_w2 ;V1.13\
xor (W2_S),1 ;V1.13|compute for dalta
call ten_to_w1 ;V1.13|
call calc_add ;V1.13/
jp tax_minus_yy_z3 ;V2.10
tax_minus_yy_z0: ;V2.10
call w1_to_w2 ;V2.10
call tax_to_w1 ;\V2.10
@SEB (F_PERCAL) ;V2.10
call calc_mult ;V2.10
tax_minus_yy_z3: ;V2.10
;V3.01 ld (SYM),S_DLTA ;V1.13\
ld (SYM),0x15 ;delta-
@SEB (F_MIN_TRA)
ld hl,W1 ;V1.13
call wk_round ;V1.13
jp tax_min1_z ;V2.10
tax_min1_z:
call wk_print ;V1.13
@CLB (F_MIN_TRA)
xor (W1_S),1 ;V1.13
call tax_to_w1
@S100_W2
call calc_add
call ten_to_w2 ;V1.28
call exchg_w12 ;V1.28
@SEB (F_PERCAL)
call calc_div
; call calc_add ;V1.28
;------------------------------------- check for prevenient key is [tax+]?
cmp (PRE_KEY),K_TXP ;V1.14
;V4.12 @IS_TX2
;V4.12 j t,tax_min1_yy ;V1.24
;V4.12 cmp (PRE_KEY),K_TX2P ;V1.24
;----------------------------------------------------------------------
tax_min1_yy: ;V1.24
j ne,tax_min5 ;V1.14
ld (KEYIN),0xff ;V1.35b
call w4_to_w1 ;V1.14
jp tax_min5 ;V1.13
;-------------------------------------------------------------[tax-] compute accomplish
;------------------------------------------for [tax+] compute
tax_plus_calc: ;w1=tax rate, w2=ten
@SEB (F_PERCAL)
call calc_mult ;W1 <- input * rate(%)=dalta
@BBS (F_CALER,tax_min99) ; -> set zero divide error and clear answer
call w1_to_w2 ;V1.11
ld hl,W2 ;V1.11
call wk_round
;V3.01 ld (SYM),S_DLTA ;
ld (SYM),0x14 ;delta+
cmp (KEYIN),K_TXP ;tax+ key?
@IS_TX2 ;V1.17
j t,tax_min2_x ;V1.17
cmp (KEYIN),K_TX2P ;V1.17
tax_min2_x:
j eq,tax_min3 ; yes ->
; ld (SYM),S_DLM ;
; @SEB (F_MIN_TRA) ;for print tax amount in red
xor (W1_S),1 ;W1(tax amount) sign change
xor (W2_S),1 ;only for print ;v1.11
tax_min3: ;V1.35b
call wk_print ;W1(tax amount) print
; @CLB (F_MIN_TRA) ;
tax_min4:
call tax_to_w1
@S100_W2
call calc_add
@SEB (F_PERCAL)
call w1_to_w2
call ten_to_w1 ;V1.28
; call calc_add ;W1 <- without tax
call calc_mult
cmp (PRE_KEY),K_TXM ;V1.14
@IS_TX2 ;V1.17
j t,tax_min4x ;V1.17 not tax2 mode
cmp (PRE_KEY),K_TX2M ;V1.17
jp tax_min4x ;V1.35b
tax_min4x: ;V1.17
j ne,tax_min5 ;V1.14
ld (KEYIN),0xff ;V1.35b
call w4_to_w1 ;V1.14
tax_min5: ;V1.13
@BBS (F_CALER,tax_min9)
ld hl,W1
call _zerock ;V1.34
j ne,tax_min50 ;V1.34
ld (W1_S),0 ;V1.34
tax_min50: ;V1.34
call wk_round
ld (SYM),S_AST ;
call wk_print ;W1(tax amount) print
call feed_1
call w1_to_ten ;for display calculated answer(W1)
tax_min9:
;V4.13 @CLB (M_TX2) ;V1.17
tax_min91: ;V1.19
;V4.12 ld a,(FLG_C) ;V1.26\
;V4.12 and a,0y00000000 ;V1.40
;V4.12 ld (FLG_C),a ;V1.26/
and (FLG_C),0 ;V4.12
;V4.12 ld a,(FLG_E) ;clear all calculate instruction flags except E_MUP,E_MUL,E_DIV
;V4.12 and a,0y00001111 ;V1.40
;V4.12 ld (FLG_E),a
and (FLG_E),0x0f ;V4.12
@IS_5514_OFF(tax_min92) ;V4.12
and (FLG_E),0 ;V4.12
tax_min92: ;V4.12
ld (SYM),S_AST ;for error print
j function_end
tax_min99:
@SEB (F_ZDIVER)
;V1.30 call w1_clear
j tax_min9
;===============================================
; subroutine for tax function
;===============================================
tax_save:
call keep_ten_6dig
call ten_to_w2
call w2_to_tax
call w2_to_eetx
;----------------------------------
tax_recall:
call tax_to_w1
call w1_to_ten
ld (SYM),S_TAX
call keep_ten_6dig
call ten_to_w1
ld hl,W1
call wk_print ;TAX rate print
call feed_1
call w1_to_ten ;for display tax rate(W1)
call spc_disp
ld hl,TENKEY
call edit_disp
ld (DISP+5),D_T
ld (DISP+6),D_EQU
call disp_to_dbr
call ten_clear
@SEB (EURO_DISPLY) ;V3.04
ld (KEYIN),K_EURO_LOCAL_TAX_DUM
ld (PRE_KEY),K_EURO_LOCAL_TAX_DUM
ret
;------------------------------------
tax_equ:
ld a,(FLG_E)
and a,0y00000011
j eq,tax_equ_exit
@BBC (F_TNKEY,tax_equ_exit9)
call equal_sub
call w1_round
call w1_to_ten
@CLB (F_TNKEY)
tax_equ_exit:
clr cf
ret
tax_equ_exit9:
set cf
ret
;V2.07===========================================================================
; [TAX12+]/[TAX12-]
;================================================================================
tax12_plus:
tax12_minus:
;V4.01 call ten_to_w1 ;tenkey -> W2(no DP adjustment)
;V4.01 ld hl,W1 ;keep 2 float decimal
;V4.01 call check_dp_over2 ;
;V4.01 ld (SYM),S_SPC ;\
;V4.01 ld hl,W1 ;|
;V4.01 call wk_print ;/W2(input value) print
;V4.01 cmp (KEYIN),K_TX12P ;V2.13
;V4.01 j eq,tax12_minus2 ;V2.13
;V4.01 call tax_to_w1
;V4.01 call w1_to_w2
;V4.01 call tax2_to_w1
;V4.01 call calc_add ;rate tax1+rate tax2
;V4.01 @S100_W2 ;set 1 to W2
;V4.01 call calc_div ;W1 <- 100+rate/100
;V4.01 @S1_W2 ;|
;V4.01 call calc_add ;/
;V4.01 call ten_to_w2
;V4.01 call exchg_w12
;V4.01 cmp (KEYIN),K_TX12P
;V4.01 j eq,tax12_minus1
;V4.01 call calc_div ;total amount come out, W1 <- input / [1+(tax1+tax2)/100]
;V2.12 call fix_round_down_keep_2dp
;V4.01 jp tax12_minus2
;V4.01tax12_minus1:
;V4.01 call calc_mult
;V4.01 call fix_round_up_keep_2dp
;V4.01tax12_minus2:
;V2.12 call keep_2dp ;V2.12
;V2.13 call w1_to_w2
;V2.13 call ten_to_w1
;V2.13 xor (W1_S),1
;V2.13 call calc_add
;V2.13 cmp (KEYIN),K_TX12P
;V2.13 j ne,tax12_minus2x ;V2.12
;V2.13 call fix_round_down_keep_2dp ;V2.12
;V2.13 jp tax12_minus2y ;V2.12
;V2.13tax12_minus2x: ;V2.12
;V2.13 call fix_round_up_keep_2dp ;V2.12
;V2.13tax12_minus2y: ;V2.12
;V4.01 call w1_to_w4 ;backup total dalta W1
;V4.01 @CLB (M_TX2)
;V4.01 @SEB (M_TX1)
;V4.01 call tax_mark_print ;out print ' ....1....'
;V4.01 call tax_to_w1 ;\
;V4.01 ld (SYM),S_PER ;
;V4.01 ld hl,W1 ;
;V4.01 call check_dp_over2 ;
;V4.01 call wk_print ; tax1 rate print out
;V4.01
;V4.01 @BBS (F_CALER,tax12_end)
;V4.01 call tax_to_w1
;V2.13 call w1_to_w2
;V2.13 call tax2_to_w1
;V2.13 call calc_add ;rate tax1+rate tax2
;V2.13 call w1_to_w2
;V2.13 call tax_to_w1
;V2.13 ld hl,W2 ;V2.12
;V2.13 call _zerock ;V2.12
;V2.13 j eq,tax12_minus_21 ;V2.12
;V2.13 call calc_div
;V4.01tax12_minus_21: ;V2.12
;V4.01 call w4_to_w2
;V4.01 @SEB (F_PERCAL) ;V2.13
;V4.01 call calc_mult
;V4.01 @BBS (F_CALER,tax12_end)
;V4.01 ld hl,W1
;V4.01 call fix_round_up_keep_2dp ;V2.13
;V4.01 cmp (KEYIN),K_TX12P
;V4.01 j ne,tax12_minus_3 ;V2.11
;V2.13 call fix_round_up_keep_2dp
;V4.01 jp tax12_minus_4 ;V2.11
tax12_minus_3: ;V2.11
;V2.13 call fix_round_down_keep_2dp ;V2.11
;V2.13 call _zerock ;V2.12
;V2.13 j ne,tax12_minus_4 ;V2.12
;V4.01 or (W1_S),1 ;V2.12
tax12_minus_4: ;V2.11
;V2.13 call keep_2dp ;V2.12
;V4.01 ld (SYM),S_DLTA
;V4.01 call wk_print
;V4.01 call w1_to_ftemp ;V2.13 backup this result
;V4.01 @CLB (M_TX1)
;V4.01 @SEB (M_TX2)
;V4.01 call tax_mark_print ;out print ' ....2....'
;V4.01 call tax2_to_w1
;V4.01 ld (SYM),S_PER
;V4.01 ld hl,W1
;V4.01 call check_dp_over2 ;
;V4.01 call wk_print ; tax2 rate print out
;V4.01 call w4_to_w2
;V4.01 @SEB (F_PERCAL) ;V2.13
;V4.01 call calc_mult ;V2.13
;V4.01 @BBS (F_CALER,tax12_end) ;V2.13
;V4.01 ld hl,W1 ;V2.13
;V4.01 call fix_round_up_keep_2dp ;V2.13
;V4.01 cmp (KEYIN),K_TX12P ;V2.13
;V4.01 j eq,tax12_minus_6 ;V2.13
;V2.13 ld hl,W2
;V2.12 call fix_round_up_keep_2dp
;V2.13 call keep_2dp ;V2.12
xor (W1_S),1
;V2.13 call calc_add
;V2.13 call w2_to_w4 ;backup W2 total delta
;V2.13 @BBS (F_CALER,tax12_end)
;V2.13 ld hl,W1
;V2.13 cmp (KEYIN),K_TX12P ;V2.12
;V2.13 j ne,tax12_minus_5 ;V2.12
;V2.13 call fix_round_up_keep_2dp ;V2.12
;V2.13 jp tax12_minus_6 ;V2.12
;V4.01tax12_minus_5: ;V2.12
;V2.12 call fix_round_down_keep_2dp ;V2.12
;V2.13 call _zerock ;V2.12
;V2.13 j ne,tax12_minus_6 ;V2.12
;V2.13 or (W1_S),1 ;V2.12
;V4.01tax12_minus_6: ;V2.12
;V2.13 call keep_2dp ;V2.12
;V4.01 ld (SYM),S_DLTA
;V4.01 call wk_print
;V4.01 @SEB (M_TX1)
;V4.01 @SEB (M_TX2)
;V4.01 call tax_mark_print ;out print ' ...1,2...'
;V4.01 call ftemp_to_w2 ;V2.13
;V4.01 call calc_add ;V2.13
;V2.13 call w4_to_w2
;V4.01 ld hl,W1
;V2.13 call fix_round_up_keep_2dp ;V2.13
;V4.01 call keep_2dp ;V2.13
;V4.01 ld (SYM),S_DLTA
;V4.01 call wk_print
;V4.01 call ten_to_w2
;V4.01 call calc_add
;V4.01 ld hl,W1
;V4.01 call fix_round_up_keep_2dp ;V2.13
;;V3.01 jp tax_min5_y
;V4.01tax12_end:
;V4.01 jp tax_min9
;V2.07==========================================================================
;===============================================================================
; COST key
;===============================================================================
cost_key:
;V4.01 @BBC (M_FINANCE,cost_operation) ;V1.17a
;V4.01cost_key_x:
;V4.01 jp no_operation ;V1.17a
cost_operation: ;V1.17a
;V1.26 cmp (TEN_CT),0 ;with tenkey?
;V1.26 j ne,cost_key2 ; yes ->
@BBS (F_TNKEY,cost_key2) ;V1.26
cost_operation_1:
;no tenkey entry.......
ld a,(PRE_KEY) ;check previouse key(reg.a)
call kychk_sttl ;V1.17a;V1.40 ;check ST,TL,MST,MTL,GT M2ST,M2TL key
j eq,cost_key2 ;V1.17a;V1.40 ;Z=1: yes -> set price ot execute calculation
ld w,(FLG_C) ;check constant flags
and w,0y11110000 ;C_MAR,C_SEL,C_CST on? ;V1.41
;V1.42 and w,0y01110000 ;C_MAR,C_SEL,C_CST on? V1.42
j z,cost_key0 ; no(after entry C,S,M or nothing entry) ->
call kychk_csm ;check cost, sell, margin or cce key
j eq,cost_rcall ;Z=1: yes -> recall function
ld (FLG_C),0 ;clear all constant flags
ld (FLG_E),0 ;clear all calculate instruction flags
j cost_key2 ; -> set price
cost_key0:
ld w,(FLG_E) ;V1.17a;V1.40 ;check entry flags
and w,0y01110000 ;V1.17a;V1.40 ;E_MAR,E_SEL,E_CST on?
j z,cost_key2 ;V1.17a;V1.40 ;no any entry flags yes-> set cost price(display value)
@IS_5514_OFF(cost_key2) ;V4.12
cmp a,K_CST ;V4.12
;V3.03 call kychk_csm ;V1.17a;V1.40 ;check cost, sell, margin or cce key
j eq,no_operation ;V3.03;V1.17a;V1.40 ;Z=1: yes -> no operation
;V3.03 ld (FLG_E),0 ;V1.17a;V1.40 ;clear all calculate instruction flags
j cost_key2;V1.28 ;V1.40 ; -> set price
;recall previouse cost price....
cost_rcall:
call cost_to_w2
ld (SYM),S_COST ;cost symbol
ld hl,W2
call wk_print ;V1.17b
;V1.17b call wk_prn_2L ;W2(input value) print with check 2line print
call feed_1
call w2_to_ten ;for display recall value(W2)
ld (FLG_E),0
j function_end
;with tenkey entry.......
cost_key2:
@IS_5514_OFF(cost_key2_1) ;V4.09
call ten_to_w2dp ;V4.09
jp cost_key2_2 ;V4.09
cost_key2_1: ;v4.09
call ten_to_w2 ;tenkey -> W2(no DP adjustment)
cost_key2_2:
call w2_to_cost ;input -> cost backup
ld (SYM),S_COST ;cost symbol
ld hl,W2
call wk_print ;V1.17b
;V1.17b call wk_prn_2L ;W2(input value) print with check 2line print
@BBS (C_SEL,cost_key4) ;just after x -sell calculation? yes-> set cost price only
@BBS (C_MAR,cost_key4) ;just after x -margin calculation? yes-> set cost price only
;just after x -cost calculation or normal sell entry............
ld (FLG_C),0 ;clear all constant flags
@SEB (C_CST) ;set cost constant calc. flag
@BBS (E_SEL,cs_sl_calc) ; -> COST-SELL calculation
@BBS (E_MAR,cs_mg_calc) ; -> COST-MARGIN calculation
;set cost price......
cost_key4:
;V2.00 @SEB (LCD_COST) ;V1.18
ld (FLG_C),0 ;clear all constant flags
ld (FLG_E),0 ;clear all calculate instruction flags
@SEB (E_CST) ;set cost entry
call w2_to_ten ;for display input value(W2)
j function_end
;===============================================
; check key (ST,TL,MST,MTL,GT)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -