Example #1
0
        private void CalcFees(atriumDB.ActivityTimeRow dr)
        {
            dr.Minutes = dr.Hours * 60;
            if (!dr.Final)
            {
                if (!dr.IsHoursNull())
                {
                    officeDB.OfficeRow or = this.myA.AtMng.GetOffice(dr.OfficeId).CurrentOffice;
                    //officeDB.OfficeRow or = (officeDB.OfficeRow)this.myA.AtMng.officeMng.DB.Office.Select("officeID=" + dr.OfficeId.ToString())[0];

                    //JLL: 2014-10-16 Change from minute to hour
                    //dr.FeesClaimed = decimal.Round(dr.Hours * or.HourlyRate / 60, 2, MidpointRounding.AwayFromZero);
                    dr.FeesClaimed = decimal.Round(dr.Hours * or.HourlyRate, 2, MidpointRounding.AwayFromZero);
                    if (!this.myA.AtMng.GetOffice(dr.OfficeId).CurrentOffice.IsTaxRateNull())
                    {
                        dr.FeesClaimedTax = Math.Round(this.myA.AtMng.GetOffice(dr.OfficeId).CurrentOffice.TaxRate *dr.FeesClaimed, 2, MidpointRounding.AwayFromZero);
                    }
                }
                else
                {
                    dr.SetFeesClaimedNull();
                    dr.SetFeesClaimedTaxNull();
                }
                dr.EndEdit();
            }
        }
Example #2
0
        protected override void AfterAdd(DataRow ddr)
        {
            string ObjectName = this.myActivityTimeDT.TableName;

            atriumDB.ActivityTimeRow       dr  = (atriumDB.ActivityTimeRow)ddr;
            ActivityConfig.ActivityCodeRow arc = myA.GetActivity().GetACSeriesRow(dr.ActivityRow).ActivityCodeRow;

            dr.ActivityTimeId = this.myA.AtMng.PKIDGet(ObjectName, 10);
            dr.Taxed          = false;
            dr.Final          = false;
            dr.Posted         = true;

            dr.FileId = dr.ActivityRow.FileId;
            if (!arc.IsDefaultHoursNull() && dr.IsHoursNull())
            {
                dr.Hours = Math.Round(arc.DefaultHours, 1);
            }
            else
            {
                dr.Hours = 0;
            }


            //  JLL: 2009-12-21 officeid should default to workingAs office and not activity row's officeid
            dr.OfficeId = myA.AtMng.WorkingAsOfficer.OfficeId;  //dr.ActivityRow.OfficeId;

            dr.OfficerId = myA.AtMng.WorkingAsOfficer.OfficerId;

            // JLL: 2009-12-21 changed to now as per PS request
            if (dr.ActivityRow.RowState == DataRowState.Added)
            {
                dr.StartTime = dr.ActivityRow.ActivityDate;
            }
            else
            {
                dr.StartTime = DateTime.Now;
            }

            CalcFees(dr);
        }