예제 #1
0
        protected virtual void Shipment_RowUpdating(PXCache sender, PXRowUpdatingEventArgs e)
        {
            Shipment row         = (Shipment)e.NewRow;
            Shipment originalRow = (Shipment)e.Row;

            if (row.ShipmentType == ShipmentTypes.Single &&
                !sender.ObjectsEqual <Shipment.deliveryMaxDate>(row, originalRow))
            {
                if (row.DeliveryDate != null && row.DeliveryMaxDate != null &&
                    row.DeliveryMaxDate < row.DeliveryDate)
                {
                    row.DeliveryMaxDate = row.DeliveryDate;
                    sender.RaiseExceptionHandling <Shipment.deliveryMaxDate>(row, row.DeliveryMaxDate,
                                                                             new PXSetPropertyException("Specified value was too early.", PXErrorLevel.Warning));
                }
            }
            else if (row.ShipmentType == ShipmentTypes.Single &&
                     !sender.ObjectsEqual <Shipment.deliveryDate,
                                           Shipment.deliveryMaxDate>(row, originalRow))
            {
                if (row.DeliveryDate != null && row.DeliveryMaxDate != null &&
                    row.DeliveryDate > row.DeliveryMaxDate)
                {
                    sender.RaiseExceptionHandling <Shipment.deliveryDate>(row, row.DeliveryDate,
                                                                          new PXSetPropertyException("Delivery time expired."));
                    e.Cancel = true;
                }
            }
        }
예제 #2
0
        protected virtual void POVendorInventory_RowUpdated(PXCache sender, PXRowUpdatedEventArgs e)
        {
            POVendorInventory row = (POVendorInventory)e.Row;

            if (row != null && row.InventoryID != null && row.SubItemID != null && row.PurchaseUnit != null)
            {
                if (!sender.ObjectsEqual <POVendorInventory.pendingDate>(e.Row, e.OldRow) ||
                    !sender.ObjectsEqual <POVendorInventory.pendingPrice>(e.Row, e.OldRow) ||
                    !sender.ObjectsEqual <POVendorInventory.effPrice>(e.Row, e.OldRow))
                {
                    APSalesPrice sp = getAPSalesPrice(row);

                    if (sp != null)
                    {
                        APSalesPrice copy = PXCache <APSalesPrice> .CreateCopy(sp);

                        copy.PendingPrice  = row.PendingPrice;
                        copy.EffectiveDate = row.PendingDate;
                        copy.SalesPrice    = row.EffPrice;
                        copy.LastDate      = row.EffDate;
                        copy.LastPrice     = row.LastPrice;
                        VendorPrice.Update(copy);
                    }
                }

                this.VendorCatalogue.View.RequestRefresh();
            }
        }
예제 #3
0
 public virtual void SOProcessFilter_RowUpdated(PXCache sender, PXRowUpdatedEventArgs e)
 {
     if ((!sender.ObjectsEqual <SOProcessFilter.action>(e.Row, e.OldRow) || !sender.ObjectsEqual <SOProcessFilter.definePrinterManually>(e.Row, e.OldRow) || !sender.ObjectsEqual <SOProcessFilter.printWithDeviceHub>(e.Row, e.OldRow)) &&
         Filter.Current != null && PXAccess.FeatureInstalled <FeaturesSet.deviceHub>() && Filter.Current.PrintWithDeviceHub == true && Filter.Current.DefinePrinterManually == true)
     {
         Filter.Current.PrinterID = new NotificationUtility(this).SearchPrinter(SONotificationSource.Customer, SOReports.PrintSalesOrder, Accessinfo.BranchID);
     }
 }
 protected virtual void PrintParameters_RowUpdated(PXCache sender, PXRowUpdatedEventArgs e)
 {
     if ((!sender.ObjectsEqual <PrintParameters.action>(e.Row, e.OldRow) || !sender.ObjectsEqual <PrintParameters.definePrinterManually>(e.Row, e.OldRow) || !sender.ObjectsEqual <PrintParameters.printWithDeviceHub>(e.Row, e.OldRow)) &&
         Filter.Current != null && PXAccess.FeatureInstalled <FeaturesSet.deviceHub>() && Filter.Current.PrintWithDeviceHub == true && Filter.Current.DefinePrinterManually == true)
     {
         Filter.Current.PrinterName = new NotificationUtility(this).SearchPrinter(
             ARNotificationSource.Customer, ARReports.DunningLetterReportID, Accessinfo.BranchID);
     }
 }
        public virtual void SOInvoiceFilter_RowUpdated(PXCache sender, PXRowUpdatedEventArgs e)
        {
            _ActionChanged = !sender.ObjectsEqual <SOInvoiceFilter.action>(e.Row, e.OldRow);

            if ((_ActionChanged || !sender.ObjectsEqual <PrintInvoicesFilter.definePrinterManually>(e.Row, e.OldRow) || !sender.ObjectsEqual <SOShipmentFilter.printWithDeviceHub>(e.Row, e.OldRow)) &&
                Filter.Current != null && PXAccess.FeatureInstalled <FeaturesSet.deviceHub>() && Filter.Current.PrintWithDeviceHub == true && Filter.Current.DefinePrinterManually == true)
            {
                Filter.Current.PrinterName = new NotificationUtility(this).SearchPrinter(ARNotificationSource.Customer, SOReports.PrintInvoiceReport, Accessinfo.BranchID);
            }
        }
