private void PrintDetailRow(TransferItemVO vo, PdfPTable table, int row)
        {
            PdfPCell cell;
            decimal  totalCost = 0.0m;

            if (Convert.ToInt32(vo.ICNQty) > 0 && vo.ItemCost > 0.0m)
            {
                totalCost = Convert.ToInt32(vo.ICNQty) * vo.ItemCost;
            }
            cell = new PdfPCell(new Paragraph(row.ToString(), _reportFont));
            //cell.Border = Rectangle.NO_BORDER;
            cell.HorizontalAlignment = Element.ALIGN_LEFT;
            cell.VerticalAlignment   = Element.ALIGN_TOP;
            table.AddCell(cell);
            Icn    icn          = new Icn(vo.ICN);
            string icnShortCode = icn.GetShortCode();

            if (_catcoTransferType == "Scrap")
            {
                cell = new PdfPCell(new Paragraph(icnShortCode, ReportFontBold));
                //cell.Border = Rectangle.NO_BORDER;
                cell.HorizontalAlignment = Element.ALIGN_LEFT;
                cell.Colspan             = 1;
                cell.VerticalAlignment   = Element.ALIGN_TOP;
                table.AddCell(cell);

                cell = new PdfPCell(new Paragraph(vo.ItemDescription, _reportFont));
                //cell.Border = Rectangle.NO_BORDER;
                cell.HorizontalAlignment = Element.ALIGN_LEFT;
                cell.Colspan             = 3;
                cell.VerticalAlignment   = Element.ALIGN_TOP;
                table.AddCell(cell);
            }
            else if (_catcoTransferType == "Refurb")
            {
                cell = new PdfPCell(new Paragraph(vo.RefurbNumber.ToString(), _reportFont));
                cell.HorizontalAlignment = Element.ALIGN_LEFT;
                cell.VerticalAlignment   = Element.ALIGN_TOP;
                table.AddCell(cell);

                cell = new PdfPCell(new Paragraph(icnShortCode, ReportFontBold));
                //cell.Border = Rectangle.NO_BORDER;
                cell.HorizontalAlignment = Element.ALIGN_LEFT;
                cell.Colspan             = 1;
                cell.VerticalAlignment   = Element.ALIGN_TOP;
                table.AddCell(cell);

                cell = new PdfPCell(new Paragraph(vo.ItemDescription, _reportFont));
                //cell.Border = Rectangle.NO_BORDER;
                cell.HorizontalAlignment = Element.ALIGN_LEFT;
                cell.Colspan             = 3;
                cell.VerticalAlignment   = Element.ALIGN_TOP;
                table.AddCell(cell);
            }
            else
            {
                cell = new PdfPCell(new Paragraph(icnShortCode, ReportFontBold));
                //cell.Border = Rectangle.NO_BORDER;
                cell.HorizontalAlignment = Element.ALIGN_LEFT;
                cell.Colspan             = 1;
                cell.VerticalAlignment   = Element.ALIGN_TOP;
                table.AddCell(cell);


                cell = new PdfPCell(new Paragraph(vo.ItemDescription, _reportFont));
                //cell.Border = Rectangle.NO_BORDER;
                cell.HorizontalAlignment = Element.ALIGN_LEFT;
                cell.Colspan             = 3;
                cell.VerticalAlignment   = Element.ALIGN_TOP;
                table.AddCell(cell);
            }

            //cell.Border = Rectangle.NO_BORDER;
            if (_catcoTransferType != "Refurb")
            {
                cell = new PdfPCell(new Paragraph(vo.ICNQty, _reportFont));
                //cell.Border = Rectangle.NO_BORDER;
                cell.HorizontalAlignment = Element.ALIGN_LEFT;
                cell.VerticalAlignment   = Element.ALIGN_TOP;
                table.AddCell(cell);
            }

            cell = new PdfPCell(new Paragraph(String.Format("{0:C}", vo.ItemCost), _reportFont));
            //cell.Border = Rectangle.NO_BORDER;
            cell.HorizontalAlignment = Element.ALIGN_LEFT;
            cell.VerticalAlignment   = Element.ALIGN_TOP;
            table.AddCell(cell);

            cell = new PdfPCell(new Paragraph(String.Format("{0:C}", totalCost), _reportFont));
            //cell.Border = Rectangle.NO_BORDER;
            cell.HorizontalAlignment = Element.ALIGN_LEFT;
            cell.VerticalAlignment   = Element.ALIGN_TOP;
            table.AddCell(cell);
        }
