示例#1
0
        public ActionResult PrintView(string CPno, int QueueID)
        {
            BillPrint bill = new BillPrint();

            bill = BL.PrintBill(QueueID, CPno);
            return(PartialView("PrintBill", bill));
        }
示例#2
0
 public BillPrint PrintBill(int QueueId, string CPno)
 {
     try
     {
         SqlParameter[] sqlparam;
         sqlparam    = new SqlParameter[3];
         sqlparam[0] = new SqlParameter("@flag", "1");
         sqlparam[1] = new SqlParameter("@QueueId", QueueId);
         sqlparam[2] = new SqlParameter("@CPno", CPno);
         DataSet     ds  = CommonFunction.GetDataSet("USP_Get_PrintBillingDetails", sqlparam, "");
         BillPrint   BP  = new BillPrint();
         List <Bill> lst = new List <Bill>();
         if (ds != null && ds.Tables[0].Rows.Count > 0)
         {
             DataTable dt = ds.Tables[0];
             foreach (DataRow dr in dt.Rows)
             {
                 CommonFunction.ReflectSingleData(BP, dr);
             }
             DataTable dt1 = ds.Tables[1];
             foreach (DataRow dr in dt1.Rows)
             {
                 Bill Model = new Bill();
                 CommonFunction.ReflectSingleData(Model, dr);
                 lst.Add(Model);
             }
         }
         BP.lstBill = lst;
         return(BP);
     }
     catch (Exception Ex)
     {
         throw Ex;
     }
 }
示例#3
0
        public ActionResult PrintDentalView(string Print)
        {
            Bal_ExpensesDetails BL   = new Bal_ExpensesDetails();
            BillPrint           bill = new BillPrint();
            int    QueueID           = Convert.ToInt16(Session["QueueID"].ToString());
            string CPno = Session["CPno"].ToString();

            bill = BL.PrintBill(QueueID, CPno);
            return(PartialView("PrintDental", bill));
        }