예제 #6
0
        protected virtual void Tax_RowUpdated(PXCache sender, PXRowUpdatedEventArgs e)
        {
            Tax newTax = (Tax)e.Row;
            Tax oldTax = (Tax)e.OldRow;

            ClearOldWarningsAndErrors(sender, newTax);
            CheckAndFixTaxRates(newTax);
            SetWarningsOnRowUpdate(sender, newTax, oldTax);
            ProcessTaxRevOnTaxVendorChangeOnTaxUpdate(sender, newTax, oldTax);
            VerifyTaxRevReportingGroupTypesOnTaxUpdate(newTax, oldTax);

            if (!sender.ObjectsEqual <Tax.outDate>(e.Row, e.OldRow))
            {
                PXSelectBase <TaxRev> TaxRevFiltered = new
                                                       PXSelect <TaxRev,
                                                                 Where <TaxRev.taxID, Equal <Current <Tax.taxID> >,
                                                                        And <TaxRev.startDate, Greater <Required <Tax.outDate> > > > >(this);

                if (newTax.OutDate.HasValue && TaxRevFiltered.Select(newTax.OutDate).Count > 0)
                {
                    Tax.Cache.RaiseExceptionHandling <Tax.outDate>(newTax, newTax.OutDate,
                                                                   new PXSetPropertyException(Messages.TaxOutDateTooEarly, PXErrorLevel.Warning));
                }
                else
                {
                    sender.SetValue <Tax.outdated>(e.Row, newTax.OutDate.HasValue);
                    DateTime newEndDate = newTax.OutDate ?? new DateTime(9999, 6, 6);

                    foreach (TaxRev rev in TaxRevisions.Select())
                    {
                        TaxRev revcopy = (TaxRev)TaxRevisions.Cache.CreateCopy(rev);
                        revcopy.EndDate = newEndDate;
                        TaxRevisions.Cache.Update(revcopy);
                    }
                }
            }

            if (!sender.ObjectsEqual <Tax.reportExpenseToSingleAccount>(e.Row, e.OldRow) && newTax.ReportExpenseToSingleAccount == false)
            {
                sender.SetValue <Tax.expenseAccountID>(newTax, null);
                sender.SetValue <Tax.expenseSubID>(newTax, null);
            }

            if (!sender.ObjectsEqual <Tax.reportExpenseToSingleAccount>(e.Row, e.OldRow) && newTax.ReportExpenseToSingleAccount == true)
            {
                sender.SetDefaultExt <Tax.expenseAccountID>(e.Row);
                sender.SetDefaultExt <Tax.expenseSubID>(e.Row);
            }
        }
예제 #7
0
        public virtual void SOShipmentFilter_RowUpdated(PXCache sender, PXRowUpdatedEventArgs e)
        {
            _ActionChanged = !sender.ObjectsEqual <SOShipmentFilter.action>(e.Row, e.OldRow);
            if (_ActionChanged)
            {
                ((SOShipmentFilter)e.Row).PackagingType = SOShipmentFilter.Both;
            }

            if ((_ActionChanged || !sender.ObjectsEqual <SOShipmentFilter.definePrinterManually>(e.Row, e.OldRow) || !sender.ObjectsEqual <SOShipmentFilter.printWithDeviceHub>(e.Row, e.OldRow)) &&
                Filter.Current != null && PXAccess.FeatureInstalled <FeaturesSet.deviceHub>() && Filter.Current.PrintWithDeviceHub == true && Filter.Current.DefinePrinterManually == true)
            {
                string actualReportID = SOReports.GetReportID(GetActionIDByName(Filter.Current.Action), null) ?? SOReports.GetReportIDByName(Orders, Filter.Current.Action);
                Filter.Current.PrinterName = new NotificationUtility(this).SearchPrinter(ARNotificationSource.Customer, actualReportID, Accessinfo.BranchID);
            }
        }
예제 #8
0
        protected virtual void ShipmentLine_RowUpdated(PXCache sender, PXRowUpdatedEventArgs e)
        {
            ShipmentLine newLine    = (ShipmentLine)e.Row;
            ShipmentLine oldLine    = (ShipmentLine)e.OldRow;
            Shipment     row        = Shipments.Current;
            bool         rowUpdated = false;

            if (!sender.ObjectsEqual <ShipmentLine.lineQty>(newLine, oldLine) && newLine.Cancelled != true)
            {
                row.TotalQty -= oldLine.LineQty;
                row.TotalQty += newLine.LineQty;
                rowUpdated    = true;
            }
            if (!sender.ObjectsEqual <ShipmentLine.cancelled>(newLine, oldLine))
            {
                if (newLine.Cancelled == true)
                {
                    row.TotalQty -= oldLine.LineQty;
                }
                else if (oldLine.Cancelled == true)
                {
                    row.TotalQty += newLine.LineQty;
                }
                rowUpdated = true;
            }

            if (row.ShipmentType != ShipmentTypes.Single)
            {
                if (!sender.ObjectsEqual <ShipmentLine.shipmentDate, ShipmentLine.shipmentTime>(newLine, oldLine))
                {
                    if (newLine.ShipmentDate != null && newLine.ShipmentTime != null)
                    {
                        row.ShippedQty += newLine.LineQty;
                        rowUpdated      = true;
                    }
                    if (oldLine.ShipmentDate != null && oldLine.ShipmentTime != null)
                    {
                        row.ShippedQty -= oldLine.LineQty;
                        rowUpdated      = true;
                    }
                }
            }

            if (rowUpdated == true)
            {
                Shipments.Update(row);
            }
        }
 public virtual void BranchAcctMapTo_RowUpdating(PXCache sender, PXRowUpdatingEventArgs e)
 {
     if (!sender.ObjectsEqual <BranchAcctMapTo.fromAccountCD, BranchAcctMapTo.toAccountCD>(e.Row, e.NewRow))
     {
         e.Cancel = !ValidateDuplicateMap <BranchAcctMap.fromBranchID>(sender, MapTo.View, e.NewRow, e.Row);
     }
 }
