Table of Content
HAL Forum
funciton roundmode DefaultCurRoundOff (
)
Description:
returns the roundmode variable that contains the user-set (System>settings>Round Off) default roundoff settings
procedure DoTheCalculation(record ChargesVc Chargep,record CustomsVc CUSp,Integer rownr,var val res)
BEGIN
  record CommDealVc CDr;
  row CustomsVc CUSrw;
  val temp;
  val amount,prc;
  
  MatRowGet(CUSp,rownr,CUSrw);
  res = blankval;
  amount = Chargep.GattAmount;
  prc = Chargep.GattPrc;
  if (nonblank(CUSrw.CommodityCode)) then begin
    CDr.Number = CUSrw.CommodityCode;
    CDr.DutiesCode = Chargep.Code;
    if (ReadFirstMain(CDr,2,true)) then begin
      amount = CDr.GattAmount;
      prc = CDr.GattPrc;
    end;
  end;
  switch(Chargep.CalcMethod) begin
    case 0: res = CUSrw.Quant*amount;    
    case 1: res = CUSrw.Weight*amount;
    case 2: 
      if (prc!=0) then begin
        MulM4OneRate(CUSrw.CustomsVal,prc,res,DefaultCurRoundOff,true);
      end;
    case 3:
      if (prc!=0) then  begin
        MulM4OneRate(CUSrw.CustomsVal,prc,res,DefaultCurRoundOff,false);
        MulM4OneRate(CUSrw.CustomsVal,Chargep.Special,temp,DefaultCurRoundOff,false);
        temp = temp - CUSrw.DutiesVal;
        if (res>temp) then begin
          res = temp;
        end;
      end;
    case 4: res = Chargep.Special;
    case 5:
      if (prc!=0) then  begin
        temp = CUSrw.CustomsVal + CUSrw.DutiesVal;
        MulM4OneRate(temp,prc,res,DefaultCurRoundOff,true);
      end;
    case 6: res = CUSrw.Volume*amount;
    case 7:
      temp = CUSrw.AlcPrc - Chargep.Special;
      temp = CUSrw.Volume*temp;
      res = temp*amount; 
    case 8:
  end;
  RETURN;
END;
Related topics:
««