Home

Tuesday, January 20, 2015

Calculate Error Qty

public void modifiedField(fieldId _fieldId)
{
    int64 n;
    s3_qtytable qty
    ;
select maxof(recid) from qty where qty.S3_ItemId == this.S3_ItemId;
n = qty.RecId;
if(n == 0) // For the first Record
{
 this.S3_RecievedQty = this.S3_MaxValue;
}
while select * from qty where qty.S3_ItemId == this.S3_ItemId
{
  select s3_forwardqty, s3_maxvalue, s3_itemid from qty where qty.RecId == n;
   if(this.S3_ItemId == qty.S3_ItemId)
    {
       this.S3_RecievedQty = qty.S3_ForwardQty;
       this.S3_MaxValue = qty.S3_MaxValue;
    }
    else if(this.S3_ItemId != qty.S3_ItemId)
    {
       this.S3_RecievedQty = this.S3_MaxValue;
    }
}
this.S3_ForwardQty = this.S3_RecievedQty - this.S3_ErrorQty;

        super(_fieldId);
}
================================================
public boolean validateWrite()
{
    boolean ret;
    ;

    if(this.S3_ErrorQty == 0) // If ErrorQty field is left blank
    {
    this.S3_ForwardQty = this.S3_RecievedQty;
    }

    ret = super();
    return ret;
}

No comments:

Post a Comment