Exemplo n.º 2
0
        public static bool GetTransferInItems(DesktopSession cds, TransferVO transfer, out string errorCode, out string errorText)
        {
            if (transfer == null)
            {
                throw new ArgumentNullException("transfer");
            }

            //Initialize output vars
            errorCode = string.Empty;
            errorText = string.Empty;

            OracleDataAccessor dA = GlobalDataAccessor.Instance.OracleDA;

            //Create parameter list

            List <OracleProcParam> oParams = new List <OracleProcParam>();

            oParams.Add(new OracleProcParam("p_ticket_number", transfer.TransferTicketNumber));
            oParams.Add(new OracleProcParam("p_store_number", cds.CurrentSiteId.StoreNumber));
            oParams.Add(new OracleProcParam("p_user_id", cds.FullUserName));
            oParams.Add(new OracleProcParam("p_transfer_type", (transfer.TransferSource == TransferSource.TOPSTICKET && transfer.TempStatus == TransferTempStatus.REJCT) ? TransferSource.CLXTICKET.ToString() : transfer.TransferSource.ToString()));
            oParams.Add(new OracleProcParam("p_origination_store_number", transfer.OriginalStoreNumber));

            //Setup ref cursor array
            List <PairType <string, string> > refCursors = new List <PairType <string, string> >();

            //Add general ref cursors
            refCursors.Add(new PairType <string, string>("o_ti_mdse", "ti_mdse_ref_cursor"));

            //Make stored proc call
            bool    retVal;
            DataSet outputDataSet;

            try
            {
                retVal = GlobalDataAccessor.Instance.OracleDA.issueSqlStoredProcCommand("ccsowner",
                                                                                        "transfers", "retrieve_TI_ticket_mdse", oParams, refCursors, "o_return_code",
                                                                                        "o_return_text", out outputDataSet);
                errorCode = dA.ErrorCode;
                errorText = dA.ErrorDescription;
            }
            catch (OracleException oEx)
            {
                BasicExceptionHandler.Instance.AddException("ExecuteGetTransferInTickets Failed", oEx);
                errorCode = "ExecuteGetTransferInTicketsFailed";
                errorText = "OracleException thrown: " + oEx.Message;
                return(false);
            }

            if (retVal == false)
            {
                BasicExceptionHandler.Instance.AddException("ExecuteGetTransferInTickets Failed: return value is false", new ApplicationException());
                errorCode = dA.ErrorCode + " --- ExecuteGetTransferInTickets";
                errorText = dA.ErrorDescription + " -- Return value is false";
                return(false);
            }

            if (outputDataSet != null && outputDataSet.Tables.Count == 1)
            {
                foreach (DataRow dr in outputDataSet.Tables[0].Rows)
                {
                    TransferItemVO item = new TransferItemVO();
                    item.ICN            = Utilities.GetStringValue(dr["icn"]);
                    item.TransferType   = Utilities.ParseEnum <TransferTypes>(Utilities.GetStringValue(dr["trantype"], string.Empty), TransferTypes.STORETOSTORE);
                    item.MdseRecordDesc = Utilities.GetStringValue(dr["md_desc"]);
                    item.PfiAmount      = Utilities.GetDecimalValue(dr["pfi_amount"], 0);
                    item.RefurbNumber   = Utilities.GetIntegerValue(dr["rfb_no"], 0);
                    item.ICNQty         = Utilities.GetStringValue(dr["quantity"]);
                    item.Transfer       = transfer;
                    transfer.Items.Add(item);
                }
            }
            return(true);
        }
