Skip to content

Instantly share code, notes, and snippets.

@tocohara
Created December 21, 2020 02:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tocohara/71e398397fb17b170d5e8ed5b3f363ac to your computer and use it in GitHub Desktop.
Save tocohara/71e398397fb17b170d5e8ed5b3f363ac to your computer and use it in GitHub Desktop.
Update Appointment Detail Actual Fields Method
public virtual void UpdateAppointmentDetActualFields(AppointmentCore.AppointmentDetails_View appointmentDetails,
AppointmentCore.AppointmentServiceEmployees_View appointmentEmployees,
bool isReOpen = false)
{
foreach (FSAppointmentDet fsAppointmentDetRow in appointmentDetails.Select().RowCast<FSAppointmentDet>())
{
if (fsAppointmentDetRow.IsService || fsAppointmentDetRow.IsInventoryItem)
{
if (fsAppointmentDetRow.IsService && fsAppointmentDetRow.StaffRelated == true)
{
appointmentDetails.Cache.SetDefaultExt<FSAppointmentDet.actualDuration>(fsAppointmentDetRow);
}
else if (fsAppointmentDetRow.IsService && fsAppointmentDetRow.StaffRelated == false)
{
appointmentDetails.Cache.SetDefaultExt<FSAppointmentDet.actualDuration>(fsAppointmentDetRow);
}
if (fsAppointmentDetRow.BillingRule == ID.BillingRule.FLAT_RATE
|| fsAppointmentDetRow.BillingRule == ID.BillingRule.NONE
|| fsAppointmentDetRow.IsInventoryItem == true)
{
fsAppointmentDetRow.Qty = isReOpen ? 0 : fsAppointmentDetRow.EstimatedQty;
}
appointmentDetails.Update(fsAppointmentDetRow);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment