public void SignIn(App_Technician technician) { // dch rkl 12/07/2016 catch exception try { App.Database.SaveTechnicianAsCurrent(technician); if (App.Database.HasDataConnection()) { App.Database.CreateDependentTables(technician); } App_Settings appSettings = App.Database.GetApplicationSettings(); appSettings.LoggedInTechnicianNo = technician.TechnicianNo; appSettings.LoggedInTechnicianDeptNo = technician.TechnicianDeptNo; App.Database.SaveAppSettings(appSettings); IsSignedIn = true; } catch (Exception ex) { // dch rkl 12/07/2016 Log Error ErrorReporting errorReporting = new ErrorReporting(); errorReporting.sendException(ex, "TechDashboard.TechnicianListPageViewModel.SignIn"); } }
public TicketDetailsPageViewModel() { // dch rkl 12/07/2016 catch exception try { _scheduledAppointment = App.Database.RetrieveCurrentScheduledAppointment(); if (_scheduledAppointment != null) { _workTicket = App.Database.GetWorkTicket(_scheduledAppointment); _customer = App.Database.GetAppCustomer(_salesOrderHeader.CustomerNo); _salesOrder = App.Database.GetSalesOrder(_workTicket, _customer); if (_workTicket.DtlRepairItemCode != null) { _repairItem = App.Database.GetItemFromDB(_workTicket.DtlRepairItemCode); } else { _repairItem = new CI_Item(); } JT_Technician jt_technician = App.Database.GetCurrentTechnicianFromDb(); _appTechnician = new App_Technician(jt_technician); AR_CustomerContact customerContact = App.Database.GetCustomerContact(_customer.ContactCode); _customerContact = new App_CustomerContact(customerContact); } } catch (Exception ex) { // dch rkl 12/07/2016 Log Error ErrorReporting errorReporting = new ErrorReporting(); errorReporting.sendException(ex, "TechDashboard.TicketDetailsPageViewModel()"); } }
protected List <string> GetTechnicianWarehouses() { List <string> warehouseList = App.Database.GetTechnicianWarehouses(); // dch rkl 12/07/2016 catch exception try { App_Technician technician = App.CurrentTechnician; if ((PartToEdit.Warehouse != null) && (!warehouseList.Contains(PartToEdit.Warehouse))) { warehouseList.Insert(0, PartToEdit.Warehouse); } if ((technician.DefaultWarehouse != null) && (!warehouseList.Contains(technician.DefaultWarehouse))) { warehouseList.Insert(0, technician.DefaultWarehouse); } } catch (Exception ex) { // dch rkl 12/07/2016 Log Error ErrorReporting errorReporting = new ErrorReporting(); errorReporting.sendException(ex, "TechDashboard.PartsEditPageViewModel.GetTechnicianWarehouses"); } return(warehouseList); }
/// <summary> /// Checks to see if the specified technician is clocked into a ticket. /// </summary> /// <returns>True if technician is logged into a valid ticket, False otherwise.</returns> public bool IsClockedIn(App_Technician technician) { lock (_locker) { JT_Technician erpTech = _database.Table <JT_Technician>().Where( t => (t.TechnicianDeptNo == technician.TechnicianDeptNo) && (t.TechnicianNo == technician.TechnicianNo) ).FirstOrDefault(); if (((erpTech.CurrentSalesOrderNo != null) && (erpTech.CurrentSalesOrderNo.Length > 0)) && ((erpTech.CurrentWTNumber != null) && (erpTech.CurrentWTNumber.Length > 0)) && ((erpTech.CurrentWTStep != null) && (erpTech.CurrentWTStep.Length > 0))) { // it's possible this tech is clocked in to a ticket. But, do we have an actual // ticket or is this left-over data? JT_TechnicianScheduleDetail scheduleDetail = _database.Table <JT_TechnicianScheduleDetail>().Where( sd => (sd.SalesOrderNo == erpTech.CurrentSalesOrderNo) && (sd.WTNumber == erpTech.CurrentWTNumber) && (sd.WTStep == erpTech.CurrentWTStep) ).FirstOrDefault(); if (scheduleDetail != null) { // we do have a clocked-in work ticket for this tech return(true); } } } return(false); }
/// <summary> /// Marks the given JT_Technician record as being the currently-selected /// technician by setting the IsCurrent flag on the local database record. /// </summary> /// <param name="technician">The JT_Technician object/record to mark as current.</param> public void SaveTechnicianAsCurrent(App_Technician technician) { int rows = 0; lock (_locker) { // Unset any techs that are marked as "current" List <JT_Technician> currentTechnicians = _database.Table <JT_Technician>().Where(t => t.IsCurrent == true).ToList(); if (currentTechnicians.Count > 0) { foreach (JT_Technician technicianInList in currentTechnicians) { technicianInList.IsCurrent = false; } _database.UpdateAll(currentTechnicians); } // find the corresponding JT_Technician record JT_Technician technicianToUse = _database.Table <JT_Technician>().Where( t => (t.TechnicianDeptNo == technician.TechnicianDeptNo) && (t.TechnicianNo == technician.TechnicianNo) ).FirstOrDefault(); // Set the tech as current. technicianToUse.IsCurrent = true; rows = _database.Update(technicianToUse); } if (rows > 0) { OnCurrentTechnicianChanged(EventArgs.Empty); } }
public int DeleteRepairPart(App_RepairPart part, App_WorkTicket workTicket, App_Technician technician) { int rows = 0; JT_TransactionImportDetail detail = new JT_TransactionImportDetail(); lock (_locker) { detail.ID = part.ID; detail.RecordType = "P"; detail.SalesOrderNo = workTicket.SalesOrderNo; detail.WTNumber = workTicket.WTNumber; detail.WTStep = workTicket.WTStep; detail.EmployeeDeptNo = technician.TechnicianDeptNo; detail.EmployeeNo = technician.TechnicianNo; detail.TransactionDate = System.DateTime.Now.ToString("yyyy-MM-dd"); detail.ItemCode = part.PartItemCode; detail.WarehouseCode = part.Warehouse; detail.QuantityUsed = part.Quantity; detail.UnitCost = part.UnitCost; detail.UnitPrice = part.UnitPrice; detail.ChargePart = (part.IsChargeable ? "Y" : "N"); detail.PrintPart = (part.IsPrintable ? "Y" : "N"); detail.PurchasePart = (part.IsPurchased ? "Y" : "N"); detail.Overhead = (part.IsOverhead ? "Y" : "N"); detail.UnitOfMeasure = part.UnitOfMeasure; detail.CommentText = part.Comment; detail.LotSerialNo = part.LotSerialNo; rows = _database.Delete <JT_TransactionImportDetail>(detail.ID); } return(rows); }
public async void SignIn(App_Technician technician) { if (IsLoading) { return; } else { IsLoading = true; await Task.Run(() => App.Database.SaveTechnicianAsCurrent(technician)); //Thread.Sleep(5000); await Task.Run(() => App.Database.CreateDependentTables(technician)); //Thread.Sleep(5000); App_Settings appSettings = App.Database.GetApplicationSettings(); appSettings.LoggedInTechnicianNo = technician.TechnicianNo; appSettings.LoggedInTechnicianDeptNo = technician.TechnicianDeptNo; App.Database.SaveAppSettings(appSettings); IsLoading = false; IsSignedIn = true; } }
/// <summary> /// Sets the given technician as being clocked-in to a ticket represented by the /// specified scheduled appointment object. The time and status codes provided /// will also be used to update the technician data. /// </summary> /// <param name="technician">Technician to clock in</param> /// <param name="scheduledAppointment">Scheduled Appointment object to clock into</param> /// <param name="startDateTime">Start date/time</param> /// <param name="technicianStatus">Technician status object for the new, clocked-in status</param> /// <param name="serviceTicketStatusCode">Work ticket status for the new, clocked-in status</param> public void ClockIn(App_Technician technician, App_ScheduledAppointment scheduledAppointment, DateTime startDateTime, JT_TechnicianStatus technicianStatus, JT_MiscellaneousCodes serviceTicketStatusCode) { // Is this tech already clocked into a ticket? if (IsClockedIn(technician)) { throw new Exception("Technician is already clocked into a ticket!"); } int rows = 0; // Update the erp record with the ticket info JT_Technician erpTech = GetTechnician(technician.TechnicianDeptNo, technician.TechnicianNo); erpTech.CurrentStartDate = startDateTime.Date; erpTech.CurrentStartTime = startDateTime.ToSage100TimeString(); erpTech.CurrentSalesOrderNo = scheduledAppointment.SalesOrderNumber; erpTech.CurrentWTNumber = scheduledAppointment.WorkTicketNumber; erpTech.CurrentWTStep = scheduledAppointment.WorkTicketStep; erpTech.CurrentStatus = technicianStatus.StatusCode; // dch rkl 11/03/2016 Save Current Status code to JT_Technician table rows = _database.Update(erpTech); // create the JT_TransactionImportDetail record JT_TransactionImportDetail importDetail = new JT_TransactionImportDetail(); importDetail.RecordType = "S"; importDetail.SalesOrderNo = scheduledAppointment.SalesOrderNumber; importDetail.WTNumber = scheduledAppointment.WorkTicketNumber; importDetail.WTStep = scheduledAppointment.WorkTicketStep; importDetail.StatusCode = serviceTicketStatusCode.MiscellaneousCode; //importDetail.statusDate TODO>>> not in table spec! importDetail.TransactionDate = startDateTime.ToShortDateString(); importDetail.TransactionDateAsDateTime = startDateTime; // dch rkl 12/09/2016 per Chris, store start time in start time //importDetail.StatusTime = startDateTime.ToSage100TimeString(); importDetail.StartTime = startDateTime.ToSage100TimeString(); //importDetail.StatusComment = ""; // not used at this time but might be in the future rows = _database.Insert(importDetail); // TODO... do we need this anymore now that we are tracking in/out // on technician record? JT_DailyTimeEntry newTimeEntry = new JT_DailyTimeEntry(); newTimeEntry.DepartmentNo = technician.TechnicianDeptNo; newTimeEntry.EmployeeNo = technician.TechnicianNo; newTimeEntry.SalesOrderNo = scheduledAppointment.SalesOrderNumber; newTimeEntry.WTNumber = scheduledAppointment.WorkTicketNumber; newTimeEntry.WTStep = scheduledAppointment.WorkTicketStep; newTimeEntry.StartTime = startDateTime.ToSage100TimeString(); newTimeEntry.TransactionDate = startDateTime; newTimeEntry.IsModified = true; rows = _database.Insert(newTimeEntry); }
public App_ScheduledAppointment RetrieveCurrentScheduledAppointment() { lock (_locker) { App_Technician technician = new App_Technician(GetCurrentTechnicianFromDb()); return(RetrieveCurrentScheduledAppointment(technician)); } }
public App_ScheduledAppointment RetrieveCurrentScheduledAppointment(App_Technician technician) { lock (_locker) { JT_Technician erpTech = _database.Table <JT_Technician>().Where( t => (t.TechnicianDeptNo == technician.TechnicianDeptNo) && (t.TechnicianNo == technician.TechnicianNo) ).FirstOrDefault(); return(RetrieveCurrentScheduledAppointment(erpTech)); } }
/// <summary> /// Retreives the App_Technician record marked as the current technician. /// </summary> /// <returns>The current App_Technician object.</returns> public App_Technician RetrieveCurrentTechnician() { App_Technician techToReturn = null; lock (_locker) { JT_Technician currentTech = _database.Table <JT_Technician>().Where(t => t.IsCurrent == true).FirstOrDefault(); if (currentTech != null) { techToReturn = new App_Technician(currentTech); } } return(techToReturn); }
public TechnicianPageViewModel() { // dch rkl 12/07/2016 catch exception try { _technician = App.Database.RetrieveCurrentTechnician(); _technicianStatusList = App.Database.GetTechnicianStatusesFromDB(); } catch (Exception ex) { // dch rkl 12/07/2016 Log Error ErrorReporting errorReporting = new ErrorReporting(); errorReporting.sendException(ex, "TechDashboard.TechnicianPageViewModel.SignIn"); } }
public MiscellaneousTimePageViewModel() { // dch rkl 12/07/2016 catch exception try { _appTechnician = new App_Technician(App.Database.GetCurrentTechnicianFromDb()); _jtearningscode = App.Database.GetEarningsCodesFromDBforMisc(); _timeEntries = App.Database.GetTimeEntriesByTech(_appTechnician.TechnicianNo); } catch (Exception ex) { // dch rkl 12/07/2016 Log Error ErrorReporting errorReporting = new ErrorReporting(); errorReporting.sendException(ex, "TechDashboard.MiscellaneousTimePageViewModel()"); } }
public JT_DailyTimeEntry GetClockedInTimeEntry(App_Technician technician) { JT_DailyTimeEntry returnData = null; lock (_locker) { returnData = _database.Table <JT_DailyTimeEntry>().Where( dte => (dte.DepartmentNo == technician.TechnicianDeptNo) && (dte.EmployeeNo == technician.TechnicianNo) && (dte.StartTime != null) && (dte.EndTime == null) ).FirstOrDefault(); } return(returnData); }
public void UpdateTechnicianStatus(App_Technician technician, string newStatusCode) { JT_TechnicianStatus newStatus; lock (_locker) { // First, be sure this status code is valid newStatus = _database.Table <JT_TechnicianStatus>().Where( ts => (ts.StatusCode == newStatusCode) ).FirstOrDefault(); if (newStatus != null) { UpdateTechnicianStatus(technician, newStatus); } } }
protected List <string> GetTechnicianWarehouses() { App_Technician technician = App.CurrentTechnician; List <string> warehouseList = App.Database.GetTechnicianWarehouses(); if ((PartToEdit.Warehouse != null) && (!warehouseList.Contains(PartToEdit.Warehouse))) { warehouseList.Insert(0, PartToEdit.Warehouse); } if ((technician.DefaultWarehouse != null) && (!warehouseList.Contains(technician.DefaultWarehouse))) { warehouseList.Insert(0, technician.DefaultWarehouse); } return(warehouseList); }
public async void UpdateTechnicianStatus(App_Technician technician, JT_TechnicianStatus newStatusCode) { int rows = 0; JT_Technician techToUpdate = null; lock (_locker) { if (newStatusCode != null) { // Get the technician record to update techToUpdate = GetTechnician(technician.TechnicianDeptNo, technician.TechnicianNo); if (techToUpdate != null) { // Set the status and attempt the update techToUpdate.CurrentStatus = newStatusCode.StatusCode; rows = _database.Update(techToUpdate); System.Diagnostics.Debug.WriteLine("Rows updated = " + rows.ToString()); if (rows > 0) { // update successful, so set app object, too. technician.CurrentStatus = newStatusCode.StatusCode; } } } } // Now that the DB is updated, send same info back to HQ if (techToUpdate != null) { try { bool result = await UpdateErpTechnicianStatus(techToUpdate); } catch (Exception exception) { // this may fail absent a data connection, could return false } } }
public TicketDetailsPageViewModel(App_ScheduledAppointment scheduledAppointment) { _scheduledAppointment = scheduledAppointment; _workTicket = App.Database.GetWorkTicket(_scheduledAppointment); _customer = App.Database.GetAppCustomer(_workTicket); _salesOrder = App.Database.GetSalesOrder(_workTicket, _customer); if (_workTicket.DtlRepairItemCode != null) { _repairItem = App.Database.GetItemFromDB(_workTicket.DtlRepairItemCode); } else { _repairItem = new CI_Item(); } JT_Technician jt_technician = App.Database.GetCurrentTechnicianFromDb(); _appTechnician = new App_Technician(jt_technician); AR_CustomerContact customerContact = App.Database.GetCustomerContact(_customer.ContactCode); _customerContact = new App_CustomerContact(customerContact); }
public void CreateDependentTables(App_Technician technician) { CreateDependentTables(GetTechnician(technician.TechnicianDeptNo, technician.TechnicianNo)); }
// dch rkl 01/13/2017 Create to save extended comment public JT_TransactionImportDetail SaveRepairPartDesc(App_RepairPart part, App_WorkTicket workTicket, App_Technician technician, string extdDesc) { int rows = 0; JT_TransactionImportDetail detail = new JT_TransactionImportDetail(); lock (_locker) { detail.ID = part.ID; detail.RecordType = "P"; detail.SalesOrderNo = workTicket.SalesOrderNo; detail.WTNumber = workTicket.WTNumber; detail.WTStep = workTicket.WTStep; detail.EmployeeDeptNo = technician.TechnicianDeptNo; detail.EmployeeNo = technician.TechnicianNo; detail.TransactionDate = System.DateTime.Now.ToString("yyyy-MM-dd"); detail.TransactionDateAsDateTime = System.DateTime.Now; detail.ItemCode = part.PartItemCode; detail.WarehouseCode = part.Warehouse; detail.QuantityUsed = part.Quantity; detail.UnitCost = part.UnitCost; detail.UnitPrice = part.UnitPrice; detail.ChargePart = (part.IsChargeable ? "Y" : "N"); detail.PrintPart = (part.IsPrintable ? "Y" : "N"); detail.PurchasePart = (part.IsPurchased ? "Y" : "N"); detail.Overhead = (part.IsOverhead ? "Y" : "N"); detail.UnitOfMeasure = part.UnitOfMeasure; detail.CommentText = part.Comment; detail.LotSerialNo = part.LotSerialNo; detail.ItemCodeDesc = extdDesc; // Save the Extended Comment detail.QuantityRequired = (double)part.QuantityReqd; detail.QuantityCompleted = part.QuantityShipped; detail.SOLineKey = part.SoLineKey; // dch rkl 01/23/2017 Save SOLineKey // do save if (detail.ID != 0) { // update existing rows = _database.Update(detail); } else { // insert new rows = _database.Insert(detail); } } return(detail); }
public TechnicianPageViewModel() { _technician = App.Database.RetrieveCurrentTechnician(); _technicianStatusList = App.Database.GetTechnicianStatusesFromDB(); }
/// <summary> /// Sets the given technician as being clocked-out of a ticket represented by the /// specified work ticket object. The time and status codes provided /// will also be used to update the technician data. /// </summary> /// <param name="technician">Technician to clock out</param> /// <param name="workTicket">Work ticket clocking out of</param> /// <param name="stopDateTime">Stop date/time</param> /// <param name="technicianStatus">Technician status object for the new, clocked-out status</param> /// <param name="serviceTicketStatusCode">Work ticket status for the new, clocked-out status</param> /// <param name="activityCode">Activity code to report</param> /// <param name="deptWorked">Department in which work was performed</param> /// <param name="earningsCode">Earnings code to report</param> /// <param name="meterReading">Meter reading (if any) to report</param> /// <param name="workPerformedText">Text/notes</param> public void ClockOut(App_Technician technician, App_WorkTicket workTicket, DateTime stopDateTime, JT_TechnicianStatus technicianStatus, JT_MiscellaneousCodes serviceTicketStatusCode, string activityCode, string deptWorked, JT_EarningsCode earningsCode, double hoursBilled, double hoursWorked, double meterReading, string workPerformedText, string svcAgmtContractCode, string clockoutDate, string billingType) { int rows = 0; DateTime startDateTime; lock (_locker) { // Clear out fields for JT_Technician record JT_Technician erpTech = GetTechnician(technician.TechnicianDeptNo, technician.TechnicianNo); // Record starting date/time in local variable startDateTime = erpTech.CurrentStartDate; // Add time startDateTime = startDateTime.Add(erpTech.CurrentStartTime.ToSage100TimeSpan()); if (hoursBilled <= 0) { hoursBilled = (stopDateTime - startDateTime).TotalHours; } // update time entry first JT_DailyTimeEntry currentTimeEntry = GetClockedInTimeEntry(technician); if (currentTimeEntry != null) { currentTimeEntry.EndTime = stopDateTime.ToSage100TimeString(); _database.Update(currentTimeEntry); } erpTech.CurrentStartDate = new DateTime(); erpTech.CurrentStartTime = null; erpTech.CurrentSalesOrderNo = null; erpTech.CurrentWTNumber = null; erpTech.CurrentWTStep = null; erpTech.CurrentStatus = technicianStatus.StatusCode; // dch rkl 11/03/2016 Save Current Status code to JT_Technician table rows = _database.Update(erpTech); rows = _database.Update(erpTech); // insert the JT_TransactionImportDetail record JT_TransactionImportDetail importDetail = new JT_TransactionImportDetail(); importDetail.RecordType = "S"; importDetail.SalesOrderNo = workTicket.SalesOrderNo; importDetail.WTNumber = workTicket.WTNumber; importDetail.WTStep = workTicket.WTStep; importDetail.StatusCode = serviceTicketStatusCode.MiscellaneousCode; //importDetail.statusDate TODO>>> not in table spec! // dch rkl 12/09/2016 per Chris, store start time in start time //importDetail.StatusTime = stopDateTime.ToSage100TimeString(); importDetail.StartTime = stopDateTime.ToSage100TimeString(); importDetail.TransactionDate = stopDateTime.ToSage100DateString(); importDetail.TransactionDateAsDateTime = stopDateTime; //importDetail.StatusComment = "TODO"; // not used at this time but might be in the future rows = _database.Insert(importDetail); // insert another JT_TransactionImportDetail record to record the labor importDetail = new JT_TransactionImportDetail(); importDetail.RecordType = "L"; importDetail.SalesOrderNo = workTicket.SalesOrderNo; importDetail.WTNumber = workTicket.WTNumber; importDetail.WTStep = workTicket.WTStep; importDetail.EmployeeDeptNo = technician.TechnicianDeptNo; importDetail.EmployeeNo = technician.TechnicianNo; importDetail.ActivityCode = activityCode; importDetail.DeptWorkedIn = deptWorked; importDetail.EarningsCode = earningsCode.EarningsCode; importDetail.SvcAgmtContractCode = svcAgmtContractCode; //importDetail.TransactionDate = stopDateTime.ToSage100DateString(); // dch rkl 02/03/2017 Use Start Date as Tran Date DateTime dtTranDt; if (DateTime.TryParse(clockoutDate, out dtTranDt)) { importDetail.TransactionDate = dtTranDt.ToSage100DateString(); importDetail.TransactionDateAsDateTime = dtTranDt; } else { importDetail.TransactionDate = startDateTime.ToSage100DateString(); importDetail.TransactionDateAsDateTime = startDateTime; } //importDetail.TransactionDate = startDateTime.ToSage100DateString(); //importDetail.TransactionDateAsDateTime = startDateTime; importDetail.StartTime = startDateTime.ToSage100TimeString(); importDetail.EndTime = stopDateTime.ToSage100TimeString(); importDetail.HoursWorked = hoursWorked; // (stopDateTime - startDateTime).TotalHours; //bk adding hours billed and billing type importDetail.BillableHours = hoursBilled; importDetail.BillingType = billingType; importDetail.MeterReading = meterReading; importDetail.WorkPerformed = workPerformedText; importDetail.SvcAgmtContractCode = svcAgmtContractCode; // dch rkl 01/23/2017 Include Service Agreement Code rows = _database.Insert(importDetail); } }
public MiscellaneousTimePageViewModel() { _appTechnician = new App_Technician(App.Database.GetCurrentTechnicianFromDb()); _jtearningscode = App.Database.GetEarningsCodesFromDBforMisc(); _timeEntries = App.Database.GetTimeEntriesByTech(_appTechnician.TechnicianNo); }
/// <summary> /// Sets the given technician as being clocked-out of a ticket represented by the /// specified work ticket object. The time and status codes provided /// will also be used to update the technician data. /// dch rkl 01/23/2017 This version of ClockOut includes parameters for when the hours are entered, not the start/stop date and time. /// </summary> /// <param name="technician">Technician to clock out</param> /// <param name="workTicket">Work ticket clocking out of</param> /// <param name="stopDateTime">Stop date/time</param> /// <param name="technicianStatus">Technician status object for the new, clocked-out status</param> /// <param name="serviceTicketStatusCode">Work ticket status for the new, clocked-out status</param> /// <param name="activityCode">Activity code to report</param> /// <param name="deptWorked">Department in which work was performed</param> /// <param name="earningsCode">Earnings code to report</param> /// <param name="meterReading">Meter reading (if any) to report</param> /// <param name="workPerformedText">Text/notes</param> public void ClockOut(App_Technician technician, App_WorkTicket workTicket, JT_TechnicianStatus technicianStatus, JT_MiscellaneousCodes serviceTicketStatusCode, string activityCode, string deptWorked, JT_EarningsCode earningsCode, double hoursBilled, double meterReading, string workPerformedText, double hoursWorked, string svcAgmtContractCode, string billingType) { int rows = 0; lock (_locker) { // Clear out fields for JT_Technician record JT_Technician erpTech = GetTechnician(technician.TechnicianDeptNo, technician.TechnicianNo); // update time entry first DateTime dtStartTime = DateTime.Now; JT_DailyTimeEntry currentTimeEntry = GetClockedInTimeEntry(technician); if (currentTimeEntry != null) { if (DateTime.TryParse(currentTimeEntry.StartTime, out dtStartTime)) { DateTime dtStopTime = dtStartTime.AddHours(hoursWorked); currentTimeEntry.EndTime = dtStopTime.ToSage100TimeString(); _database.Update(currentTimeEntry); } } erpTech.CurrentStartDate = new DateTime(); erpTech.CurrentStartTime = null; erpTech.CurrentSalesOrderNo = null; erpTech.CurrentWTNumber = null; erpTech.CurrentWTStep = null; erpTech.CurrentStatus = technicianStatus.StatusCode; // dch rkl 11/03/2016 Save Current Status code to JT_Technician table rows = _database.Update(erpTech); // insert the JT_TransactionImportDetail record JT_TransactionImportDetail importDetail = new JT_TransactionImportDetail(); importDetail.RecordType = "S"; importDetail.SalesOrderNo = workTicket.SalesOrderNo; importDetail.WTNumber = workTicket.WTNumber; importDetail.WTStep = workTicket.WTStep; importDetail.StatusCode = serviceTicketStatusCode.MiscellaneousCode; importDetail.TransactionDate = dtStartTime.ToSage100DateString(); importDetail.TransactionDateAsDateTime = dtStartTime; importDetail.HoursWorked = hoursWorked; rows = _database.Insert(importDetail); // insert another JT_TransactionImportDetail record to record the labor importDetail = new JT_TransactionImportDetail(); importDetail.RecordType = "L"; importDetail.SalesOrderNo = workTicket.SalesOrderNo; importDetail.WTNumber = workTicket.WTNumber; importDetail.WTStep = workTicket.WTStep; importDetail.EmployeeDeptNo = technician.TechnicianDeptNo; importDetail.EmployeeNo = technician.TechnicianNo; importDetail.ActivityCode = activityCode; importDetail.DeptWorkedIn = deptWorked; importDetail.EarningsCode = earningsCode.EarningsCode; importDetail.TransactionDate = dtStartTime.ToSage100DateString(); importDetail.TransactionDateAsDateTime = dtStartTime; importDetail.HoursWorked = hoursWorked; //bk add hours billed importDetail.BillableHours = hoursBilled; importDetail.BillingType = billingType; importDetail.MeterReading = meterReading; importDetail.WorkPerformed = workPerformedText; importDetail.SvcAgmtContractCode = svcAgmtContractCode; // dch rkl 01/23/2017 Include Service Agreement Code rows = _database.Insert(importDetail); } }