Exemplo n.º 3
0
        public static bool ExecuteVendorPFI
        (
            int ticketNumber,
            PurchaseVO vendorPurchaseObj,
            VendorVO vendor,
            out string sErrorCode,
            out string sErrorText
        )
        {
            List <TransferItemVO> _mdseToTransfer = new List <TransferItemVO>();
            int pawnItemIdx = 1;

            sErrorCode = "0";
            sErrorText = "";
            bool itemsPfid = false;

            try
            {
                //Start transaction block
                GlobalDataAccessor.Instance.beginTransactionBlock();


                //Step 1 Update Gun book if the item has a gun
                foreach (Item purchaseItem in vendorPurchaseObj.Items)
                {
                    if (purchaseItem.IsExpenseItem)
                    {
                        pawnItemIdx = pawnItemIdx + purchaseItem.Quantity;
                        continue;
                    }
                    for (int i = 1; i <= purchaseItem.Quantity; i++)
                    {
                        if (!purchaseItem.IsJewelry && purchaseItem.Quantity > 1 && purchaseItem.SerialNumber != null && purchaseItem.SerialNumber.Count > 0)
                        {
                            Item   itemCopy = Utilities.CloneObject(purchaseItem);
                            string sItemPrefix;
                            string sDescription;
                            //Get updated mdse description for each serial number
                            Item.RemoveSerialNumberFromDescription(ref itemCopy, out sItemPrefix, out sDescription);
                            purchaseItem.Attributes        = itemCopy.Attributes;
                            purchaseItem.TicketDescription = sDescription;
                        }
                        purchaseItem.mDocNumber = ticketNumber;
                        purchaseItem.mItemOrder = i;
                        int qty = purchaseItem.QuickInformation.Quantity < 1 ? 1 : purchaseItem.QuickInformation.Quantity;
                        if (purchaseItem.CaccLevel == 0)
                        {
                            // Call Update_Cacc_Info()
                            MerchandiseProcedures.UpdateCaccInfo(GlobalDataAccessor.Instance.DesktopSession,
                                                                 GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber,
                                                                 0,
                                                                 purchaseItem.mDocNumber,
                                                                 "7",
                                                                 1,
                                                                 0,
                                                                 qty,
                                                                 purchaseItem.ItemAmount * qty,
                                                                 purchaseItem.CategoryCode,
                                                                 ShopDateTime.Instance.ShopDate,
                                                                 out sErrorCode,
                                                                 out sErrorText
                                                                 );
                        }

                        if (purchaseItem.IsGun)
                        {
                            ProcessTenderProcedures.ExecuteUpdateGunBookRecord(
                                ticketNumber.ToString(),
                                GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber,
                                ProductStatus.PFI.ToString(),
                                "",
                                vendor.Name,
                                "",
                                "",
                                vendor.Address1,
                                vendor.City,
                                vendor.State,
                                vendor.ZipCode,
                                vendor.Ffl,
                                "",
                                "",
                                "P",
                                GlobalDataAccessor.Instance.DesktopSession.UserName,
                                ShopDateTime.Instance.ShopDate.ToShortDateString(),
                                ShopDateTime.Instance.ShopTransactionTime,
                                "",
                                purchaseItem.QuickInformation.Caliber,
                                purchaseItem.QuickInformation.Importer,
                                purchaseItem.QuickInformation.SerialNumber,
                                purchaseItem.QuickInformation.Model,
                                purchaseItem.QuickInformation.Manufacturer,
                                purchaseItem.mStore,
                                purchaseItem.mYear,
                                purchaseItem.mDocNumber,
                                purchaseItem.mDocType,
                                pawnItemIdx,
                                0,
                                vendorPurchaseObj.GunNumbers[i - 1],
                                out sErrorCode,
                                out sErrorText
                                );
                        }

                        //Step 2 Insert mdse revision record


                        bool mdseRevVal = MerchandiseProcedures.InsertMerchandiseRevision(GlobalDataAccessor.Instance.DesktopSession,
                                                                                          GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber,
                                                                                          purchaseItem.mYear,
                                                                                          ticketNumber,
                                                                                          purchaseItem.mDocType,
                                                                                          pawnItemIdx,
                                                                                          0,
                                                                                          purchaseItem.mStore,
                                                                                          ticketNumber.ToString(),
                                                                                          purchaseItem.mDocType,
                                                                                          "",
                                                                                          0,
                                                                                          purchaseItem.ItemReason == ItemReason.CACC ? "PFC" : "PFI",
                                                                                          "",
                                                                                          "",
                                                                                          GlobalDataAccessor.Instance.DesktopSession.FullUserName,
                                                                                          out sErrorCode,
                                                                                          out sErrorText
                                                                                          );

                        purchaseItem.Icn = Utilities.IcnGenerator(purchaseItem.mStore,
                                                                  purchaseItem.mYear, ticketNumber, "2", pawnItemIdx, 0);


                        TransferItemVO transferData = new TransferItemVO();
                        transferData.ICN         = purchaseItem.Icn.ToString();
                        transferData.StoreNumber = GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber;
                        transferData.ICNQty      = purchaseItem.QuickInformation.Quantity > 0
                                                         ? purchaseItem.QuickInformation.Quantity.ToString()
                                                         : "1";
                        transferData.CustomerNumber   = "";
                        transferData.TransactionDate  = ShopDateTime.Instance.ShopDate;
                        transferData.MdseRecordDate   = ShopDateTime.Instance.ShopDate;
                        transferData.MdseRecordTime   = ShopDateTime.Instance.ShopTransactionTime;
                        transferData.MdseRecordUser   = GlobalDataAccessor.Instance.DesktopSession.UserName;
                        transferData.MdseRecordDesc   = "";
                        transferData.MdseRecordChange = 0;
                        transferData.MdseRecordType   = "";
                        transferData.ClassCode        = "";
                        transferData.AcctNumber       = "";
                        transferData.CreatedBy        = GlobalDataAccessor.Instance.DesktopSession.UserName;
                        transferData.GunNumber        = vendorPurchaseObj.GunNumbers[i - 1] > 0 ? vendorPurchaseObj.GunNumbers[i - 1].ToString() : null;
                        transferData.GunType          = purchaseItem.QuickInformation.GunType;
                        transferData.ItemDescription  = purchaseItem.TicketDescription;
                        transferData.ItemCost         = purchaseItem.ItemAmount;
                        _mdseToTransfer.Add(transferData);
                        itemsPfid = true;
                        pawnItemIdx++;
                    }
                }

                //Step 3 Insert receipt for PFI
                if (itemsPfid)
                {
                    ReceiptDetailsVO receiptDetailsVO = new ReceiptDetailsVO();
                    receiptDetailsVO.ReceiptDate = ShopDateTime.Instance.ShopDate;
                    receiptDetailsVO.RefDates    = new List <string>()
                    {
                        ShopDateTime.Instance.ShopDate.ToShortDateString()
                    };
                    receiptDetailsVO.RefTimes = new List <string>()
                    {
                        ShopDateTime.Instance.ShopDate.ToShortDateString() + " " + ShopDateTime.Instance.ShopTime.ToString()
                    };
                    receiptDetailsVO.UserId     = GlobalDataAccessor.Instance.DesktopSession.UserName;
                    receiptDetailsVO.RefNumbers = new List <string>()
                    {
                        ticketNumber.ToString()
                    };
                    receiptDetailsVO.RefTypes = new List <string>()
                    {
                        "2"
                    };
                    receiptDetailsVO.RefEvents = new List <string>()
                    {
                        "PFI"
                    };
                    receiptDetailsVO.RefAmounts = new List <string>()
                    {
                        vendorPurchaseObj.Amount.ToString()
                    };
                    receiptDetailsVO.RefStores = new List <string>()
                    {
                        GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber
                    };

                    ProcessTenderProcedures.ExecuteInsertReceiptDetails(
                        GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber,
                        GlobalDataAccessor.Instance.DesktopSession.UserName,
                        ShopDateTime.Instance.ShopDate.ToShortDateString(),
                        GlobalDataAccessor.Instance.DesktopSession.UserName,
                        ref receiptDetailsVO,
                        out sErrorCode,
                        out sErrorText);
                }

                GlobalDataAccessor.Instance.endTransactionBlock(EndTransactionType.COMMIT);
            }
            catch (Exception ex)
            {
                GlobalDataAccessor.Instance.endTransactionBlock(EndTransactionType.ROLLBACK);
                FileLogger.Instance.logMessage(LogLevel.ERROR, null, "Error in vendor purchase pfi process while processing PFI " + ex.Message);
                sErrorCode = "1";
                sErrorText = ex.Message;
                return(false);
            }



            //Step 4 Invoke transfer process
            int transferNumber = 0;

            var errorMessage = string.Empty;

            if (_mdseToTransfer.Count > 0 && GlobalDataAccessor.Instance.CurrentSiteId.IsTopsExist)
            {
                bool retValue = TransferProcedures.TransferItemsOutOfStore(_mdseToTransfer, out transferNumber, "", out errorMessage, false, GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber);
                if (!retValue)
                {
                    MessageBox.Show("Error:" + errorMessage);
                    sErrorText = errorMessage;
                    return(false);
                }
                foreach (TransferItemVO transfer in _mdseToTransfer)
                {
                    transfer.TransferNumber = transferNumber;
                }
            }

            if (transferNumber > 0)
            {
                try
                {
                    GlobalDataAccessor.Instance.beginTransactionBlock();
                    //Step 5 Insert receipt for transfer
                    ReceiptDetailsVO receiptDetailsVO = new ReceiptDetailsVO();
                    receiptDetailsVO.ReceiptDate = ShopDateTime.Instance.ShopDate;
                    receiptDetailsVO.RefDates    = new List <string>()
                    {
                        ShopDateTime.Instance.ShopDate.ToShortDateString()
                    };
                    receiptDetailsVO.RefTimes = new List <string>()
                    {
                        ShopDateTime.Instance.ShopDate.ToShortDateString() + " " + ShopDateTime.Instance.ShopTime.ToString()
                    };
                    receiptDetailsVO.UserId     = GlobalDataAccessor.Instance.DesktopSession.UserName;
                    receiptDetailsVO.RefNumbers = new List <string>()
                    {
                        ticketNumber.ToString()
                    };
                    receiptDetailsVO.RefTypes = new List <string>()
                    {
                        "2"
                    };
                    receiptDetailsVO.RefEvents = new List <string>()
                    {
                        "TO"
                    };
                    receiptDetailsVO.RefAmounts = new List <string>()
                    {
                        vendorPurchaseObj.Amount.ToString()
                    };
                    receiptDetailsVO.RefStores = new List <string>()
                    {
                        GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber
                    };

                    ProcessTenderProcedures.ExecuteInsertReceiptDetails(
                        GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber,
                        GlobalDataAccessor.Instance.DesktopSession.UserName,
                        ShopDateTime.Instance.ShopDate.ToShortDateString(),
                        GlobalDataAccessor.Instance.DesktopSession.UserName,
                        ref receiptDetailsVO,
                        out sErrorCode,
                        out sErrorText);
                    GlobalDataAccessor.Instance.DesktopSession.endTransactionBlock(EndTransactionType.COMMIT);
                    //Step 6 Print transfer report

                    /*TransferOutReport trnsfrRpt = new TransferOutReport();
                     * trnsfrRpt.MdseTransfer = _mdseToTransfer;
                     */
                    string logPath =
                        SecurityAccessor.Instance.EncryptConfig.ClientConfig.GlobalConfiguration
                        .BaseLogPath;

                    TransferOutReport trnsfrRpt = new TransferOutReport(_mdseToTransfer, ShopDateTime.Instance.ShopDateCurTime, GlobalDataAccessor.Instance.CurrentSiteId.StoreName,
                                                                        Convert.ToString(GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber), GlobalDataAccessor.Instance.DesktopSession.UserName, Convert.ToString(transferNumber), logPath, "PFIProc", new ReportObject.TransferReport(), PdfLauncher.Instance);
                    trnsfrRpt.CreateReport();
                    //TODO: Store report in couch db
                    if (SecurityAccessor.Instance.EncryptConfig.ClientConfig.ClientConfiguration.PrintEnabled &&
                        GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.IsValid)
                    {
                        string laserPrinterIp   = GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.IPAddress;
                        int    laserPrinterPort = GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.Port;
                        PrintingUtilities.printDocument(trnsfrRpt.getReportWithPath(),
                                                        laserPrinterIp,
                                                        laserPrinterPort,
                                                        1);
                    }

                    //trnsfrRpt.ShowDialog();
                    return(true);
                }
                catch (Exception ex)
                {
                    GlobalDataAccessor.Instance.DesktopSession.endTransactionBlock(EndTransactionType.ROLLBACK);
                    FileLogger.Instance.logMessage(LogLevel.ERROR, null, "Error in vendor purchase pfi process while entering receipt for transfer and printing transfer report " + ex.Message);
                    sErrorCode = "1";
                    sErrorText = ex.Message;
                    return(false);
                }
            }
            return(true);
        }
        private void PrintDetailRow(TransferItemVO vo, PdfPTable table, int row)
        {
            decimal totalCost   = vo.PfiAmount;
            decimal totalRetail = vo.RetailPrice;

            if (Convert.ToInt32(vo.ICNQty) > 0 && vo.PfiAmount > 0.0m)
            {
                totalCost = Convert.ToInt32(vo.ICNQty) * vo.PfiAmount;
            }
            if (Convert.ToInt32(vo.ICNQty) > 0 && vo.RetailPrice > 0.0m)
            {
                totalRetail = Convert.ToInt32(vo.ICNQty) * vo.RetailPrice;
            }

            PdfPCell cell;

            cell = new PdfPCell(new Paragraph(row.ToString(), _reportFont));
            //cell.Border = Rectangle.NO_BORDER;
            cell.HorizontalAlignment = Element.ALIGN_LEFT;
            cell.VerticalAlignment   = Element.ALIGN_TOP;
            table.AddCell(cell);

            Phrase icnPhrase = new Phrase(GetFormattedICNPhrase(vo.ICN));

            //cell = GetFormattedICNCellSmallFont(vo.ICN);
            cell = new PdfPCell(icnPhrase);
            //cell.Border = Rectangle.NO_BORDER;
            //cell.AddElement(icnPhrase);
            cell.HorizontalAlignment = Element.ALIGN_LEFT;
            cell.VerticalAlignment   = Element.ALIGN_TOP;
            table.AddCell(cell);

            cell = new PdfPCell(new Paragraph(vo.MdseRecordDesc, _reportFont));
            //cell.Border = Rectangle.NO_BORDER;
            cell.HorizontalAlignment = Element.ALIGN_LEFT;
            cell.Colspan             = 2;
            cell.VerticalAlignment   = Element.ALIGN_TOP;
            table.AddCell(cell);

            cell = new PdfPCell(new Paragraph(vo.ICNQty, _reportFont));
            //cell.Border = Rectangle.NO_BORDER;
            cell.HorizontalAlignment = Element.ALIGN_LEFT;
            cell.VerticalAlignment   = Element.ALIGN_TOP;
            table.AddCell(cell);

            totalAmt += vo.PfiAmount;

            cell = new PdfPCell(new Paragraph(String.Format("{0:C}", vo.PfiAmount), _reportFont));
            //cell.Border = Rectangle.NO_BORDER;
            cell.HorizontalAlignment = Element.ALIGN_LEFT;
            cell.VerticalAlignment   = Element.ALIGN_TOP;
            table.AddCell(cell);

            cell = new PdfPCell(new Paragraph(String.Format("{0:C}", totalCost), _reportFont));
            //cell.Border = Rectangle.NO_BORDER;
            cell.HorizontalAlignment = Element.ALIGN_LEFT;
            cell.VerticalAlignment   = Element.ALIGN_TOP;
            table.AddCell(cell);

            //cell = new PdfPCell(new Paragraph(String.Format("{0:C}", vo.RetailPrice), _reportFont));
            cell = new PdfPCell(new Paragraph(String.Format("{0:C}", vo.RetailPrice), _reportFont));
            //cell.Border = Rectangle.NO_BORDER;
            cell.HorizontalAlignment = Element.ALIGN_LEFT;
            cell.VerticalAlignment   = Element.ALIGN_TOP;
            table.AddCell(cell);

            cell = new PdfPCell(new Paragraph(String.Format("{0:C}", totalRetail), _reportFont));
            //cell.Border = Rectangle.NO_BORDER;
            cell.HorizontalAlignment = Element.ALIGN_LEFT;
            cell.VerticalAlignment   = Element.ALIGN_TOP;
            table.AddCell(cell);
        }
