Exemplo n.º 1
0
 private void AddDisbursement(atriumDB.DisbursementRow drDisb, int officeId, DateTime disbDate, DateTime srpDate, decimal disbTaxExempt, decimal disbTax, string disbType, string comment)
 {
     drDisb.BeginEdit();
     drDisb.OfficeId      = officeId;
     drDisb.DisbDate      = disbDate;
     drDisb.DisbTaxExempt = disbTaxExempt;
     drDisb.DisbTaxable   = disbTax;
     drDisb.DisbType      = disbType;
     drDisb.Comment       = comment;
     drDisb.entryDate     = srpDate;
     drDisb.EndEdit();
 }
Exemplo n.º 2
0
        protected override void AfterChange(DataColumn dc, DataRow ddr)
        {
            string ObjectName = this.myDisbursementDT.TableName;

            atriumDB.DisbursementRow dr = (atriumDB.DisbursementRow)ddr;


            switch (dc.ColumnName)
            {
            case DisbursementFields.DisbTaxable:
            case "TaxRateId":
                if (!dr.Final)
                {
                    if (dr.IsDisbTaxableNull())
                    {
                        dr.SetDisbTaxNull();
                    }
                    else
                    {
                        if (!dr.IsTaxRateIdNull())
                        {
                            appDB.TaxRateRow taxRateRow = myA.AtMng.DB.TaxRate.FindByTaxRateId(dr.TaxRateId);
                            dr.DisbTax = dr.DisbTaxable * taxRateRow.TaxRate;
                        }
                        else
                        {
                            officeDB.OfficeRow drOffice = this.myA.AtMng.GetOffice(dr.OfficeId).CurrentOffice;
                            dr.DisbTax = dr.DisbTaxable * (drOffice.IsTaxRateNull() ? 0 : drOffice.TaxRate);
                        }

                        dr.DisbTax = Math.Round(dr.DisbTax, 2, MidpointRounding.AwayFromZero);
                    }
                    dr.EndEdit();
                }
                break;

            default:
                break;
            }
        }