예제 #10
0
        /// <summary>
        /// Process the tax reverse on tax vendor change on tax update. Called on <see cref="Tax_RowUpdated(PXCache, PXRowUpdatedEventArgs)"/>.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="newTax">The new tax.</param>
        /// <param name="oldTax">The old tax.</param>
        public virtual void ProcessTaxRevOnTaxVendorChangeOnTaxUpdate(PXCache sender, Tax newTax, Tax oldTax)
        {
            bool taxVendorChanged = !sender.ObjectsEqual <Tax.taxVendorID>(newTax, oldTax);

            if (!taxVendorChanged)
            {
                return;
            }

            foreach (TaxRev rev in TaxRevisions.Select())
            {
                if (newTax.TaxVendorID == null)
                {
                    rev.TaxBucketID = rev.TaxType == TaxType.Sales ? -2 : -1;
                }
                else
                {
                    rev.TaxBucketID = null;
                    TaxRevisions.Cache.RaiseExceptionHandling <TaxRev.taxBucketID>(rev, null, new PXSetPropertyException(ErrorMessages.FieldIsEmpty));
                }

                TaxRevisions.Cache.MarkUpdated(rev);
            }

            PopulateBucketList(newTax);
        }
예제 #11
0
        protected virtual void APSetup_RowUpdated(PXCache sender, PXRowUpdatedEventArgs e)
        {
            APSetup row = e.Row as APSetup;

            if (row == null)
            {
                return;
            }

            if (row != null && (!sender.ObjectsEqual <APSetup.retentionType>(e.Row, e.OldRow) || !sender.ObjectsEqual <APSetup.numberOfMonths>(e.Row, e.OldRow)))
            {
                if (row.RetentionType == AR.RetentionTypeList.LastPrice)
                {
                    sender.RaiseExceptionHandling <APSetup.retentionType>(e.Row, ((APSetup)e.Row).RetentionType, new PXSetPropertyException(Messages.LastPriceWarning, PXErrorLevel.Warning));
                }
                if (row.RetentionType == AR.RetentionTypeList.FixedNumOfMonths)
                {
                    if (row.NumberOfMonths != 0)
                    {
                        sender.RaiseExceptionHandling <APSetup.retentionType>(e.Row, ((APSetup)e.Row).RetentionType, new PXSetPropertyException(Messages.HistoricalPricesWarning, PXErrorLevel.Warning, row.NumberOfMonths));
                    }
                    if (row.NumberOfMonths == 0)
                    {
                        sender.RaiseExceptionHandling <APSetup.retentionType>(e.Row, ((APSetup)e.Row).RetentionType, new PXSetPropertyException(Messages.HistoricalPricesUnlimitedWarning, PXErrorLevel.Warning, row.NumberOfMonths));
                    }
                }
            }
        }
 protected virtual void AllocationFilter_RowUpdated(PXCache cache, PXRowUpdatedEventArgs e)
 {
     if (!cache.ObjectsEqual <AllocationFilter.date, AllocationFilter.allocationID, AllocationFilter.customerClassID, AllocationFilter.customerID, AllocationFilter.projectID, AllocationFilter.taskID>(e.Row, e.OldRow))
     {
         Items.Cache.Clear();
     }
 }
 protected virtual void BAccount_RowUpdated(PXCache cache, PXRowUpdatedEventArgs e)
 {
     if (!cache.ObjectsEqual <BAccount.acctCD>(e.Row, e.OldRow) && ((BAccount)e.OldRow).AcctCD == null)
     {
         InitBAccount((BAccount)e.Row);
     }
 }
예제 #14
0
        protected virtual void ShipmentLine_RowUpdating(PXCache sender, PXRowUpdatingEventArgs e)
        {
            ShipmentLine line         = (ShipmentLine)e.NewRow;
            ShipmentLine originalLine = (ShipmentLine)e.Row;
            Shipment     row          = Shipments.Current;

            if (row.ShipmentType != ShipmentTypes.Single &&
                !sender.ObjectsEqual <ShipmentLine.shipmentTime,
                                      ShipmentLine.shipmentMinTime,
                                      ShipmentLine.shipmentMaxTime>(line, originalLine))
            {
                if (line.ShipmentTime != null && line.ShipmentMinTime != null &&
                    line.ShipmentTime < line.ShipmentMinTime)
                {
                    sender.RaiseExceptionHandling <ShipmentLine.shipmentTime>(line, line.ShipmentTime,
                                                                              new PXSetPropertyException("Delivery Time is too early."));
                    e.Cancel = true;
                }
                if (line.ShipmentTime != null && line.ShipmentMaxTime != null &&
                    line.ShipmentTime > line.ShipmentMaxTime)
                {
                    line.ShipmentTime = line.ShipmentMaxTime;
                    sender.RaiseExceptionHandling <ShipmentLine.shipmentTime>(line, line.ShipmentTime,
                                                                              new PXSetPropertyException("Specified Delivery Time was too late.", PXErrorLevel.Warning));
                }
            }
        }
예제 #15
0
        protected virtual void LocationAPPaymentInfo_RowUpdated(PXCache sender, PXRowUpdatedEventArgs e)
        {
            LocationAPPaymentInfo record = (LocationAPPaymentInfo)e.Row;

            if (!sender.ObjectsEqual <LocationAPPaymentInfo.vCashAccountID, LocationAPPaymentInfo.vPaymentMethodID, LocationAPPaymentInfo.vPaymentLeadTime, LocationAPPaymentInfo.vPaymentByType, LocationAPPaymentInfo.vSeparateCheck, LocationAPPaymentInfo.isRemitAddressSameAsMain, LocationAPPaymentInfo.isRemitContactSameAsMain>(e.Row, e.OldRow))
            {
                Location mainloc = Location.Current;
                mainloc.VCashAccountID           = record.VCashAccountID;
                mainloc.VPaymentMethodID         = record.VPaymentMethodID;
                mainloc.VPaymentLeadTime         = record.VPaymentLeadTime;
                mainloc.VPaymentByType           = record.VPaymentByType;
                mainloc.VSeparateCheck           = record.VSeparateCheck;
                mainloc.IsRemitAddressSameAsMain = record.IsRemitAddressSameAsMain;
                mainloc.VRemitAddressID          = record.VRemitAddressID;
                mainloc.IsRemitContactSameAsMain = record.IsRemitContactSameAsMain;
                mainloc.VRemitContactID          = record.VRemitContactID;

                if (Location.Cache.GetStatus(mainloc) == PXEntryStatus.Notchanged)
                {
                    Location.Cache.SetStatus(mainloc, PXEntryStatus.Updated);
                }

                sender.Graph.Caches[typeof(Location)].IsDirty = true;
            }
        }
