Example #1
0
        public IHttpActionResult PrintPickingList(int id)
        {
            Library.DTO.Notification notification;

            // authentication
            Module.Framework.BLL fwBll = new Module.Framework.BLL();
            if (!fwBll.CanPerformAction(ControllerContext.GetAuthUserId(), getModuleCode(), Library.DTO.ModuleAction.CanPrint))
            {
                return(InternalServerError(new Exception(Properties.Resources.NOT_AUTHORIZED)));
            }

            //GET DATA
            BLL.WarehousePickingListMng bll = new BLL.WarehousePickingListMng();
            DTO.WarehousePickingListMng.CMRContainer dtoPrintout = bll.GetCMRPrintout(id, ControllerContext.GetAuthUserId(), out notification);

            //CREATE PRINTOUT
            Microsoft.Reporting.WebForms.LocalReport lr = new Microsoft.Reporting.WebForms.LocalReport();
            lr.ReportPath = FrameworkSetting.Setting.AbsoluteReportFolder + "CMR.rdlc";

            Microsoft.Reporting.WebForms.ReportDataSource rsInvoice = new Microsoft.Reporting.WebForms.ReportDataSource();
            rsInvoice.Name  = "CMR";
            rsInvoice.Value = dtoPrintout.CMRs;
            lr.DataSources.Add(rsInvoice);

            Microsoft.Reporting.WebForms.ReportDataSource rsInvoiceDetail = new Microsoft.Reporting.WebForms.ReportDataSource();
            rsInvoiceDetail.Name  = "CMRDetail";
            rsInvoiceDetail.Value = dtoPrintout.CMRDetails;
            lr.DataSources.Add(rsInvoiceDetail);

            string printoutFileName = PrintoutHelper.BuildPrintoutFileCMR(lr, "PDF");


            return(Ok(new Library.DTO.ReturnData <string>()
            {
                Data = printoutFileName, Message = notification
            }));
        }
Example #2
0
        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);
        }