Exemplo n.º 5
0
        private void PrintDetailRow(TransferItemVO vo, PdfPTable table, int row)
        {
            decimal totalCost = vo.ItemCost;

            if (Convert.ToInt32(vo.ICNQty) > 0 && vo.ItemCost > 0.0m)
            {
                totalCost = Convert.ToInt32(vo.ICNQty) * vo.ItemCost;
            }
            PdfPCell cell;

            cell = new PdfPCell(new Paragraph(row.ToString(), _reportFont));
            //cell.Border = Rectangle.NO_BORDER;
            cell.HorizontalAlignment = Element.ALIGN_LEFT;
            cell.VerticalAlignment   = Element.ALIGN_TOP;
            table.AddCell(cell);

            cell = new PdfPCell(new Paragraph(vo.GunNumber == null ? string.Empty : vo.GunNumber.ToString(), _reportFont));
            //cell.Border = Rectangle.NO_BORDER;
            cell.HorizontalAlignment = Element.ALIGN_LEFT;
            cell.VerticalAlignment   = Element.ALIGN_TOP;
            table.AddCell(cell);

            Phrase icnPhrase = new Phrase(GetFormattedICNPhrase(vo.ICN));

            cell = new PdfPCell(icnPhrase);
            //cell.Border = Rectangle.NO_BORDER;
            cell.HorizontalAlignment = Element.ALIGN_LEFT;
            cell.VerticalAlignment   = Element.ALIGN_TOP;
            table.AddCell(cell);

            if (_type.Equals("Gun Room"))
            {
                cell = new PdfPCell(new Paragraph(vo.ItemDescription, _reportFont));
                //cell.Border = Rectangle.NO_BORDER;
                cell.HorizontalAlignment = Element.ALIGN_LEFT;
                cell.Colspan             = 5;
                cell.VerticalAlignment   = Element.ALIGN_TOP;
                table.AddCell(cell);

                cell = new PdfPCell(new Paragraph(String.Format("{0:C}", vo.ItemCost), _reportFont));
                //cell.Border = Rectangle.NO_BORDER;
                cell.HorizontalAlignment = Element.ALIGN_LEFT;
                cell.VerticalAlignment   = Element.ALIGN_TOP;
                table.AddCell(cell);
            }
            else
            {
                cell = new PdfPCell(new Paragraph(vo.ItemDescription, _reportFont));
                //cell.Border = Rectangle.NO_BORDER;
                cell.HorizontalAlignment = Element.ALIGN_LEFT;
                cell.Colspan             = 3;
                cell.VerticalAlignment   = Element.ALIGN_TOP;
                table.AddCell(cell);

                cell = new PdfPCell(new Paragraph(vo.ICNQty, _reportFont));
                //cell.Border = Rectangle.NO_BORDER;
                cell.HorizontalAlignment = Element.ALIGN_LEFT;
                cell.VerticalAlignment   = Element.ALIGN_TOP;
                table.AddCell(cell);

                cell = new PdfPCell(new Paragraph(String.Format("{0:C}", vo.ItemCost), _reportFont));
                //cell.Border = Rectangle.NO_BORDER;
                cell.HorizontalAlignment = Element.ALIGN_LEFT;
                cell.VerticalAlignment   = Element.ALIGN_TOP;
                table.AddCell(cell);

                cell = new PdfPCell(new Paragraph(String.Format("{0:C}", totalCost), _reportFont));
                //cell.Border = Rectangle.NO_BORDER;
                cell.HorizontalAlignment = Element.ALIGN_LEFT;
                cell.VerticalAlignment   = Element.ALIGN_TOP;
                table.AddCell(cell);
            }
        }