예제 #16
0
 protected virtual void BillingFilter_RowUpdated(PXCache cache, PXRowUpdatedEventArgs e)
 {
     if (!cache.ObjectsEqual <BillingFilter.invoiceDate, BillingFilter.invFinPeriodID, BillingFilter.statementCycleId, BillingFilter.customerClassID, BillingFilter.customerID, BillingFilter.templateID>(e.Row, e.OldRow))
     {
         Items.Cache.Clear();
     }
 }
 public virtual void CRSetup_RowUpdated(PXCache sender, PXRowUpdatedEventArgs e)
 {
     if (!sender.ObjectsEqual <CRSetup.contactEmailUnique, CRSetup.leadValidationThreshold>(e.Row, e.OldRow))
     {
         CRSetup row = (CRSetup)e.Row;
         LeadContactValidationRules rule = LeadContactValidationRules.Search <CRValidationRules.matchingField>(typeof(Contact.eMail).Name);
         if (row.ContactEmailUnique == true)
         {
             var emailRule = (LeadContactValidationRules)(LeadContactValidationRules.Cache.CreateCopy(rule ?? LeadContactValidationRules.Cache.CreateInstance()));
             emailRule.ValidationType     = ValidationTypesAttribute.LeadContact;
             emailRule.MatchingField      = this.Caches[typeof(Contact)].GetField(typeof(Contact.eMail));
             emailRule.TransformationRule = TransformationRulesAttribute.None;
             emailRule.ScoreWeight        = row.LeadValidationThreshold;
             LeadContactValidationRules.Update(emailRule);
         }
         else
         {
             if (rule != null)
             {
                 LeadContactValidationRules.Cache.SetDefaultExt <CRValidationRules.scoreWeight>(rule);
                 LeadContactValidationRules.Cache.SetDefaultExt <CRValidationRules.transformationRule>(rule);
                 LeadContactValidationRules.Update(rule);
             }
         }
     }
 }
        protected virtual void ARSetup_RowUpdated(PXCache sender, PXRowUpdatedEventArgs e)
        {
            ARSetup row = e.Row as ARSetup;

            if (row != null && row.ConsolidatedDunningLetter == false)
            {
                row.DunningLetterBranchID = null;
            }
            if (row != null && row.ConsolidatedStatement == false)
            {
                row.StatementBranchID = null;
            }

            if (row != null && (!sender.ObjectsEqual <ARSetup.retentionType>(e.Row, e.OldRow) || !sender.ObjectsEqual <ARSetup.numberOfMonths>(e.Row, e.OldRow)))
            {
                if (row.RetentionType == RetentionTypeList.LastPrice)
                {
                    sender.RaiseExceptionHandling <ARSetup.retentionType>(e.Row, ((ARSetup)e.Row).RetentionType, new PXSetPropertyException(Messages.LastPriceWarning, PXErrorLevel.Warning));
                }
                if (row.RetentionType == RetentionTypeList.FixedNumOfMonths)
                {
                    if (row.NumberOfMonths != 0)
                    {
                        sender.RaiseExceptionHandling <ARSetup.retentionType>(e.Row, ((ARSetup)e.Row).RetentionType, new PXSetPropertyException(Messages.HistoricalPricesWarning, PXErrorLevel.Warning, row.NumberOfMonths));
                    }
                    if (row.NumberOfMonths == 0)
                    {
                        sender.RaiseExceptionHandling <ARSetup.retentionType>(e.Row, ((ARSetup)e.Row).RetentionType, new PXSetPropertyException(Messages.HistoricalPricesUnlimitedWarning, PXErrorLevel.Warning, row.NumberOfMonths));
                    }
                }
            }
        }
예제 #19
0
        protected virtual void OrderLine_RowUpdated(PXCache sender, PXRowUpdatedEventArgs e)
        {
            OrderLine  newLine   = (OrderLine)e.Row;
            OrderLine  oldLine   = (OrderLine)e.OldRow;
            SalesOrder order     = Orders.Current;
            bool       isUpdated = false;

            if (!sender.ObjectsEqual <OrderLine.taxAmt>(newLine, oldLine))
            {
                if (oldLine.TaxAmt != null)
                {
                    order.TaxTotal -= oldLine.TaxAmt;
                }
                if (newLine.TaxAmt != null)
                {
                    order.TaxTotal += newLine.TaxAmt;
                }
                isUpdated = true;
            }

            if (isUpdated)
            {
                Orders.Update(order);
            }
        }
        private bool ValidateDuplicateMap <BranchField>(PXCache sender, PXView view, object row, object oldrow)
            where BranchField : IBqlField
        {
            int?   branch   = (int?)sender.GetValue <BranchField>(row);
            string fromMask = (string)sender.GetValue <BranchAcctMap.fromAccountCD>(row);
            string toMask   = (string)sender.GetValue <BranchAcctMap.toAccountCD>(row);

            if (string.IsNullOrEmpty(fromMask) || string.IsNullOrEmpty(toMask))
            {
                return(false);
            }

            PXSetPropertyException ex = null;

            if (string.Compare(fromMask, toMask, true) > 0)
            {
                ex = new PXSetPropertyException(Messages.MapAccountError);
            }

            if (ex == null)
            {
                foreach (var item in view.SelectMulti())
                {
                    if (item == row || item == oldrow)
                    {
                        continue;
                    }
                    int?itemBranch = (int?)sender.GetValue <BranchField>(item);
                    if (branch == itemBranch)
                    { // same branch
                        string itemFromMask = (string)sender.GetValue <BranchAcctMap.fromAccountCD>(item);
                        string itemToMask   = (string)sender.GetValue <BranchAcctMap.toAccountCD>(item);
                        if (string.Compare(fromMask, itemToMask, true) < 0 &&
                            string.Compare(itemFromMask, toMask, true) < 0)
                        {
                            ex = new PXSetPropertyException(Messages.MapAccountDuplicate);
                            break;
                        }
                    }
                }
            }

            if (ex != null)
            {
                if (!sender.ObjectsEqual <BranchAcctMapFrom.toAccountCD>(row, oldrow) || (oldrow == null && sender.GetValue <BranchAcctMap.toAccountCD>(row) != null))
                {
                    sender.RaiseExceptionHandling <BranchAcctMapFrom.toAccountCD>(row,
                                                                                  sender.GetValue <BranchAcctMap.toAccountCD>(
                                                                                      row), ex);
                }
                else
                {
                    sender.RaiseExceptionHandling <BranchAcctMapFrom.fromAccountCD>(row,
                                                                                    sender.GetValue <BranchAcctMap.fromAccountCD>(
                                                                                        row), ex);
                }
            }
            return(ex == null);
        }
