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
  • 相关阅读:
    Nginx的反向代理和负载均衡
    大数据开发——Hive笔记
    Mysql-索引分析查询性能
    数据库原理-事务隔离与多版本并发控制(MVCC)
    并发编程实战--知识图谱
    并发编程实战-线程池
    并发编程实战-保证线程安全方式
    Synchronized和ReentTrantLock二者区别
    并发编程实战-J.U.C核心包
    并发编程实战-ConcurrentHashMap源码解析
  • 原文地址:https://www.cnblogs.com/xiaoli9627/p/6874009.html
Copyright © 2011-2022 走看看