T100——菜单action控制单身栏位的修改

Posted xiao黎

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了T100——菜单action控制单身栏位的修改相关的知识,希望对你有一定的参考价值。

通过菜单ACTION来控制单身栏位内容的编辑修改;

 

范例axmt500:

   DEFINE l_xmdcua012_bk  DYNAMIC ARRAY OF RECORD #170701 ljr
          xmdcua012 LIKE xmdc_t.xmdcua012
          END RECORD
   DEFINE l_i_2 INT #170701 ljr

 

 

         #應用 a43 樣板自動產生(Version:4)
         ON ACTION action_modify_xmdcua012
            LET g_action_choice="action_modify_xmdcua012"
            IF cl_auth_chk_act("action_modify_xmdcua012") THEN
               
               #add-point:ON ACTION action_modify_xmdcua012 name="menu.action_modify_xmdcua012"
                DIALOG ATTRIBUTES(UNBUFFERED,FIELD ORDER FORM)
                    INPUT ARRAY g_xmdc_d FROM s_detail1.*
                        ATTRIBUTE(COUNT = g_rec_b,WITHOUT DEFAULTS, #MAXCOUNT = g_max_rec,
                                  INSERT ROW = FALSE, 
                                  DELETE ROW = FALSE,
                                  APPEND ROW = FALSE)
                    END INPUT
                    
                BEFORE DIALOG 
                    #在修改结算单价前,先把旧的结算单价备份,后面作对比判断哪行被更改了
                    CALL cl_set_comp_entry("xmdcua012",TRUE)
                    CALL cl_set_comp_entry("xmdc027,xmdcua007,xmdc001,xmdcud011,xmdc019,xmdc002,xmdc006",FALSE)
                    CALL cl_set_comp_entry("xmdcua009,xmdc007,xmdcud012,xmdcud013,xmdcud014,xmdcua010,xmdc008",FALSE)
                    CALL cl_set_comp_entry("xmdc009,xmdc024,xmdc012,xmdc013,xmdc045,xmdc016,xmdc017,xmdc010,xmdc011",FALSE)
                    CALL cl_set_comp_entry("xmdc015,xmdc046,xmdc047,xmdc048,xmdc023,xmdc020,xmdc021,xmdc022",FALSE)
                    CALL cl_set_comp_entry("xmdcunit,xmdcorga,xmdc052,xmdc049,xmdc053,xmdc050,xmdcsite,xmdc058",FALSE)
                    CALL cl_set_comp_entry("xmdc059,xmdc060,xmdc061,xmdcua001,xmdcua002,xmdcua003,xmdcua004,xmdcua005",FALSE)
                    CALL cl_set_comp_entry("xmdcua006,xmdcua011,l_pmao009,l_pmao010",FALSE)
                    
                    FOR l_i_2=1 TO g_xmdc_d.getLength()
                        LET l_xmdcua012_bk[l_i_2].xmdcua012 = g_xmdc_d[l_i_2].xmdcua012
                    END FOR
                    
                    ON ACTION accept
                        #判断结算单价是否已被修改,只处理已经被修改的行
                        FOR l_i_2=1 TO g_xmdc_d.getLength()
                            IF NOT cl_null(g_xmdc_d[l_i_2].xmdcseq) THEN 
                                IF g_xmdc_d[l_i_2].xmdcua012 = l_xmdcua012_bk[l_i_2].xmdcua012 OR g_xmdc_d[l_i_2].xmdcua012 IS NULL THEN
                                    CONTINUE FOR
                                ELSE
                                    CALL axmt500_setPrice2_2(g_xmdc_d[l_i_2].xmdcseq,
                                                            g_xmdc_d[l_i_2].xmdc007,
                                                            g_xmdc_d[l_i_2].xmdcua012)
                                        RETURNING g_xmdc_d[l_i_2].xmdcua013,g_xmdc_d[l_i_2].xmdcua014,
                                                  g_xmdc_d[l_i_2].xmdcua015,g_xmdc_d[l_i_2].xmdcua016
                                    DISPLAY BY NAME g_xmdc_d[l_i_2].xmdcua013,g_xmdc_d[l_i_2].xmdcua014,
                                                            g_xmdc_d[l_i_2].xmdcua015,g_xmdc_d[l_i_2].xmdcua016
                                    #更新结算单价修改者、修改时间
                                    LET g_xmdc_d[l_i_2].xmdcua017 = g_user
                                    LET g_xmdc_d[l_i_2].xmdcua018 = cl_get_current()
                                    UPDATE xmdc_t SET xmdcua017=g_xmdc_d[l_i_2].xmdcua017,xmdcua018=g_xmdc_d[l_i_2].xmdcua018
                                        WHERE xmdcent=g_enterprise AND xmdcsite=g_site AND xmdcdocno=g_xmda_m.xmdadocno AND xmdcseq=g_xmdc_d[l_i_2].xmdcseq
                                    SELECT ooag011 INTO g_xmdc_d[l_i_2].xmdcua017_desc FROM ooag_t 
                                        WHERE ooagent=g_enterprise AND ooag001=g_xmdc_d[l_i_2].xmdcua017
                                    DISPLAY BY NAME g_xmdc_d[l_i_2].xmdcua017,g_xmdc_d[l_i_2].xmdcua018,g_xmdc_d[l_i_2].xmdcua017_desc
                                END IF
                            END IF
                        END FOR
                        
                        ACCEPT DIALOG
                    
                    ON ACTION cancel      #在dialog button (放棄)
                        
                        EXIT DIALOG
                    
                    ON ACTION close       #在dialog 右上角 (X)

                        EXIT DIALOG
                    
                    ON ACTION exit        #toolbar 離開
                        
                        EXIT DIALOG
                    
                    #交談指令共用ACTION
                    &include "common_action.4gl" 
                        CONTINUE DIALOG 
                        
                END DIALOG
               #END add-point
               
            END IF

 

 

