zoukankan      html  css  js  c++  java
  • 单身金额统计,更新显示到单头

     范例(cxmt052)当单身新增、修改、删除时,汇总单身的应付金额,更新并显示到单头上;

    1、自定义函数,主要是用在单身新增、修改时调用:

    1)

    PRIVATE FUNCTION cxmt052_totalPrice()
        #定义变数
        DEFINE id INT
        DEFINE totalPrice LIKE xmcnuc_t.xmcnuc007
        #初始化应付总金额
        LET totalPrice = 0
        #遍历单身计算应付总金额
        FOR id = 1 TO g_xmcouc_d.getLength()
            LET totalPrice = totalPrice + g_xmcouc_d[id].xmcouc010
        END FOR
        LET  g_xmcnuc_m.xmcnuc007 = totalPrice
        DISPLAY BY NAME g_xmcnuc_m.xmcnuc007
        #更新单头应付总金额
        UPDATE xmcnuc_t SET xmcnuc007 = totalPrice
            WHERE xmcnucent = g_enterprise AND xmcnucdocno = g_xmcnuc_m.xmcnucdocno
    END FUNCTION

    2)单身新增后:

                   #add-point:單身新增後 name="input.body.a_insert"
                    CALL cxmt052_totalPrice()
                   #end add-point

    3)单身修改更新后:

                   #add-point:單身修改後 name="input.body.a_update"
                    CALL cxmt052_totalPrice()
                   #end add-point

    2、单身删除时,在程序执行完毕后,行才会在单身列表中删掉,所以在这里遍历单身汇总金额的时候,要把删除的那条数据排除不汇总

       #add-point:delete_b段define(客製用) name="delete_b.define_customerization"
        DEFINE id INT
        DEFINE totalPrice LIKE xmcnuc_t.xmcnuc007
       #end add-point 


          #add-point:delete_b段刪除前 name="delete_b.b_delete"
    
          #end add-point    
          DELETE FROM xmcouc_t
           WHERE xmcoucent = g_enterprise AND
             xmcoucdocno = ps_keys_bak[1] AND xmcoucseq = ps_keys_bak[2]
          #add-point:delete_b段刪除中 name="delete_b.m_delete"
    
            LET totalPrice = 0
            FOR id = 1 TO g_xmcouc_d.getLength()
                IF g_xmcouc_d[id].xmcoucseq = ps_keys_bak[2] THEN
                    CONTINUE FOR
                END IF
                LET totalPrice = totalPrice + g_xmcouc_d[id].xmcouc010
            END FOR
            LET  g_xmcnuc_m.xmcnuc007 = totalPrice
            DISPLAY BY NAME g_xmcnuc_m.xmcnuc007
            UPDATE xmcnuc_t SET xmcnuc007 = totalPrice
                WHERE xmcnucent = g_enterprise AND xmcnucdocno = g_xmcnuc_m.xmcnucdocno
                
          #end add-point
  • 相关阅读:
    根分区/tmp满了,卸载home添加给根分区
    Docker容器技术教程
    使用vscode访问和编辑远程服务器文件
    使用 VS Code 远程连接Linux服务器告别xshell
    Docker安装参考文档记录
    yolov5在Centos系统上部署的环境搭建
    YOLOV5四种网络结构的比对
    k8s部署kube-state-metrics组件
    Kubernetes集群部署Prometheus和Grafana
    Prometheus介绍
  • 原文地址:https://www.cnblogs.com/xiaoli9627/p/6874009.html
Copyright © 2011-2022 走看看