package com.app.hxqh.udoutser;

import org.apache.axis2.databinding.types.xsd.Decimal;
import psdi.mbo.MAXTableDomain;
import psdi.mbo.MboRemote;
import psdi.mbo.MboSetRemote;
import psdi.mbo.MboValue;
import psdi.util.MXException;

import java.rmi.RemoteException;

/**
 * 费用
 * createby liuxq 2023-8-18
 */
public class FldCost extends MAXTableDomain {

    public FldCost(MboValue mbv) throws MXException,RemoteException {
        super(mbv);
    }

    public void init() throws RemoteException, MXException {
        super.init();
    }
    public void action() throws RemoteException, MXException {
        super.action();
        MboValue mbovalue = getMboValue();
        String attributeName = mbovalue.getAttributeName();
        MboRemote mbo = mbovalue.getMbo();
        if("SL".equalsIgnoreCase(attributeName) || "PRICE".equalsIgnoreCase(attributeName)){
            MboValue SLVALUE = getMboValue("SL");//数量
            MboValue PRICEVALUE = getMboValue("PRICE");//预估单价
            double SL = SLVALUE.getDouble();
            double PRICE = PRICEVALUE.getDouble();
            double total = SL * PRICE;
            mbo.setValue("YGZJE",total,11L);//预估金额
        }
    }

    public MboSetRemote getList() throws RemoteException, MXException {
        MboRemote mbo = getMboValue().getMbo();
        String sql = " 1=1 ";
        setListCriteria(sql);
        return super.getList();
    }
}