public DTO.WarehousePickingListMng.CMRContainer DB2DTO_CMR(WarehousePickingListMng_PickingList_ReportView dbItem) { DTO.WarehousePickingListMng.CMRContainer dtoItem = new DTO.WarehousePickingListMng.CMRContainer(); dtoItem.CMRs = new List <DTO.WarehousePickingListMng.CMR>(); dtoItem.CMRDetails = new List <DTO.WarehousePickingListMng.CMRDetail>(); //READ PICKING LIST DETAIL DTO.WarehousePickingListMng.CMRDetail dtoCMRDetail; int i = 1; int?TotalQnt = 0; foreach (var item in dbItem.WarehousePickingListMng_PickingListProductDetail_ReportView) { dtoCMRDetail = new DTO.WarehousePickingListMng.CMRDetail(); dtoCMRDetail.RowIndex = i; if (item.Description.Length > 90) { dtoCMRDetail.Description = item.Description.Substring(0, 85) + ".........."; } else { dtoCMRDetail.Description = item.Description; } dtoCMRDetail.Quantity = item.Quantity; dtoItem.CMRDetails.Add(dtoCMRDetail); i++; TotalQnt += item.Quantity; } int maxRow = 17; //(that mean 16 product) if (i < maxRow) { for (int j = 1; j <= maxRow - i; j++) { dtoCMRDetail = new DTO.WarehousePickingListMng.CMRDetail(); dtoCMRDetail.Description = ""; //dtoCMRDetail.RowIndex = j; dtoItem.CMRDetails.Add(dtoCMRDetail); } } //READ PICKIGLIST DTO.WarehousePickingListMng.CMR dtoCMR = new DTO.WarehousePickingListMng.CMR(); dtoCMR.CMR1 = dbItem.CMR1; dtoCMR.CMR2 = dbItem.CMR2; dtoCMR.CMR3 = dbItem.CMR3; dtoCMR.CMR4 = dbItem.CMR4; dtoCMR.CMR5 = dbItem.CMR5; dtoCMR.CMR13 = dbItem.CMR13; dtoCMR.CMR14 = dbItem.CMR14; dtoCMR.CMR15 = dbItem.CMR15; dtoCMR.CMR16 = dbItem.CMR16; dtoCMR.CMR17 = dbItem.CMR17; dtoCMR.CMR18 = dbItem.CMR18; dtoCMR.CMR19 = dbItem.CMR19; dtoCMR.CMR20 = dbItem.CMR20; dtoCMR.CMR21 = dbItem.CMR21; dtoCMR.CMR22 = dbItem.CMR22; dtoCMR.CMR23 = dbItem.CMR23; dtoCMR.CMR24 = dbItem.CMR24; dtoCMR.TotalQnt = TotalQnt; dtoCMR.CMRDate = dbItem.CMRDate; dtoItem.CMRs.Add(dtoCMR); //RETURN DATA return(dtoItem); }
public DTO.WarehousePickingListMng.PickingListContainerPrintout DB2DTO_PickingListPrintout(WarehousePickingListMng_PickingList_ReportView dbItem) { DTO.WarehousePickingListMng.PickingListContainerPrintout dtoItem = new DTO.WarehousePickingListMng.PickingListContainerPrintout(); dtoItem.PickingListPrintouts = new List <DTO.WarehousePickingListMng.PickingListPrintout>(); dtoItem.PickingListDetailPrintouts = new List <DTO.WarehousePickingListMng.PickingListDetailPrintout>(); //READ PICKIGLIST DTO.WarehousePickingListMng.PickingListPrintout dtoPickingList = new DTO.WarehousePickingListMng.PickingListPrintout(); dtoPickingList.ClientNM = dbItem.ClientNM + " " + dbItem.ClientUD; dtoPickingList.Address = dbItem.Address; dtoPickingList.OrderNo = dbItem.OrderNo; dtoPickingList.RealPickingDate = dbItem.RealPickingDate; dtoPickingList.Remark = dbItem.Remark; dtoPickingList.RefNo = dbItem.RefNo; dtoPickingList.DeliveryDate = dbItem.DeliveryDate; dtoPickingList.TotalPickedQnt = dbItem.WarehousePickingListMng_PickingListAreaDetail_ReportView.Sum(o => o.PickedQnt); dtoPickingList.ReceiptNo = dbItem.ReceiptNo; dtoItem.PickingListPrintouts.Add(dtoPickingList); //READ PICKING LIST DETAIL DTO.WarehousePickingListMng.PickingListDetailPrintout dtoPickingDetail; foreach (var item in dbItem.WarehousePickingListMng_PickingListAreaDetail_ReportView) { dtoPickingDetail = new DTO.WarehousePickingListMng.PickingListDetailPrintout(); dtoPickingDetail.ArticleCode = item.ArticleCode; dtoPickingDetail.Description = item.Description; dtoPickingDetail.WarehouseAreaUD = item.WarehouseAreaUD; dtoPickingDetail.Quantity = item.Quantity; dtoPickingDetail.PickedQnt = item.PickedQnt; dtoPickingDetail.Unit = item.Unit; dtoPickingDetail.IsChecked = (item.IsChecked.HasValue && (bool)item.IsChecked ? "YES" : "NO"); dtoItem.PickingListDetailPrintouts.Add(dtoPickingDetail); if (!string.IsNullOrEmpty(item.Remark)) { dtoPickingDetail = new DTO.WarehousePickingListMng.PickingListDetailPrintout(); dtoPickingDetail.Description = item.Remark; dtoItem.PickingListDetailPrintouts.Add(dtoPickingDetail); } } //RETURN DATA return(dtoItem); }