예제 #21
0
        protected virtual void INSite_RowUpdated(PXCache sender, PXRowUpdatedEventArgs e)
        {
            if (!sender.ObjectsEqual <INSite.branchID>(e.Row, e.OldRow))
            {
                bool found = false;
                foreach (Address record in Address.Cache.Inserted)
                {
                    record.BAccountID = (int?)branch.Cache.GetValue <Branch.bAccountID>(branch.Current);
                    record.CountryID  = (string)branch.Cache.GetValue <Branch.countryID>(branch.Current);
                    found             = true;
                }

                if (!found)
                {
                    object  old_branch = branch.View.SelectSingleBound(new object[] { e.OldRow });
                    Address addr       = (Address)Address.View.SelectSingleBound(new object[] { old_branch, e.OldRow }) ?? new Address();

                    addr.BAccountID = (int?)branch.Cache.GetValue <Branch.bAccountID>(branch.Current);
                    addr.CountryID  = (string)branch.Cache.GetValue <Branch.countryID>(branch.Current);
                    addr.AddressID  = null;
                    Address.Cache.Insert(addr);
                }
                else
                {
                    Address.Cache.Normalize();
                }

                found = false;
                foreach (Contact cont in Contact.Cache.Inserted)
                {
                    cont.BAccountID   = (int?)branch.Cache.GetValue <Branch.bAccountID>(branch.Current);
                    cont.DefAddressID = null;
                    foreach (Address record in Address.Cache.Inserted)
                    {
                        cont.DefAddressID = record.AddressID;
                    }
                    found = true;
                }

                if (!found)
                {
                    object  old_branch = branch.View.SelectSingleBound(new object[] { e.OldRow });
                    Contact cont       = (Contact)Contact.View.SelectSingleBound(new object[] { old_branch, e.OldRow }) ?? new Contact();

                    cont.BAccountID   = (int?)branch.Cache.GetValue <Branch.bAccountID>(branch.Current);
                    cont.DefAddressID = null;
                    foreach (Address record in Address.Cache.Inserted)
                    {
                        cont.DefAddressID = record.AddressID;
                    }
                    cont.ContactID = null;
                    Contact.Cache.Insert(cont);
                }
                else
                {
                    Contact.Cache.Normalize();
                }
            }
        }
 public virtual void POPrintOrderFilter_RowUpdated(PXCache sender, PXRowUpdatedEventArgs e)
 {
     if ((!sender.ObjectsEqual <POPrintOrderFilter.action>(e.Row, e.OldRow) || !sender.ObjectsEqual <POPrintOrderFilter.definePrinterManually>(e.Row, e.OldRow) || !sender.ObjectsEqual <POPrintOrderFilter.printWithDeviceHub>(e.Row, e.OldRow)) &&
         Filter.Current != null && PXAccess.FeatureInstalled <FeaturesSet.deviceHub>() && Filter.Current.PrintWithDeviceHub == true && Filter.Current.DefinePrinterManually == true)
     {
         Filter.Current.PrinterName = new NotificationUtility(this).SearchPrinter(PONotificationSource.Vendor, POReports.PurchaseOrderReportID, Accessinfo.BranchID);
     }
 }
 protected virtual void EPActivityType_RowUpdating(PXCache sender, PXRowUpdatingEventArgs e)
 {
     if (!sender.ObjectsEqual <EPActivityType.type>(e.Row, e.NewRow))
     {
         ValidateUsage(e.Row, epsetup, Messages.ActivityTypeUsageChanged);
         ValidateUsage(e.Row, Activities, Messages.ActivityTypeUsageChanged);
     }
 }
예제 #24
0
 public virtual void SOShipmentFilter_RowUpdated(PXCache sender, PXRowUpdatedEventArgs e)
 {
     _ActionChanged = !sender.ObjectsEqual <SOShipmentFilter.action>(e.Row, e.OldRow);
     if (_ActionChanged)
     {
         ((SOShipmentFilter)e.Row).PackagingType = SOShipmentFilter.Both;
     }
 }
        protected virtual void FSAppointment_RowUpdated(PXCache cache, PXRowUpdatedEventArgs e)
        {
            if (!cache.ObjectsEqual <FSAppointment.srvOrdType>(e.Row, e.OldRow) && ((FSAppointment)e.OldRow).SrvOrdType == null)
            {
                InitServiceOrderRelated((FSAppointment)e.Row);
            }

            FSAppointment fsAppointmentRow = (FSAppointment)e.Row;
        }
예제 #26
0
 protected virtual void ParentFieldUpdated(PXCache sender, PXRowUpdatedEventArgs e)
 {
     if (!sender.ObjectsEqual <CABatch.tranDate>(e.Row, e.OldRow))
     {
         foreach (CABatchDetail detail in this.Details.Select())
         {
             this.Details.Cache.MarkUpdated(detail);
         }
     }
 }
예제 #27
0
 protected virtual void PaymentRowUpdated(PXCache sender, PXRowUpdatedEventArgs e)
 {
     if (!sender.ObjectsEqual <AdjDate, AdjFinPeriodID>(e.Row, e.OldRow))
     {
         foreach (ChargeTable charge in this.View.SelectMulti())
         {
             this.View.Cache.SmartSetStatus(charge, PXEntryStatus.Updated);
         }
     }
 }
예제 #28
0
 protected virtual void PaymentRowUpdated(PXCache sender, PXRowUpdatedEventArgs e)
 {
     if (!sender.ObjectsEqual <DocDate, FinPeriodID>(e.Row, e.OldRow))
     {
         foreach (ChargeTable charge in this.View.SelectMulti())
         {
             this.View.Cache.MarkUpdated(charge);
         }
     }
 }
        protected virtual void INRegister_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            if (e.Row == null)
            {
                return;
            }

            release.SetEnabled(e.Row != null && ((INRegister)e.Row).Hold == false && ((INRegister)e.Row).Released == false);
            iNEdit.SetEnabled(e.Row != null && ((INRegister)e.Row).Hold == false && ((INRegister)e.Row).Released == false);
            iNRegisterDetails.SetEnabled(e.Row != null && ((INRegister)e.Row).Released == true);
            iNItemLabels.SetEnabled(e.Row != null && ((INRegister)e.Row).Released == true);
            addInvBySite.SetEnabled(e.Row != null && ((INRegister)e.Row).Released == false);

            PXUIFieldAttribute.SetEnabled(sender, e.Row, ((INRegister)e.Row).Released == false && ((INRegister)e.Row).OrigModule == GL.BatchModule.IN);
            PXUIFieldAttribute.SetEnabled <INRegister.refNbr>(sender, e.Row, true);
            PXUIFieldAttribute.SetEnabled <INRegister.totalQty>(sender, e.Row, false);
            PXUIFieldAttribute.SetEnabled <INRegister.totalCost>(sender, e.Row, false);
            PXUIFieldAttribute.SetEnabled <INRegister.status>(sender, e.Row, false);

            sender.AllowInsert = true;
            sender.AllowUpdate = (((INRegister)e.Row).Released == false);
            sender.AllowDelete = (((INRegister)e.Row).Released == false && ((INRegister)e.Row).OrigModule == GL.BatchModule.IN);

            lsselect.AllowInsert = (((INRegister)e.Row).Released == false && ((INRegister)e.Row).OrigModule == GL.BatchModule.IN);
            lsselect.AllowUpdate = (((INRegister)e.Row).Released == false);
            lsselect.AllowDelete = (((INRegister)e.Row).Released == false && ((INRegister)e.Row).OrigModule == GL.BatchModule.IN);

            PXUIFieldAttribute.SetVisible <INRegister.controlQty>(sender, e.Row, (bool)insetup.Current.RequireControlTotal);
            PXUIFieldAttribute.SetVisible <INRegister.controlCost>(sender, e.Row, (bool)insetup.Current.RequireControlTotal);

            INTran tran = transactions.Current ?? transactions.SelectWindowed(0, 1);

            if (tran != null)
            {
                ((INRegister)e.Row).TransferNbr = tran.OrigRefNbr;
            }
            PXUIFieldAttribute.SetEnabled <INRegister.transferNbr>(sender, e.Row, sender.AllowUpdate && tran == null);
            PXUIFieldAttribute.SetEnabled <INRegister.branchID>(sender, e.Row, sender.AllowUpdate && ((INRegister)e.Row).TransferNbr == null);

            if (sender.Graph.IsImport == true && copy != null && sender.ObjectsEqual <INRegister.transferNbr, INRegister.released>(e.Row, copy))
            {
                return;
            }

            PXUIFieldAttribute.SetEnabled <INTran.branchID>(transactions.Cache, null, sender.AllowUpdate && ((INRegister)e.Row).TransferNbr == null);
            PXUIFieldAttribute.SetEnabled <INTran.inventoryID>(transactions.Cache, null, sender.AllowUpdate && ((INRegister)e.Row).TransferNbr == null);
            PXUIFieldAttribute.SetEnabled <INTran.subItemID>(transactions.Cache, null, sender.AllowUpdate && ((INRegister)e.Row).TransferNbr == null);
            PXUIFieldAttribute.SetEnabled <INTran.siteID>(transactions.Cache, null, sender.AllowUpdate && ((INRegister)e.Row).TransferNbr == null);

            PXUIFieldAttribute.SetVisible <INTran.projectID>(transactions.Cache, null, IsPMVisible);
            PXUIFieldAttribute.SetVisible <INTran.taskID>(transactions.Cache, null, IsPMVisible);

            copy = PXCache <INRegister> .CreateCopy((INRegister)e.Row);
        }
예제 #30
0
 protected override bool IsTaxRowAmountUpdated(PXCache sender, PXRowUpdatedEventArgs e)
 {
     // This method should be overriden
     // to switch on a tax calculation on
     // Tax_RowUpdated event in the case
     // when retainage amount have been changed.
     //
     return
         (base.IsTaxRowAmountUpdated(sender, e) ||
          !sender.ObjectsEqual <ARTax.curyRetainedTaxAmt>(e.Row, e.OldRow));
 }
