protected virtual void LocationAPPaymentInfo_IsRemitAddressSameAsMain_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e) { LocationAPPaymentInfo owner = (LocationAPPaymentInfo)e.Row; if (owner != null) { if (owner.IsRemitAddressSameAsMain == true) { if (owner.VRemitAddressID != owner.VDefAddressID) { Address extAddr = this.FindAddress(owner.VRemitAddressID); if (extAddr != null && extAddr.AddressID == owner.VRemitAddressID) { this.RemitAddress.Delete(extAddr); } owner.VRemitAddressID = owner.VDefAddressID; //if (this.Location.Cache.Locate(owner) != null) // this.Location.Cache.Update(owner); } } if (owner.IsRemitAddressSameAsMain == false) { if (owner.VRemitAddressID != null) { if (owner.VRemitAddressID == owner.VDefAddressID) { Address defAddress = this.FindAddress(owner.VDefAddressID); Address addr = PXCache<Address>.CreateCopy(defAddress); addr.AddressID = null; addr.BAccountID = owner.BAccountID; addr = this.RemitAddress.Insert(addr); owner.VRemitAddressID = addr.AddressID; //if (this.Location.Cache.Locate(owner) != null) // this.Location.Cache.Update(owner); } } } } }
protected virtual void LocationAPPaymentInfo_IsRemitContactSameAsMain_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e) { LocationAPPaymentInfo owner = (LocationAPPaymentInfo)e.Row; if (owner != null) { if (owner.IsRemitContactSameAsMain == true) { if (owner.VRemitContactID != owner.VDefContactID) { Contact contact = this.FindContact(owner.VRemitContactID); if (contact != null && contact.ContactID == owner.VRemitContactID) { this.RemitContact.Delete(contact); } owner.VRemitContactID = owner.VDefContactID; //if (this.Location.Cache.Locate(owner) != null) // this.Location.Cache.Update(owner); } } if (owner.IsRemitContactSameAsMain == false) { if (owner.VRemitContactID != null) { if (owner.VRemitContactID == owner.VDefContactID) { Contact defContact = this.FindContact(owner.VDefContactID); Contact cont = PXCache<Contact>.CreateCopy(defContact); cont.ContactID = null; cont.BAccountID = owner.BAccountID; cont.ContactType = ContactTypesAttribute.BAccountProperty; cont = (Contact)this.RemitContact.Cache.Insert(cont); owner.VRemitContactID = cont.ContactID; //if (this.Location.Cache.Locate(owner) != null) // this.Location.Cache.Update(owner); } } } } }
protected virtual void Location_IsAPAccountSameAsMain_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e) { CR.Location record = (CR.Location)e.Row; if (record.IsAPAccountSameAsMain == false) { LocationAPAccountSub mainloc = APAccountSubLocation.Select(); record.VAPAccountID = mainloc.VAPAccountID; record.VAPSubID = mainloc.VAPSubID; record.VAPAccountLocationID = record.LocationID; LocationAPAccountSub copyloc = new LocationAPAccountSub(); copyloc.BAccountID = record.BAccountID; copyloc.LocationID = record.LocationID; copyloc.VAPAccountID = record.VAPAccountID; copyloc.VAPSubID = record.VAPSubID; BusinessAccount.Cache.Current = (BAccount)PXParentAttribute.SelectParent(sender, e.Row, typeof(BAccount)); APAccountSubLocation.Insert(copyloc); } if (record.IsAPAccountSameAsMain == true) { record.VAPAccountID = null; record.VAPSubID = null; BAccount baccount = (BAccount)PXParentAttribute.SelectParent(sender, e.Row, typeof(BAccount)); if (baccount != null) { record.VAPAccountLocationID = baccount.DefLocationID; } } }
protected virtual void Location_IsAPPaymentInfoSameAsMain_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e) { CR.Location record = (CR.Location)e.Row; if (record.IsAPPaymentInfoSameAsMain == false) { LocationAPPaymentInfo mainloc = APPaymentInfoLocation.Select(); record.VCashAccountID = mainloc.VCashAccountID; record.VPaymentMethodID = mainloc.VPaymentMethodID; record.VPaymentLeadTime = mainloc.VPaymentLeadTime; record.VPaymentByType = mainloc.VPaymentByType; record.VSeparateCheck = mainloc.VSeparateCheck; record.IsRemitAddressSameAsMain = mainloc.IsRemitAddressSameAsMain; record.VRemitAddressID = mainloc.VRemitAddressID; record.IsRemitContactSameAsMain = mainloc.IsRemitContactSameAsMain; record.VRemitContactID = mainloc.VRemitContactID; record.VPaymentInfoLocationID = record.LocationID; LocationAPPaymentInfo copyloc = new LocationAPPaymentInfo(); copyloc.BAccountID = record.BAccountID; copyloc.LocationID = record.LocationID; copyloc.VCashAccountID = record.VCashAccountID; copyloc.VPaymentMethodID = record.VPaymentMethodID; copyloc.VPaymentLeadTime = record.VPaymentLeadTime; copyloc.VPaymentByType = record.VPaymentByType; copyloc.VSeparateCheck = record.VSeparateCheck; copyloc.IsRemitAddressSameAsMain = record.IsRemitAddressSameAsMain; copyloc.VDefAddressID = record.VDefAddressID; copyloc.VRemitAddressID = record.VRemitAddressID; copyloc.IsRemitContactSameAsMain = record.IsRemitContactSameAsMain; copyloc.VRemitContactID = record.VRemitContactID; copyloc.VDefContactID = record.VDefContactID; if (copyloc.VDefAddressID != copyloc.VRemitAddressID) { Address copyaddr = FindAddress(copyloc.VRemitAddressID); copyaddr = PXCache<Address>.CreateCopy(copyaddr); copyaddr.AddressID = null; copyaddr = RemitAddress.Insert(copyaddr); copyloc.VRemitAddressID = copyaddr.AddressID; } if (copyloc.VDefContactID != copyloc.VRemitContactID) { Contact copycont = FindContact(copyloc.VRemitContactID); copycont = PXCache<Contact>.CreateCopy(copycont); copycont.ContactID = null; copycont = RemitContact.Insert(copycont); copyloc.VRemitContactID = copycont.ContactID; } foreach (VendorPaymentMethodDetail maindet in this.PaymentDetails.Select(mainloc.BAccountID, mainloc.LocationID, mainloc.VPaymentMethodID)) { VendorPaymentMethodDetail copydet = PXCache<VendorPaymentMethodDetail>.CreateCopy(maindet); copydet.LocationID = copyloc.LocationID; this.PaymentDetails.Insert(copydet); } BusinessAccount.Cache.Current = (BAccount)PXParentAttribute.SelectParent(sender, e.Row, typeof(BAccount)); APPaymentInfoLocation.Insert(copyloc); } if (record.IsAPPaymentInfoSameAsMain == true) { foreach (VendorPaymentMethodDetail copydet in this.PaymentDetails.Select(record.BAccountID, record.LocationID, record.VPaymentMethodID)) { this.PaymentDetails.Delete(copydet); } BAccount baccount = (BAccount)PXParentAttribute.SelectParent(sender, e.Row, typeof(BAccount)); if (baccount != null) { record.VPaymentInfoLocationID = baccount.DefLocationID; Location mainloc = PXSelect<CR.Location, Where<CR.Location.bAccountID, Equal<Required<CR.Location.bAccountID>>, And<CR.Location.locationID, Equal<Required<CR.Location.locationID>>>>>.Select(sender.Graph, baccount.BAccountID, baccount.DefLocationID); if (mainloc != null) { if (record.DefAddressID != record.VRemitAddressID && mainloc.VRemitAddressID != record.VRemitAddressID) { Address copyaddr = FindAddress(record.VRemitAddressID); RemitAddress.Delete(copyaddr); } if (record.DefContactID != record.VRemitContactID && mainloc.VRemitContactID != record.VRemitContactID) { Contact copycont = FindContact(record.VRemitContactID); RemitContact.Delete(copycont); } } } record.VCashAccountID = null; record.VPaymentMethodID = null; record.VPaymentLeadTime = 0; record.VSeparateCheck = false; record.VRemitAddressID = null; record.VRemitContactID = null; } }
public void FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e) { CurrencyInfo info = e.Row as CurrencyInfo; if (info != null) { //reset effective date to document date first info.SetDefaultEffDate(sender); try { info.defaultCuryRate(sender); } catch (PXSetPropertyException ex) { sender.RaiseExceptionHandling(_FieldName, e.Row, sender.GetValue(e.Row, _FieldOrdinal), ex); } info.CuryPrecision = null; } }
public void FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e) { CurrencyInfo info = e.Row as CurrencyInfo; if (info != null && e.ExternalCall) { decimal rate = Math.Round((decimal)info.SampleRecipRate, 8); if (rate == 0) rate = 1; info.CuryRate = rate; info.RecipRate = Math.Round((decimal)(1 / rate), 8); info.CuryMultDiv = "D"; if (info.CheckRateVariance(sender)) { PXUIFieldAttribute.SetWarning(sender, e.Row, "SampleRecipRate", Messages.RateVarianceExceeded); } } }
protected virtual void SOFreightDetail_AccountID_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e) { SOFreightDetail row = e.Row as SOFreightDetail; if (row != null && row.TaskID == null) { sender.SetDefaultExt<SOFreightDetail.taskID>(e.Row); } }
protected virtual void SOInvoice_PaymentMethodID_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e) { sender.SetDefaultExt<SOInvoice.pMInstanceID>(e.Row); sender.SetDefaultExt<SOInvoice.cashAccountID>(e.Row); sender.SetDefaultExt<SOInvoice.isCCCaptureFailed>(e.Row); }
protected override void ARTran_UOM_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e) { sender.SetDefaultExt<ARTran.unitPrice>(e.Row); sender.SetValue<ARTran.unitPrice>(e.Row, null); }
protected override void ARTran_Qty_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e) { base.ARTran_Qty_FieldUpdated(sender, e); ARTran row = e.Row as ARTran; if (row != null) { sender.SetDefaultExt<ARTran.tranDate>(row); sender.SetValueExt<ARTran.manualDisc>(row, false); if (row != null && row.InventoryID != null && row.UOM != null && row.IsFree != true) { string customerPriceClass = ARPriceClass.EmptyPriceClass; Location c = location.Select(); if (c != null && !string.IsNullOrEmpty(c.CPriceClassID)) customerPriceClass = c.CPriceClassID; DateTime date = Document.Current.DocDate.Value; if (row.TranType == ARDocType.CreditMemo && row.OrigInvoiceDate != null) { date = row.OrigInvoiceDate.Value; } decimal? price = ARSalesPriceMaint.CalculateSalesPrice(sender, customerPriceClass, row.CustomerID, row.InventoryID, currencyinfo.Select(), row.UOM, row.Qty, date, row.CuryUnitPrice); if (price != null) sender.SetValueExt<ARTran.curyUnitPrice>(e.Row, price); } } }
protected override void ARTran_InventoryID_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e) { if (((ARTran)e.Row).SOOrderNbr == null) { sender.SetDefaultExt<ARTran.lineType>(e.Row); } base.ARTran_InventoryID_FieldUpdated(sender, e); }
protected virtual void SOInvoice_CuryDiscTot_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e) { SOInvoice row = e.Row as SOInvoice; if (row == null) return; if (IsExternalTax == true) { row.IsTaxValid = false; } }
protected virtual void SOInvoice_PMInstanceID_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e) { //sender.SetDefaultExt<SOInvoice.paymentMethodID>(e.Row); sender.SetDefaultExt<SOInvoice.cashAccountID>(e.Row); sender.SetDefaultExt<SOInvoice.isCCCaptureFailed>(e.Row); sender.SetValueExt<SOInvoice.refTranExtNbr>(e.Row, null); }
protected virtual void LocationAPPaymentInfo_VPaymentMethodID_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e) { string oldValue = (string)e.OldValue; LocationAPPaymentInfo row = (LocationAPPaymentInfo)e.Row; if (!String.IsNullOrEmpty(oldValue)) { this.ClearPaymentDetails((LocationAPPaymentInfo)e.Row, oldValue, true); } this.FillPaymentDetails((LocationAPPaymentInfo)e.Row); sender.SetDefaultExt<LocationAPPaymentInfo.vCashAccountID>(e.Row); }
public void FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e) { CurrencyInfo info = e.Row as CurrencyInfo; if (info != null) { try { info.defaultCuryRate(sender); } catch (PXSetPropertyException ex) { sender.RaiseExceptionHandling(_FieldName, e.Row, sender.GetValue(e.Row, _FieldOrdinal), ex); } } }
protected virtual void Address_CountryID_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e) { Address addr = (Address)e.Row; if ((string)e.OldValue != addr.CountryID) { addr.State = null; } }
protected override void ARInvoice_CustomerID_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e) { string CreditRule = customer.Current.CreditRule; try { base.ARInvoice_CustomerID_FieldUpdated(sender, e); } finally { customer.Current.CreditRule = CreditRule; } }