PRIVATE FUNCTION axmt500_setPrice2_2(l_xmdcseq,l_xmdc007,l_xmdcua012)
#修改结算单价,根据新的结算单价计算结算金额等,更新、回传并显示

    DEFINE l_xmdcseq LIKE xmdc_t.xmdcseq    #单身项次
    DEFINE l_xmdc001 LIKE xmdc_t.xmdc001    #单身料号
    DEFINE l_xmdc007 LIKE xmdc_t.xmdc007    #单身数量
    DEFINE l_xmdcua012 LIKE xmdc_t.xmdcua012  #单身结算单价
    
    DEFINE l_xmdcua013 LIKE xmdc_t.xmdcua013    #回传参数,结算金额
    DEFINE l_xmdcua014 LIKE xmdc_t.xmdcua014    #回传参数,结算未税单价
    DEFINE l_xmdcua015 LIKE xmdc_t.xmdcua015    #回传参数,结算未税金额
    DEFINE l_xmdcua016 LIKE xmdc_t.xmdcua016    #回传参数,结算税额
    
    #判断订单的单价是否含税
    #单价含税
    IF g_xmda_m.xmda013 THEN 
        LET l_xmdcua013 = l_xmdcua012 * l_xmdc007
        LET l_xmdcua014 = l_xmdcua012 / (1 + g_xmda_m.xmda012 / 100)
        LET l_xmdcua015 = l_xmdcua014 * l_xmdc007
        LET l_xmdcua016 = l_xmdcua013 - l_xmdcua015
    #单价不含税
    ELSE
        LET l_xmdcua013 = l_xmdcua012 * l_xmdc007
        LET l_xmdcua014 = 0.00
        LET l_xmdcua015 = 0.00
        LET l_xmdcua016 = 0.00
    END IF    
    #更新
    UPDATE xmdc_t SET xmdcua012=l_xmdcua012,
                      xmdcua013=l_xmdcua013,
                      xmdcua014=l_xmdcua014,
                      xmdcua015=l_xmdcua015,
                      xmdcua016=l_xmdcua016
      WHERE xmdcent=g_enterprise AND xmdcsite=g_site AND xmdcdocno=g_xmda_m.xmdadocno AND xmdcseq=l_xmdcseq
    #返回值
    RETURN l_xmdcua013,l_xmdcua014,l_xmdcua015,l_xmdcua016
END FUNCTION

 

以上是关于T100——菜单action控制单身栏位的修改的主要内容,如果未能解决你的问题,请参考以下文章

动态菜单栏

T100——不绑定数据表字段,做查询条件(待改进)

sql 使用序列的值作为及将要新增栏位的值

T100——单据别的新增修改设置

ZZ_INEERNAL每个栏位的含义

T100——r类 凭证报表 打印