예제 #31
0
		protected virtual void LocationAPPaymentInfo_RowUpdated(PXCache sender, PXRowUpdatedEventArgs e)
		{
			LocationAPPaymentInfo record = (LocationAPPaymentInfo)e.Row;
            if (!sender.ObjectsEqual<LocationAPPaymentInfo.vCashAccountID, LocationAPPaymentInfo.vPaymentMethodID, LocationAPPaymentInfo.vPaymentLeadTime, LocationAPPaymentInfo.vPaymentByType, LocationAPPaymentInfo.vSeparateCheck, LocationAPPaymentInfo.isRemitAddressSameAsMain, LocationAPPaymentInfo.isRemitContactSameAsMain>(e.Row, e.OldRow))
			{
				Location mainloc = Location.Current;
				mainloc.VCashAccountID = record.VCashAccountID;
				mainloc.VPaymentMethodID = record.VPaymentMethodID;
				mainloc.VPaymentLeadTime = record.VPaymentLeadTime;
				mainloc.VPaymentByType = record.VPaymentByType;
				mainloc.VSeparateCheck = record.VSeparateCheck;
				mainloc.IsRemitAddressSameAsMain = record.IsRemitAddressSameAsMain;
				mainloc.VRemitAddressID = record.VRemitAddressID;
				mainloc.IsRemitContactSameAsMain = record.IsRemitContactSameAsMain;
				mainloc.VRemitContactID = record.VRemitContactID;

				if (Location.Cache.GetStatus(mainloc) == PXEntryStatus.Notchanged)
				{
					Location.Cache.SetStatus(mainloc, PXEntryStatus.Updated);
				}

				sender.Graph.Caches[typeof (Location)].IsDirty = true;
			}
		}        
예제 #32
0
		protected virtual void LocationAPAccountSub_RowUpdated(PXCache sender, PXRowUpdatedEventArgs e)
		{
			LocationAPAccountSub record = (LocationAPAccountSub)e.Row;

			if (!sender.ObjectsEqual<LocationAPAccountSub.vAPAccountID, LocationAPAccountSub.vAPSubID>(e.Row, e.OldRow))
			{
				Location mainloc = Location.Current;
				mainloc.VAPAccountID = record.VAPAccountID;
				mainloc.VAPSubID = record.VAPSubID;

				if (Location.Cache.GetStatus(mainloc) == PXEntryStatus.Notchanged)
				{
					Location.Cache.SetStatus(mainloc, PXEntryStatus.Updated);
				}
			}
		}
예제 #33
0
		protected virtual void SOInvoice_RowUpdated(PXCache sender, PXRowUpdatedEventArgs e)
		{
			if (!sender.ObjectsEqual<SOInvoice.curyDiscTot>(e.OldRow, e.Row))
			{
                AddDiscount(sender, e);
			}

			if (!sender.ObjectsEqual<SOInvoice.isCCCaptured>(e.Row, e.OldRow) && ((SOInvoice)e.Row).IsCCCaptured == true)
			{
				ARInvoice copy = (ARInvoice)Document.Cache.CreateCopy(Document.Current);

				copy.CreditHold = false;

				Document.Cache.Update(copy);
			}

			if (!sender.ObjectsEqual<SOInvoice.curyPaymentTotal>(e.OldRow, e.Row))
			{
				ARInvoice ardoc = Document.Search<ARInvoice.refNbr>(((SOInvoice)e.Row).RefNbr, ((SOInvoice)e.Row).DocType);
				//is null on delete operation
				if (ardoc != null)
				{
					((SOInvoice)e.Row).CuryPaymentAmt = ardoc.CuryOrigDocAmt - ardoc.CuryOrigDiscAmt - ((SOInvoice)e.Row).CuryPaymentTotal;
				}
			}

			if (!sender.ObjectsEqual<SOInvoice.pMInstanceID, SOInvoice.paymentMethodID, SOInvoice.cashAccountID>(e.Row, e.OldRow))
			{ 
				ARInvoice ardoc = Document.Search<ARInvoice.refNbr>(((SOInvoice)e.Row).RefNbr, ((SOInvoice)e.Row).DocType);
				//is null on delete operation
				if (ardoc != null)
				{
					ardoc.PMInstanceID = ((SOInvoice)e.Row).PMInstanceID;
					ardoc.PaymentMethodID = ((SOInvoice)e.Row).PaymentMethodID;
					ardoc.CashAccountID = ((SOInvoice)e.Row).CashAccountID;
					
					if (Document.Cache.GetStatus(ardoc) == PXEntryStatus.Notchanged)
					{
						Document.Cache.SetStatus(ardoc, PXEntryStatus.Updated);
					}
				}
			}
		}
예제 #34
0
		protected override void ARTran_RowUpdated(PXCache sender, PXRowUpdatedEventArgs e)
		{
			ARTran row = (ARTran)e.Row;
			ARTran oldRow = (ARTran)e.OldRow;

			if (row != null)
			{
				if (!sender.ObjectsEqual<ARTran.qty,
					ARTran.uOM>(e.OldRow, e.Row))
				{
					SetFlatUnitPrice(sender, row);
				}

                if (!sender.ObjectsEqual<ARTran.branchID>(e.Row, e.OldRow) || !sender.ObjectsEqual<ARTran.inventoryID>(e.Row, e.OldRow) ||
                    !sender.ObjectsEqual<ARTran.qty>(e.Row, e.OldRow) || !sender.ObjectsEqual<ARTran.curyUnitPrice>(e.Row, e.OldRow) ||
                    !sender.ObjectsEqual<ARTran.curyExtPrice>(e.Row, e.OldRow) || !sender.ObjectsEqual<ARTran.curyDiscAmt>(e.Row, e.OldRow) ||
                    !sender.ObjectsEqual<ARTran.discPct>(e.Row, e.OldRow) || !sender.ObjectsEqual<ARTran.manualDisc>(e.Row, e.OldRow) ||
                    !sender.ObjectsEqual<ARTran.discountID>(e.Row, e.OldRow))
                    RecalculateDiscounts(sender, row);

				TaxAttribute.Calculate<ARTran.taxCategoryID>(sender, e);

				//if any of the fields that was saved in avalara has changed mark doc as TaxInvalid.
				if (SODocument.Current != null && IsExternalTax == true &&
					!sender.ObjectsEqual<ARTran.accountID, ARTran.inventoryID, ARTran.tranDesc, ARTran.tranAmt, ARTran.tranDate, ARTran.taxCategoryID>(e.Row, e.OldRow))
				{
					if (SODocument.Current != null && SODocument.Current.IsTaxValid == true)
					{
					    SODocument.Current.IsTaxValid = false;
					    if (SODocument.Cache.GetStatus(SODocument.Current) == PXEntryStatus.Notchanged)
					        SODocument.Cache.SetStatus(SODocument.Current, PXEntryStatus.Updated);
					}

					if (Document.Current != null)
					{
					    Document.Current.IsTaxValid = false;
					    if (Document.Cache.GetStatus(Document.Current) == PXEntryStatus.Notchanged)
					        Document.Cache.SetStatus(Document.Current, PXEntryStatus.Updated);
					}
				}
			}
		}