示例#4
0
 public ActionResult PrintBill(string CPno, int QueueID)
 {
     try
     {
         BillPrint bill = new BillPrint();
         bill = BL.PrintBill(QueueID, CPno);
         return(null);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
示例#5
0
        /// <summary>
        /// 打印或预览发货单
        /// </summary>
        /// <param name="invoiceList">整理过的发货清单</param>
        /// <param name="isPreview">true:预览,false:打印</param>
        private bool PrintInvoice(List <InvoiceListModelEdit> invoiceList, bool isPreview)
        {
            InvoiceModelPrint invoicePrintInfo;
            BillModel         invoiceTemplate;

            //配置打印信息
            if (isPreview)
            {
                decimal money = invoiceList.Sum(_func => _func.单价 * _func.数量);
                invoicePrintInfo = new InvoiceModelPrint()
                {
                    联系人     = 发货单.联系人,
                    金额      = money,
                    总页码     = Global.User.发货单总页码 + 1,
                    分页码     = _收货公司.发货单分页码 + 1,
                    打印时间    = DateTime.Now,
                    Comment = 发货单.Comment,
                    公司名称    = _收货公司.称,
                    赊欠金额    = _收货公司.赊欠金额 + money
                };
            }
            else
            {
                try
                {
                    invoicePrintInfo = Global.SQL.PrintInvoice(发货单.ID, 已付款);
                }
                catch (Exception e)
                {
                    SendMessage("打印失败", "SQL.PrintInvoice:" + e.Message);
                    return(false);
                }
            }
            //获取模板
            try
            {
                invoiceTemplate = XmlLinq.GetInvoiceTemplate(invoicePrintInfo, 已付款);
            }
            catch (Exception e)
            {
                SendMessage("打印失败", "XmlLinq.GetInvoiceTemplate:" + e.Message);
                return(false);
            }
            //打印
            try
            {
                BillPrint <InvoiceListModelEdit> print = new BillPrint <InvoiceListModelEdit>(invoiceTemplate, invoiceList);
                if (isPreview)
                {
                    print.PreviewPage();
                }
                else
                {
                    print.PrintPage();
                }
                return(true);
            }
            catch (Exception e)
            {
                SendMessage("打印失败", "BillPrint:" + e.Message);
                return(false);
            }
        }
示例#6
0
        public IHttpActionResult getBillByTPId(int id)
        {
            BillPrint billPrint = this.transitPass.getBillByTPId(id);

            return(Json(billPrint));
        }
示例#7
0
        async void PrintBill(string BillNo, bool IsNew = false)
        {
            try
            {
                using (SqlConnection conn = new SqlConnection(GlobalClass.TConnectionString))
                {
                    string PType = conn.ExecuteScalar <string>("SELECT PType From ParkingSales PS JOIN ParkingSalesDetails PSD ON PS.BillNo = PSD.BillNo AND PS.FYID = PSD.FYID WHERE PS.BillNo = @BillNo AND PS.FYID = @FYID", new { BillNo = BillNo, FYID = GlobalClass.FYID });
                    if (string.IsNullOrEmpty(PType))
                    {
                        MessageBox.Show("Invalid Invoice No", MessageBoxCaption, MessageBoxButton.OK, MessageBoxImage.Exclamation);
                        return;
                    }
                    else if (PType == "P")
                    {
                        MessageBox.Show("Entrance Invoice cannot be loaded in this interface.", MessageBoxCaption, MessageBoxButton.OK, MessageBoxImage.Exclamation);
                        return;
                    }

                    var vSales       = conn.Query <TParkingSales>("SELECT BillNo, FYID, TDate, TMiti, TTime, UserName [Description], BillTo, BILLTOADD, BILLTOPAN, Amount, Discount, NonTaxable, Taxable, VAT, GrossAmount, RefBillNo, TaxInvoice, Remarks, PS.UID, SESSION_ID, PID FROM ParkingSales PS JOIN Users U ON PS.UID = U.UID WHERE BillNo = @BillNo AND FYID = @FYID", new { BillNo = BillNo, FYID = GlobalClass.FYID }).FirstOrDefault();
                    var vSDetailList = new List <TParkingSalesDetails>(
                        conn.Query <TParkingSalesDetails>("SELECT BillNo, FYID, PTYPE, ProdId, [Description], Quantity, Rate, Amount, Discount, NonTaxable, Taxable, VAT, NetAmount, Remarks FROM ParkingSalesDetails WHERE BillNo = @BillNo AND FYID = @FYID", new { BillNo = BillNo, FYID = GlobalClass.FYID }));
                    string InWords = GlobalClass.GetNumToWords(conn, vSales.GrossAmount);

                    string DuplicateCaption = (IsNew) ? String.Empty : GlobalClass.GetReprintCaption(BillNo);
                    var    pslip            = new BillPrint
                    {
                        CompanyName      = GlobalClass.CompanyName,
                        CompanyAddress   = GlobalClass.CompanyAddress,
                        CompanyPan       = GlobalClass.CompanyPan,
                        PSales           = vSales,
                        PSDetails        = vSDetailList,
                        InWords          = InWords,
                        DuplicateCaption = DuplicateCaption
                    };
                    if (IsNew)
                    {
                        pslip.InvoiceTitle = "TAX INVOICE";
                        pslip.Print();
                        pslip.InvoiceTitle = "INVOIVE";
                        pslip.Print();
                    }
                    else
                    {
                        pslip.InvoiceTitle = "INVOIVE";
                        pslip.Print();
                        GlobalClass.SavePrintLog(BillNo, null, DuplicateCaption);
                        GlobalClass.SetUserActivityLog("Voucher Sales Invoice", "Re-Print", WorkDetail: string.Empty, VCRHNO: BillNo, Remarks: "Reprinted : " + DuplicateCaption);
                        if (MessageBox.Show("Would you like to reprint Vouchers as well?", MessageBoxCaption, MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
                        {
                            VoucherSelection vs  = conn.Query <VoucherSelection>("SELECT MIN(VoucherNo) VNOFrom, MAX(VoucherNo) VNOTo FROM ParkingVouchers WHERE BillNo = @BillNo AND FYID = @FYID", new { BillNo = BillNo, FYID = GlobalClass.FYID }).FirstOrDefault();
                            wVoucherSelect   wVS = new wVoucherSelect()
                            {
                                DataContext = vs
                            };
                            wVS.ShowDialog();

                            vp = new wVoucherPrintProgress()
                            {
                                DataContext = this
                            };
                            vp.Show();
                            await PrintVouchers(BillNo, false, vs);

                            vp.Close();
                        }
                    }
                }
            }
            catch (Exception Ex)
            {
                MessageBox.Show(GlobalClass.GetRootException(Ex).Message, MessageBoxCaption, MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }