示例#1
0
        protected override void AfterChange(DataColumn dc, DataRow ddr)
        {
            string ObjectName = this.myIRPDT.TableName;

            atriumDB.IRPRow    dr       = (atriumDB.IRPRow)ddr;
            officeDB.OfficeRow drOffice = this.myA.AtMng.GetOffice(dr.OfficeID).CurrentOffice;

            switch (dc.ColumnName)
            {
            case "FeesTaxed":
                if (dr.IsFeesTaxedNull())
                {
                    dr.SetFeesTaxedTaxNull();
                }
                else
                {
                    dr.FeesTaxedTax = decimal.Round(dr.FeesTaxed * (drOffice.IsTaxRateNull()? 0 : drOffice.TaxRate), 2, MidpointRounding.AwayFromZero);
                }
                dr.EndEdit();
                break;

            case "DisbursementTaxed":
                if (dr.IsDisbursementTaxedNull())
                {
                    dr.SetDisbursementTaxedTaxNull();
                }
                else
                {
                    officeDB.OfficeRow officeRow = myA.AtMng.GetOffice().GetOffice(dr.OfficeID);
                    if (!officeRow.IsOnLine)
                    {
                        dr.DisbursementTaxedTax = decimal.Round(dr.DisbursementTaxed * (drOffice.IsTaxRateNull() ? 0 : drOffice.TaxRate), 2, MidpointRounding.AwayFromZero);
                    }
                }
                dr.EndEdit();
                break;

            case "FeesClaimed":
                if (dr.IsFeesClaimedNull())
                {
                    dr.SetFeesClaimedTaxNull();
                }
                else
                {
                    dr.FeesClaimedTax = decimal.Round(dr.FeesClaimed * (drOffice.IsTaxRateNull() ? 0 : drOffice.TaxRate), 2, MidpointRounding.AwayFromZero);
                }
                dr.EndEdit();
                break;

            case "DisbursementClaimed":
                if (dr.IsDisbursementClaimedNull())
                {
                    dr.SetDisbursementClaimedTaxNull();
                }
                else
                {
                    officeDB.OfficeRow officeRow = myA.AtMng.GetOffice().GetOffice(dr.OfficeID);
                    if (!officeRow.IsOnLine)
                    {
                        dr.DisbursementClaimedTax = decimal.Round(dr.DisbursementClaimed * (drOffice.IsTaxRateNull() ? 0 : drOffice.TaxRate), 2, MidpointRounding.AwayFromZero);
                    }
                }
                dr.EndEdit();
                break;

            case "DateTaxed":
                if (dr.SRPRow.IsTaxationBeganNull())
                {
                    dr.SRPRow.TaxationBegan = DateTime.Today;
                    //dr.SRPRow.AcceptChanges();
                    dr.EndEdit();
                    dr.SRPRow.EndEdit();
                }
                break;

            case "OfficerID":
                if (!dr.IsOfficerIDNull() && dr.IsDateTaxedNull())
                {
                    dr.DateTaxed                  = DateTime.Today;
                    dr.FeesTaxed                  = dr.IsFeesClaimedNull()? 0 : dr.FeesClaimed;
                    dr.FeesTaxedTax               = dr.IsFeesClaimedTaxNull() ? 0 : dr.FeesClaimedTax;
                    dr.DisbursementTaxed          = dr.IsDisbursementClaimedNull() ? 0 : dr.DisbursementClaimed;
                    dr.DisbursementTaxedTax       = dr.IsDisbursementClaimedTaxNull()? 0 : dr.DisbursementClaimedTax;
                    dr.DisbursementTaxExemptTaxed = dr.IsDisbursementTaxExemptClaimedNull() ? 0 : dr.DisbursementTaxExemptClaimed;
                    dr.EndEdit();
                }
                break;

            case "SIN":
                try
                {
                    //FileManager fm = myA.AtMng.GetFileBySIN(dr.SIN);
                    //dr.FileID = fm.CurrentFile.FileId;
                    //fm.Dispose();
                    //dr.EndEdit();
                }
                catch (Exception x)
                {
                    System.Diagnostics.Trace.WriteLine(x.Message);
                    throw new AtriumException(atriumBE.Properties.Resources.SINNotFound);
                }
                break;

            default:
                break;
            }
        }
示例#2
0
        private void ApplySecurityIRP(DataRow irpRow) //IRP
        {
            atriumDB.IRPRow irpr = (atriumDB.IRPRow)irpRow;

            if (irpr == null)
            {
                return;
            }

            uiTab1.Enabled = true;
            uiTab2.Enabled = true;
            uiTab3.Enabled = true;

            bool OnlineIRP = myOfficeMan.CurrentOffice.UsesBilling;

            UIHelper.EnableCommandBarCommand(tsDeleteIRP, FM.GetIRP().CanDelete(irpr, FM.CurrentFile.FileId));
            UIHelper.EnableCommandBarCommand(tsNewIRP, !OnlineIRP);

            if (myOfficeMan.CurrentOffice.UsesBilling) //SRP detail all readonly; nothing can be done on this page; use billing review
            {
                dateTaxedCalendarCombo.ReadOnly  = true;
                dateTaxedCalendarCombo.BackColor = SystemColors.Control;
                mccTaxingOfficer.ReadOnly        = true;
                tsSaveIRP.Enabled = Janus.Windows.UI.InheritableBoolean.False;
            }
            else //foreign IRP || Non Online IRP
            {
                if (irpRow.RowState == DataRowState.Added)
                {
                    if (irpRow.IsNull("FileId"))
                    {
                        btnValidateSIN.Visible = true;
                    }
                    sINMaskedEditBox.ReadOnly  = false;
                    sINMaskedEditBox.BackColor = SystemColors.Window;
                }
                else
                {
                    btnValidateSIN.Visible     = false;
                    sINMaskedEditBox.ReadOnly  = true;
                    sINMaskedEditBox.BackColor = SystemColors.Control;
                }

                if (!irpr.SRPRow.IsTaxationCompletedNull())
                {
                    tsNewIRP.Enabled = Janus.Windows.UI.InheritableBoolean.False;
                    dateTaxedCalendarCombo.ReadOnly  = true;
                    dateTaxedCalendarCombo.BackColor = SystemColors.Control;
                    mccTaxingOfficer.ReadOnly        = true;
                    tsSaveIRP.Enabled = Janus.Windows.UI.InheritableBoolean.False;
                    feesClaimedNumericEditBox.ReadOnly                   = true;
                    feesClaimedNumericEditBox.BackColor                  = SystemColors.Control;
                    disbursementClaimedNumericEditBox.ReadOnly           = true;
                    disbursementClaimedNumericEditBox.BackColor          = SystemColors.Control;
                    disbursementTaxExemptClaimedNumericEditBox.ReadOnly  = true;
                    disbursementTaxExemptClaimedNumericEditBox.BackColor = SystemColors.Control;
                    iRPGridEX.Height  = 220;
                    gbMessage.Visible = false;
                }
                else
                {
                    iRPGridEX.Height  = 220;
                    gbMessage.Visible = false;

                    if (!irpr.SRPRow.IsTaxationBeganNull())
                    {
                        if (irpr.IsDateTaxedNull() && irpr.IsOfficerIDNull())
                        {
                            iRPGridEX.Height  = 167;
                            label10.Text      = Properties.Resources.UITaxationMode;
                            gbMessage.Visible = true;

                            //taxation mode
                            //let's default some values

                            if (!irpr.IsFeesClaimedNull())
                            {
                                irpr.FeesTaxed = irpr.FeesClaimed;
                            }

                            if (!irpr.IsFeesClaimedTaxNull())
                            {
                                irpr.FeesTaxedTax = irpr.FeesClaimedTax;
                            }

                            if (!irpr.IsDisbursementClaimedNull())
                            {
                                irpr.DisbursementTaxed = irpr.DisbursementClaimed;
                            }

                            if (!irpr.IsDisbursementClaimedTaxNull())
                            {
                                irpr.DisbursementTaxedTax = irpr.DisbursementClaimedTax;
                            }

                            if (!irpr.IsDisbursementTaxExemptClaimedNull())
                            {
                                irpr.DisbursementTaxExemptTaxed = irpr.DisbursementTaxExemptClaimed;
                            }

                            irpr.OfficerID = FM.AtMng.WorkingAsOfficer.OfficerId;
                            irpr.DateTaxed = DateTime.Today;
                        }
                    }

                    tsNewIRP.Enabled = Janus.Windows.UI.InheritableBoolean.True;
                    dateTaxedCalendarCombo.ReadOnly  = false;
                    dateTaxedCalendarCombo.BackColor = SystemColors.Window;
                    mccTaxingOfficer.ReadOnly        = false;
                    tsSaveIRP.Enabled = Janus.Windows.UI.InheritableBoolean.True;
                    feesClaimedNumericEditBox.ReadOnly                   = false;
                    feesClaimedNumericEditBox.BackColor                  = SystemColors.Window;
                    disbursementClaimedNumericEditBox.ReadOnly           = false;
                    disbursementClaimedNumericEditBox.BackColor          = SystemColors.Window;
                    disbursementTaxExemptClaimedNumericEditBox.ReadOnly  = false;
                    disbursementTaxExemptClaimedNumericEditBox.BackColor = SystemColors.Window;

                    feesTaxedNumericEditBox.ReadOnly                   = false;
                    feesTaxedNumericEditBox.BackColor                  = SystemColors.Window;
                    disbursementTaxedNumericEditBox.ReadOnly           = false;
                    disbursementTaxedNumericEditBox.BackColor          = SystemColors.Window;
                    disbursementTaxedTaxNumericEditBox.ReadOnly        = false;
                    disbursementTaxedTaxNumericEditBox.BackColor       = SystemColors.Window;
                    disbursementTaxExemptTaxedNumericEditBox.ReadOnly  = false;
                    disbursementTaxExemptTaxedNumericEditBox.BackColor = SystemColors.Window;
                }
            }
        }