예제 #35
0
		protected override void ARInvoice_RowUpdated(PXCache sender, PXRowUpdatedEventArgs e)
		{
			ARSetup.Current.RequireControlTotal = (((ARInvoice)e.Row).DocType == ARDocType.CashSale || ((ARInvoice)e.Row).DocType == ARDocType.CashReturn) ? true : ARSetup.Current.RequireControlTotal;

			base.ARInvoice_RowUpdated(sender, e);

			ARInvoice doc = e.Row as ARInvoice;
			if ((doc.DocType == ARDocType.CashSale || doc.DocType == ARDocType.CashReturn) && doc.Released != true)
			{
				if (sender.ObjectsEqual<ARInvoice.curyDocBal, ARInvoice.curyOrigDiscAmt>(e.Row, e.OldRow) == false && doc.CuryDocBal - doc.CuryOrigDiscAmt != doc.CuryOrigDocAmt)
				{
					if (doc.CuryDocBal != null && doc.CuryOrigDiscAmt != null && doc.CuryDocBal != 0)
						sender.SetValueExt<ARInvoice.curyOrigDocAmt>(doc, doc.CuryDocBal - doc.CuryOrigDiscAmt);
					else
						sender.SetValueExt<ARInvoice.curyOrigDocAmt>(doc, 0m);
				}
				else if (sender.ObjectsEqual<ARInvoice.curyOrigDocAmt>(e.Row, e.OldRow) == false)
				{
					if (doc.CuryDocBal != null && doc.CuryOrigDocAmt != null && doc.CuryDocBal != 0)
						sender.SetValueExt<ARInvoice.curyOrigDiscAmt>(doc, doc.CuryDocBal - doc.CuryOrigDocAmt);
					else
						sender.SetValueExt<ARInvoice.curyOrigDiscAmt>(doc, 0m);
				}
			}

			if ((doc.DocType == ARDocType.CashSale || doc.DocType == ARDocType.CashReturn) && doc.Released != true && doc.Hold != true)
			{
				if (doc.CuryDocBal < doc.CuryOrigDocAmt)
				{
					sender.RaiseExceptionHandling<ARInvoice.curyOrigDocAmt>(doc, doc.CuryOrigDocAmt, new PXSetPropertyException(AR.Messages.CashSaleOutOfBalance));
				}
				else
				{
					sender.RaiseExceptionHandling<ARInvoice.curyOrigDocAmt>(doc, doc.CuryOrigDocAmt, null);
				}
			}

			if (!sender.ObjectsEqual<ARInvoice.customerID, ARInvoice.docDate, ARInvoice.finPeriodID, ARInvoice.curyTaxTotal, ARInvoice.curyOrigDocAmt, ARInvoice.docDesc, ARInvoice.curyOrigDiscAmt>(e.Row, e.OldRow))
			{
				SODocument.Current = (SOInvoice)SODocument.Select() ?? (SOInvoice)SODocument.Cache.Insert();
				SODocument.Current.CustomerID = ((ARInvoice)e.Row).CustomerID;

                if ((((ARInvoice)e.Row).DocType == ARDocType.CashSale 
                        || ((ARInvoice)e.Row).DocType == ARDocType.CashReturn 
                        || ((ARInvoice)e.Row).DocType == ARDocType.Invoice) && !sender.ObjectsEqual<ARInvoice.customerID>(e.Row, e.OldRow))
				{
                    SODocument.Cache.SetDefaultExt<SOInvoice.paymentMethodID>(SODocument.Current);
					SODocument.Cache.SetDefaultExt<SOInvoice.pMInstanceID>(SODocument.Current);
				}

				SODocument.Current.AdjDate = ((ARInvoice)e.Row).DocDate;
				SODocument.Current.AdjFinPeriodID = ((ARInvoice)e.Row).FinPeriodID;
				SODocument.Current.AdjTranPeriodID = ((ARInvoice)e.Row).TranPeriodID;
				SODocument.Current.CuryTaxTotal = ((ARInvoice)e.Row).CuryTaxTotal;
				SODocument.Current.TaxTotal = ((ARInvoice)e.Row).TaxTotal;
				SODocument.Current.CuryPaymentAmt = ((ARInvoice)e.Row).CuryOrigDocAmt - ((ARInvoice)e.Row).CuryOrigDiscAmt - SODocument.Current.CuryPaymentTotal;
				SODocument.Current.DocDesc = ((ARInvoice)e.Row).DocDesc;
				SODocument.Current.PaymentProjectID = PM.ProjectDefaultAttribute.NonProject(this);

				if (SODocument.Cache.GetStatus(SODocument.Current) == PXEntryStatus.Notchanged)
				{
					SODocument.Cache.SetStatus(SODocument.Current, PXEntryStatus.Updated);
				}
			}
		}