protected void SetDataItems() { _workTicket = App.Database.GetCurrentWorkTicket(); _salesOrderHeader = App.Database.RetrieveSalesOrderHeaderFromCurrentWorkTicket(); _customer = App.Database.GetCustomerFromCurrentWorkTicket(); _repairItem = App.Database.RetrieveRepairItemFromCurrentWorkTicket(); }
public App_Item GetItem(string itemCode, string warehouseCode, string manufacturerSerialNumber) { App_Item appItem = null; CI_Item item = null; IM_ItemWarehouse itemWarehouse = null; JT_EquipmentAsset equipmentAsset = null; lock (_locker) { item = GetItemFromDB(itemCode); itemWarehouse = GetItemWarehouseFromDB(itemCode, warehouseCode); if ((item != null) && (itemWarehouse != null)) { if (manufacturerSerialNumber != null) { equipmentAsset = GetEquipmentAsset(item.ItemCode, manufacturerSerialNumber); } appItem = new App_Item(item, itemWarehouse, equipmentAsset); } } return appItem; }
public HistoryPageViewModel(string formattedTicketNumber) { _TicketNumber = formattedTicketNumber; _workTicket = App.Database.GetWorkTicket2(formattedTicketNumber); _history = new List <App_History>(); CI_Item item = App.Database.GetItemFromDB(_workTicket.DtlRepairItemCode); _item = item; JT_EquipmentAsset equipmentAsset = App.Database.GetEquipmentAsset(_workTicket.DtlRepairItemCode); //get any possible work tickets and associated work tickets List <JT_WorkTicket> workTickets = App.Database.GetWorkTickets(_workTicket.DtlRepairItemCode, _workTicket.DtlMfgSerialNo); foreach (var workTicket in workTickets) { List <JT_Transaction> transactionCode = App.Database.GetTransactions(workTicket.SalesOrderNo, workTicket.WTNumber, workTicket.WTStep); List <JT_TransactionHistory> transactionHistoryCode = App.Database.GetTransactionHistory(workTicket.SalesOrderNo, workTicket.WTNumber, workTicket.WTStep); JT_ServiceAgreementHeader serviceAgreementHeader; JT_ServiceAgreementDetail serviceAgreementDetail; if (equipmentAsset != null && equipmentAsset.ContractCode != null) { serviceAgreementHeader = App.Database.GetServiceAgreementHeader(equipmentAsset.ContractCode); serviceAgreementDetail = App.Database.GetServiceAgreementDetail(equipmentAsset.ContractCode); } else { serviceAgreementHeader = new JT_ServiceAgreementHeader(); serviceAgreementDetail = new JT_ServiceAgreementDetail(); } foreach (var transaction in transactionCode) { JT_LaborText laborText = App.Database.GetLaborText(transaction); var history = new App_History( _workTicket, item, equipmentAsset, serviceAgreementHeader, serviceAgreementDetail, transaction, laborText); _history.Add(history); } foreach (var transaction in transactionHistoryCode) { JT_LaborText laborText = App.Database.GetLaborText(transaction); var history = new App_History( _workTicket, item, equipmentAsset, serviceAgreementHeader, serviceAgreementDetail, transaction, laborText); _history.Add(history); } } _history = _history.OrderBy(x => x.TransactionDate).ToList(); }
public void insert_item() { try { if (string.IsNullOrEmpty(txtItem.Text) || string.IsNullOrEmpty(txtPrecio.Text)) { MessageBox.Show("Antes de insertar llene los campos vacĂos."); } else { CI_Item.Nombre_Item = txtItem.Text; CI_Item.Precio = txtPrecio.Text; CI_Item obj = new CI_Item(); obj.insertItem(); txtItem.Text = ""; txtPrecio.Text = ""; } //listar_tipo(); } catch (Exception ex) { MessageBox.Show("Error al listar Tipo"); } }
public PartEditExtdDescPage(App_WorkTicket workTicket, App_RepairPart part, PartsEditPage.PageMode pageMode, App_ScheduledAppointment scheduledAppointment) { _workTicket = workTicket; _part = part; _pageMode = pageMode; _scheduledAppointment = scheduledAppointment; _vm = new PartsEditExtdDescPageViewModel(part, workTicket); InitializeComponent(); labelTitle.FontFamily = Device.OnPlatform("OpenSans-Bold", "sans-serif-black", null); labelItemCode.Text = _part.PartItemCode; labelItemCodeDesc.Text = _part.PartItemCodeDescription; if (_part.ItemCodeDesc != null || _part.ItemCodeDesc.Trim().Length == 0) { CI_Item itm = App.Database.GetItemFromDB(_part.PartItemCode); if (itm.ExtendedDescriptionKey != null && itm.ExtendedDescriptionKey > 0) { CI_ExtendedDescription itmExtdDsc = App.Database.GetExtendedDescription(itm.ExtendedDescriptionKey); } } else { entryExtdDesc.Text = _part.PartItemCodeDescription; } }
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()"); } }
private void ButtonSearch_Click(object sender, RoutedEventArgs e) { if (searchBarText.Text == null || searchBarText.Text.Length == 0) { _vm.FilterItemList(null); } else { // dch rkl 11/15/2016 add miscellaneous part if (searchBarText.Text.Trim().Substring(0, 1) == "*") { CI_Item ciItem = new CI_Item(); ciItem.ItemCode = searchBarText.Text.Trim(); ciItem.ItemCodeDesc = ""; ciItem.StandardUnitOfMeasure = "EACH"; IM_ItemWarehouse imWhse = new IM_ItemWarehouse(); JT_EquipmentAsset jtAsst = new JT_EquipmentAsset(); App_Item appItem = new App_Item(ciItem, imWhse, jtAsst); App_RepairPart part = new App_RepairPart(appItem, _vm.WorkTicket); ContentControl contentArea = (ContentControl)this.Parent; contentArea.Content = new PartsEditPage(_vm.WorkTicket, part, PartsEditPage.PageMode.Add, _scheduledAppointment); } else { _vm.FilterItemList(searchBarText.Text); } } }
public void listar_item() { try { //Tabla Tipo CI_Item obj = new CI_Item(); obj.listarItems(); DataSet dataI = new DataSet(); (CI_Item.getItems).Fill(dataI); dgvItems.AllowUserToAddRows = false; dgvItems.Rows.Clear(); for (int i = 0; i < dataI.Tables[0].Rows.Count; i++) { dgvItems.Rows.Add( dataI.Tables[0].Rows[i][0], dataI.Tables[0].Rows[i][1], dataI.Tables[0].Rows[i][2], dataI.Tables[0].Rows[i][3], dataI.Tables[0].Rows[i][4]); } } catch (Exception ex) { MessageBox.Show("Error al listar Items"); } }
private async void ListViewWorkTickets_ItemTapped(object sender, ItemTappedEventArgs e) { App_RepairPart part = e.Item as App_RepairPart; CI_Item partAsItem = App.Database.GetItemFromDB(part.PartItemCode); await Navigation.PushAsync(new PartsEditPage(_vm.WorkTicket, part, PartsEditPage.PageMode.Edit, _scheduledAppointment)); }
/// <summary> /// Get Product Details for selected Item Code /// </summary> /// <param name="id"></param> /// <returns></returns> public CI_Item GetProductDetails(string id) { SqlConnection con = new SqlConnection(MAS_CML); try { DataTable dt = new DataTable(); SqlCommand cmd = new SqlCommand("SELECT i.ExtendedDescriptionText,c.ItemCode,c.ItemCodeDesc,c.Category1,c.Category2,c.UDF_MANUFACT,c.StandardUnitPrice FROM [dbo].[CI_ExtendedDescription] i,[dbo].[CI_Item] c WHERE i.ExtendedDescriptionKey = c.ExtendedDescriptionKey AND ItemCode Like @itemText", con); cmd.Parameters.AddWithValue("@itemText", string.Format("%{0}%", id)); con.Open(); SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(dt); CI_Item ProductDetail = new CI_Item(); if (dt.Rows.Count > 0) { ProductDetail.ExtendedDescriptionKey = Convert.ToString(dt.Rows[0]["ExtendedDescriptionText"]); ProductDetail.ItemCode = Convert.ToString(dt.Rows[0]["ItemCode"]); ProductDetail.ItemCodeDesc = Convert.ToString(dt.Rows[0]["ItemCodeDesc"]); ProductDetail.Category1 = Convert.ToString(dt.Rows[0]["Category1"]); ProductDetail.Category2 = Convert.ToString(dt.Rows[0]["Category2"]); ProductDetail.UDF_MANUFACT = Convert.ToString(dt.Rows[0]["UDF_MANUFACT"]); ProductDetail.StandardUnitPrice = Convert.ToDecimal(dt.Rows[0]["StandardUnitPrice"]); } return(ProductDetail); } catch (Exception ex) { throw ex; } finally { con.Close(); } }
// DCH 01/13/2017 Add the ExtendedDescriptionKey and ExtendedDescriptionText END public PartsEditPageViewModel(App_WorkTicket workTicket, CI_Item partToEdit) { _workTicket = workTicket; //_partToEdit = partToEdit; //_warehouseList = GetTechnicianWarehouses(); _warehouseList = new List <string>(); List <IM_Warehouse> lsItmWhse = GetWarehouses(); foreach (IM_Warehouse itemWhse in lsItmWhse) { _warehouseList.Add(string.Format("{0} - {1}", itemWhse.WarehouseCode, itemWhse.WarehouseDesc)); } // dch rkl 01/23/2017 added Unit of Measure List _unitOfMeasureList = App.Database.GetCI_UnitOfMeasureFromDB(); _unitOfMeasureList.Add(new CI_UnitOfMeasure() { UnitOfMeasure = "EACH" }); _unitOfMeasureList.Sort((x, y) => x.UnitOfMeasure.CompareTo(y.UnitOfMeasure)); // DCH 01/13/2017 Add the ExtendedDescriptionKey and ExtendedDescriptionText BEGIN _extendedDescriptionKey = partToEdit.ExtendedDescriptionKey; _extendedDescriptionText = ""; if (partToEdit.ExtendedDescriptionKey > 0) { CI_ExtendedDescription extdDesc = App.Database.GetExtendedDescription(partToEdit.ExtendedDescriptionKey); if (extdDesc.ExtendedDescriptionText != null) { _extendedDescriptionText = extdDesc.ExtendedDescriptionText; } } // DCH 01/13/2017 Add the ExtendedDescriptionKey and ExtendedDescriptionText END }
private void Eliminar_Click(object sender, EventArgs e) { CI_Item.Id_Item = dgvItems.CurrentRow.Cells[0].Value.ToString(); CI_Item obj = new CI_Item(); obj.elimItem(); listar_item(); }
public PartsEditPage(App_WorkTicket workTicket, CI_Item part, PageMode pageMode, App_ScheduledAppointment scheduledAppointment) { _pageMode = pageMode; _vm = new PartsEditPageViewModel(workTicket, part); _scheduledAppointment = scheduledAppointment; SetPageLayout(); }
// DCH 01/13/2017 Add the ExtendedDescriptionKey and ExtendedDescriptionText END #endregion public PartsEditPageViewModel(App_WorkTicket workTicket, CI_Item partToEdit) { // dch rkl 12/07/2016 catch exception try { _workTicket = workTicket; // dch rkl 12/01/2016 Get Warehouse List from IM_Warehouse instead of IM_ItemWarehouse BEGIN //_warehouseList = new List<string>(); //List<IM_ItemWarehouse> lsItmWhse = GetItemWarehouses(partToEdit.ItemCode); //foreach (IM_ItemWarehouse itemWhse in lsItmWhse) //{ // _warehouseList.Add(itemWhse.WarehouseCode); //} _warehouseList = GetWarehouses(); foreach (IM_Warehouse whs in _warehouseList) { whs.WarehouseDesc = string.Format("{0} - {1}", whs.WarehouseCode, whs.WarehouseDesc); } // dch rkl 12/01/2016 Get Warehouse List from IM_Warehouse instead of IM_ItemWarehouse END // dch rkl 01/23/2017 added Unit of Measure List _unitOfMeasureList = App.Database.GetCI_UnitOfMeasureFromDB(); _unitOfMeasureList.Add(new CI_UnitOfMeasure() { UnitOfMeasure = "EACH" }); _unitOfMeasureList.Sort((x, y) => x.UnitOfMeasure.CompareTo(y.UnitOfMeasure)); // DCH 01/13/2017 Add the ExtendedDescriptionKey and ExtendedDescriptionText BEGIN _extendedDescriptionKey = partToEdit.ExtendedDescriptionKey; _extendedDescriptionText = ""; if (partToEdit.ExtendedDescriptionKey > 0) { CI_ExtendedDescription extdDesc = App.Database.GetExtendedDescription(partToEdit.ExtendedDescriptionKey); if (extdDesc.ExtendedDescriptionText != null) { _extendedDescriptionText = extdDesc.ExtendedDescriptionText; } } // DCH 01/13/2017 Add the ExtendedDescriptionKey and ExtendedDescriptionText END } catch (Exception ex) { // dch rkl 12/07/2016 Log Error ErrorReporting errorReporting = new ErrorReporting(); errorReporting.sendException(ex, "TechDashboard.PartsEditPageViewModel(App_WorkTicket workTicket, CI_Item partToEdit"); } }
public List <JT_ServiceEquipmentParts> RetrievePartsListFromCurrentWorkTicket() { lock (_locker) { List <JT_ServiceEquipmentParts> partsList = null; CI_Item repairItem = RetrieveRepairItemFromCurrentWorkTicket(); if (repairItem != null) { partsList = _database.Table <JT_ServiceEquipmentParts>().Where( part => repairItem.ItemCode.Contains(part.ItemCode) ).ToList(); } return(partsList); } }
public void AddItemToPartsList(App_WorkTicket workTicket, CI_Item partToAdd) { int rows = 0; lock (_locker) { JT_ServiceEquipmentParts newPart = new JT_ServiceEquipmentParts(); CI_Item repairItem = RetrieveRepairItemFromWorkTicket(workTicket); newPart.ItemCode = repairItem.ItemCode; newPart.PartItemCode = partToAdd.ItemCode; newPart.ProblemCode = "Problems"; newPart.IsModified = true; rows = _database.Insert(newPart); } }
protected void SetPageLayout() { labelItemCode.Content = _part.PartItemCode; labelItemCodeDesc.Content = _part.PartItemCodeDescription; if (_part.ItemCodeDesc != null || _part.ItemCodeDesc.Trim().Length == 0) { CI_Item itm = App.Database.GetItemFromDB(_part.PartItemCode); if (itm.ExtendedDescriptionKey != null && itm.ExtendedDescriptionKey > 0) { CI_ExtendedDescription itmExtdDsc = App.Database.GetExtendedDescription(itm.ExtendedDescriptionKey); } } else { entryExtdDesc.Text = _part.PartItemCodeDescription; } }
public CI_Item RetrieveRepairItemFromWorkTicket(JT_WorkTicket workTicket) { CI_Item currentRepairItem = null; lock (_locker) { if (workTicket != null) { currentRepairItem = _database.Table<CI_Item>().Where( ri => ri.ItemCode == workTicket.DtlRepairItemCode ).FirstOrDefault(); } } return currentRepairItem; }
protected void SetDataItems() { // dch rkl 12/07/2016 catch exception try { _workTicket = App.Database.GetCurrentWorkTicket(); _salesOrderHeader = App.Database.RetrieveSalesOrderHeaderFromCurrentWorkTicket(); _customer = App.Database.GetCustomerFromCurrentWorkTicket(); _repairItem = App.Database.RetrieveRepairItemFromCurrentWorkTicket(); } catch (Exception ex) { // dch rkl 12/07/2016 Log Error ErrorReporting errorReporting = new ErrorReporting(); errorReporting.sendException(ex, "TechDashboard.RootPageViewModel.SetDataItems"); } }
public bool IsPartOnPartsList(JT_WorkTicket workTicket, CI_Item partToFind) { bool returnValue = false; lock (_locker) { try { returnValue = (RetrievePartsListFromWorkTicket(workTicket).Find(part => part.PartItemCode == partToFind.ItemCode) != null); } catch { returnValue = false; } } return(returnValue); }
public List <JT_ServiceEquipmentParts> RetrievePartsListFromWorkTicket(JT_WorkTicket workTicket) { lock (_locker) { //App_CurrentSelectionData currentData = _database.Table<App_CurrentSelectionData>().FirstOrDefault(); List <JT_ServiceEquipmentParts> partsList = null; CI_Item repairItem = RetrieveRepairItemFromWorkTicket(workTicket); if (repairItem != null) { partsList = _database.Table <JT_ServiceEquipmentParts>().Where( part => repairItem.ItemCode.Contains(part.ItemCode) ).ToList(); } return(partsList); } }
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 UpdatePartOnPartsList(CI_Item partToUpdate) { // puke }
// dch rkl 01/16/2017 Return List of Previously Used Serial Numbers for this Mfg Serial Nbr / Part Nbr private List <LotQavl> GetHistParts(string partNbr) { List <LotQavl> lsLotQ = new List <LotQavl>(); List <App_History> lsHistory = new List <App_History>(); CI_Item item = App.Database.GetItemFromDB(_workTicket.DtlRepairItemCode); JT_EquipmentAsset equipmentAsset = App.Database.GetEquipmentAsset(_workTicket.DtlRepairItemCode); //get any possible work tickets and associated work tickets List <JT_WorkTicket> workTickets = App.Database.GetWorkTickets(_workTicket.DtlRepairItemCode, _workTicket.DtlMfgSerialNo); //, _workTicket.SalesOrderNo); foreach (var workTicket in workTickets) { List <JT_Transaction> transactionCode = App.Database.GetTransactions(workTicket.SalesOrderNo, workTicket.WTNumber, workTicket.WTStep); List <JT_TransactionHistory> transactionHistoryCode = App.Database.GetTransactionHistory(workTicket.SalesOrderNo, workTicket.WTNumber, workTicket.WTStep); foreach (var transaction in transactionCode) { if (transaction.RecordType != "LD" && transaction.ItemCode != null && transaction.ItemCode == partNbr) { if (transaction.QuantityUsed != 0) { // Do not add duplicate lot numbers LotQavl exists = lsLotQ.Where(p => p.LotNo == transaction.LotSerialNo).FirstOrDefault(); // dch rkl 01/20/2017 include unit cost //if (exists == null) { lsLotQ.Add(new LotQavl(transaction.LotSerialNo, 0, 0)); } decimal UnitCost = 0; if (transaction.UnitCost != null) { decimal.TryParse(transaction.UnitCost, out UnitCost); } if (exists == null) { lsLotQ.Add(new LotQavl(transaction.LotSerialNo, 0, 0, UnitCost)); } } } } foreach (var transaction in transactionHistoryCode) { if (transaction.RecordType != "LD" && transaction.ItemCode != null && transaction.ItemCode == partNbr) { if (transaction.QuantityUsed != 0) { // Do not add duplicate lot numbers LotQavl exists = lsLotQ.Where(p => p.LotNo == transaction.LotSerialNo).FirstOrDefault(); // dch rkl 01/20/2017 include unit cost //if (exists == null) { lsLotQ.Add(new LotQavl(transaction.LotSerialNo, 0, 0)); } decimal UnitCost = 0; if (transaction.UnitCost != null) { decimal.TryParse(transaction.UnitCost, out UnitCost); } if (exists == null) { lsLotQ.Add(new LotQavl(transaction.LotSerialNo, 0, 0, UnitCost)); } } } } } return(lsLotQ); }
public App_WorkTicket GetWorkTicket(App_ScheduledAppointment scheduledAppointment) { JT_WorkTicket workTicket = null; JT_WorkTicket workTicketStepZero = null; JT_WorkTicketClass workTicketClass = null; CI_Item repairItem = null; JT_EquipmentAsset equipmentAsset = null; App_ServiceAgreement serviceAgreement = null; JT_ClassificationCode problemCode = null; JT_ClassificationCode exceptionCode = null; lock (_locker) { if (scheduledAppointment != null) { workTicket = _database.Table <JT_WorkTicket>().Where( wt => (wt.SalesOrderNo == scheduledAppointment.SalesOrderNumber) && (wt.WTNumber == scheduledAppointment.WorkTicketNumber) && (wt.WTStep == scheduledAppointment.WorkTicketStep) ).FirstOrDefault(); // dch rkl 11/30/2016 If JT_WorkTicket.HdrWTClass is null, populate it from SO_SalesOrderHeader.JT158_WTClass if (workTicket.HdrWtClass == null) { SO_SalesOrderHeader soHeader = _database.Table <SO_SalesOrderHeader>().Where( soh => (soh.SalesOrderNo == workTicket.SalesOrderNo)).FirstOrDefault(); if (soHeader != null) { workTicket.HdrWtClass = soHeader.JT158_WTClass; } } workTicketStepZero = _database.Table <JT_WorkTicket>().Where( wt => (wt.SalesOrderNo == scheduledAppointment.SalesOrderNumber) && (wt.WTNumber == scheduledAppointment.WorkTicketNumber) && (wt.WTStep == "000") ).FirstOrDefault(); workTicketClass = _database.Table <JT_WorkTicketClass>().Where( wtc => (workTicket.HdrWtClass == wtc.WorkTicketClass) ).FirstOrDefault(); repairItem = GetItemFromDB(workTicket.DtlRepairItemCode); if (workTicket.DtlMfgSerialNo != null) { equipmentAsset = _database.Table <JT_EquipmentAsset> ().Where( ea => (ea.ItemCode == repairItem.ItemCode) && (ea.MfgSerialNo == workTicket.DtlMfgSerialNo) ).FirstOrDefault(); } else { equipmentAsset = new JT_EquipmentAsset(); } serviceAgreement = GetServiceAgreement(workTicketStepZero); //serviceAgreement = GetServiceAgreement(workTicket); problemCode = _database.Table <JT_ClassificationCode>().Where( pc => (pc.ClassificationCode == workTicket.DtlProblemCode) ).FirstOrDefault(); exceptionCode = _database.Table <JT_ClassificationCode>().Where( pc => (pc.ClassificationCode == workTicket.DtlCoverageExceptionCode) ).FirstOrDefault(); } } return(new App_WorkTicket(workTicket, workTicketStepZero, workTicketClass, new App_RepairItem(repairItem, equipmentAsset), serviceAgreement, problemCode, exceptionCode)); }
// dch rkl 11/22/2016 Add filter by parts or labor //public HistoryPageViewModel (string formattedTicketNumber) public HistoryPageViewModel(string formattedTicketNumber, string partsLaborAll) { // dch rkl 12/07/2016 catch exception try { _TicketNumber = formattedTicketNumber; _workTicket = App.Database.GetWorkTicket2(formattedTicketNumber); _history = new List <App_History>(); CI_Item item = App.Database.GetItemFromDB(_workTicket.DtlRepairItemCode); _item = item; JT_EquipmentAsset equipmentAsset = App.Database.GetEquipmentAsset(_workTicket.DtlRepairItemCode); //get any possible work tickets and associated work tickets List <JT_WorkTicket> workTickets = App.Database.GetWorkTickets(_workTicket.DtlRepairItemCode, _workTicket.DtlMfgSerialNo); //, _workTicket.SalesOrderNo); foreach (var workTicket in workTickets) { List <JT_Transaction> transactionCode = App.Database.GetTransactions(workTicket.SalesOrderNo, workTicket.WTNumber, workTicket.WTStep); List <JT_TransactionHistory> transactionHistoryCode = App.Database.GetTransactionHistory(workTicket.SalesOrderNo, workTicket.WTNumber, workTicket.WTStep); //List<JT_Transaction> transactionCode = App.Database.GetTransactions(workTicket.SalesOrderNo); JT_ServiceAgreementHeader serviceAgreementHeader; JT_ServiceAgreementDetail serviceAgreementDetail; if (equipmentAsset != null && equipmentAsset.ContractCode != null) { serviceAgreementHeader = App.Database.GetServiceAgreementHeader(equipmentAsset.ContractCode); serviceAgreementDetail = App.Database.GetServiceAgreementDetail(equipmentAsset.ContractCode); } else { serviceAgreementHeader = new JT_ServiceAgreementHeader(); serviceAgreementDetail = new JT_ServiceAgreementDetail(); } foreach (var transaction in transactionCode) { JT_LaborText laborText = App.Database.GetLaborText(transaction); var history = new App_History( _workTicket, item, equipmentAsset, serviceAgreementHeader, serviceAgreementDetail, transaction, laborText); // dch rkl 11/22/2016 Add filter by parts or labor BEGIN if ((partsLaborAll == "L" && transaction.RecordType == "LD") || (partsLaborAll == "P" && transaction.RecordType != "LD") || partsLaborAll == "A" || partsLaborAll == "") { // dch rkl 01/16/2017 only if qty used <> 0 if (transaction.QuantityUsed != 0) { _history.Add(history); } //_history.Add(history); } //_history.Add(history); // dch rkl 11/22/2016 Add filter by parts or labor END } foreach (var transaction in transactionHistoryCode) { JT_LaborText laborText = App.Database.GetLaborText(transaction); var history = new App_History( _workTicket, item, equipmentAsset, serviceAgreementHeader, serviceAgreementDetail, transaction, laborText); // dch rkl 11/22/2016 Add filter by parts or labor BEGIN if ((partsLaborAll == "L" && transaction.RecordType == "LD") || (partsLaborAll == "P" && transaction.RecordType != "LD") || partsLaborAll == "A" || partsLaborAll == "") { // dch rkl 01/16/2017 only if qty used <> 0 if (transaction.QuantityUsed != 0) { _history.Add(history); } //_history.Add(history); } //_history.Add(history); // dch rkl 11/22/2016 Add filter by parts or labor BEGIN } } } catch (Exception ex) { // dch rkl 12/07/2016 Log Error ErrorReporting errorReporting = new ErrorReporting(); errorReporting.sendException(ex, "TechDashboard.HistoryPageViewModel()"); } _history = _history.OrderBy(x => x.TransactionDate).ToList(); }