Exemplo n.º 1
0
        private void PrintNonFiscal(DeviceManagerBase devMan, ICashReceiptPrinterController printer)
        {
            if (!printer.SupportedCommands.Contains(DeviceCommands.OpenNonFiscal) ||
                (!printer.SupportedCommands.Contains(DeviceCommands.PrintTextNonFiscal) &&
                 !printer.SupportedCommands.Contains(DeviceCommands.PrintKeyValueNonFiscal)) ||
                !printer.SupportedCommands.Contains(DeviceCommands.CloseNonFiscal))
            {
                return;
            }

            KeyValuePair <string, string> [] lines = receiptReport.GetReportLines();
            txvPreview.Buffer.Text = receiptReport.Display(lines);

            devMan.TryDeviceCommand(delegate
            {
                printer.OpenNonFiscal(false);

                if (printer.SupportedCommands.Contains(DeviceCommands.PrintTitleNonFiscal))
                {
                    printer.PrintTitleNonFiscal(receiptReport.Title);
                }
                else
                {
                    printer.PrintTextNonFiscal(receiptReport.Title.AlignCenter(printer.NonFiscalTextCharsPerLine));
                }

                printer.PrintTextNonFiscal(DriverBase.SEPARATOR);
            });

            if (printer.SupportedCommands.Contains(DeviceCommands.PrintKeyValueNonFiscal))
            {
                for (int i = 0; i < lines.Length; i++)
                {
                    if (i % 5 == 0)
                    {
                        ShowProgress(((double)i * 100) / lines.Length);
                    }

                    string key = lines [i].Key;
                    string val = lines [i].Value;
                    devMan.TryDeviceCommand(() => printer.PrintKeyValueNonFiscal(key, val, " "));
                }
            }
            else
            {
                for (int i = 0; i < lines.Length; i++)
                {
                    if (i % 5 == 0)
                    {
                        ShowProgress(((double)i * 100) / lines.Length);
                    }

                    string key = lines [i].Key;
                    string val = lines [i].Value;
                    devMan.TryDeviceCommand(() => printer.PrintTextNonFiscal(ReceiptReport.GetReportLine(key, val, printer.NonFiscalTextCharsPerLine)));
                }
            }

            devMan.TryDeviceCommand(printer.CloseNonFiscal);
        }
Exemplo n.º 2
0
        public IHttpActionResult ReprintOrder([FromUri] int id)
        {
            ReceiptReport po = new ReceiptReport();

            //po.SetParameterValue("OID", id);
            //po.PrintToPrinter(1, false, 0, 0);
            return(Ok());
        }
        public ActionResult PrintReceiptPartial(string PaymentId)
        {
            var           model  = unitOfWork.PaymentsRepo.Get(m => m.Id == PaymentId, includeProperties: "Enrollments.Students");
            ReceiptReport report = new ReceiptReport()
            {
                DataSource = model
            };

            return(PartialView("_PrintReceiptPartial", report));
        }
Exemplo n.º 4
0
 public IHttpActionResult SetOrder([FromUri] string items, [FromUri] int tot, [FromUri] int dis,
                                   [FromUri] int rcv, [FromUri] int cus_id)
 {
     customer_id = cus_id;
     String[] list = items.Split(',');
     ids      = new int[list.Length];
     names    = new String[list.Length];
     unit     = new int[list.Length];
     qnty     = new int[list.Length];
     total    = new int[list.Length];
     sale     = tot;
     this.rcv = rcv;
     blnc     = rcv - tot;
     for (int i = 0; i < list.Length; i++)
     {
         String[] temp = list[i].Split('|');
         ids[i]   = Int32.Parse(temp[0]);
         names[i] = temp[1].Trim();
         unit[i]  = Int32.Parse(temp[2]);
         qnty[i]  = Int32.Parse(temp[3]);
         total[i] = Int32.Parse(temp[4]);
     }
     if (saveData())
     {
         try
         {
             ReceiptReport po = new ReceiptReport();
             po.SetParameterValue("OID", ordernumber);
             po.SetParameterValue("discount", dis);
             po.PrintToPrinter(1, false, 0, 0);
             return(Ok());
         }
         catch
         {
             return(BadRequest("Problem With the printer."));
         }
     }
     else
     {
         return(BadRequest("Item is Ended. or the quantity is not good entered..."));
     }
 }
Exemplo n.º 5
0
        private void rbtnReport_Toggled(object o, EventArgs args)
        {
            if (rbnSales.Active)
            {
                receiptReport = new ReceiptReportSales();
            }
            else if (rbnReturns.Active)
            {
                receiptReport = new ReceiptReportReturns();
            }
            else if (rbnTurnover.Active)
            {
                receiptReport = new ReceiptReportTurnover();
            }
            else
            {
                receiptReport = new ReceiptReportOperations();
            }

            AppendFilters();
            DisplayReport();
        }
Exemplo n.º 6
0
        private void PrintKitchen(DeviceManagerBase devMan, IKitchenPrinterController kitchenPrinter)
        {
            if (!kitchenPrinter.SupportedCommands.Contains(DeviceCommands.PrintFreeText))
            {
                return;
            }

            KeyValuePair <string, string> [] lines = receiptReport.GetReportLines();
            txvPreview.Buffer.Text = receiptReport.Display(lines);

            devMan.TryDeviceCommand(delegate
            {
                kitchenPrinter.PrintFreeText(receiptReport.Title.AlignCenter(kitchenPrinter.TextCharsPerLine));
                kitchenPrinter.PrintFreeText(DriverBase.SEPARATOR);

                if (kitchenPrinter.SupportedCommands.Contains(DeviceCommands.PaperFeed))
                {
                    kitchenPrinter.PaperFeed();
                }
            });

            for (int i = 0; i < lines.Length; i++)
            {
                if (i % 5 == 0)
                {
                    ShowProgress(((double)i * 100) / lines.Length);
                }

                string key = lines [i].Key;
                string val = lines [i].Value;
                devMan.TryDeviceCommand(() => kitchenPrinter.PrintFreeText(ReceiptReport.GetReportLine(key, val, kitchenPrinter.TextCharsPerLine)));
            }

            if (kitchenPrinter.SupportedCommands.Contains(DeviceCommands.PaperCut))
            {
                devMan.TryDeviceCommand(kitchenPrinter.PaperCut);
            }
        }
Exemplo n.º 7
0
        public IList <ReceiptReport> FetchReceiptReport(DateTime?from = default(DateTime?), DateTime?to = default(DateTime?))
        {
            try
            {
                StringBuilder query = new StringBuilder();

                var fromDate = from.HasValue ? (DateTime)from : new DateTime(2000, 1, 1);
                var toDate   = to.HasValue ? (DateTime)to : new DateTime(2100, 1, 1);


                TimeSpan tsStart = new TimeSpan(0, 0, 0);
                fromDate = fromDate.Date + tsStart;


                TimeSpan tsEnd = new TimeSpan(23, 59, 59);
                toDate = toDate.Date + tsEnd;


                query.AppendFormat(@" 
                    select r.receipt_id, r.member_id, m.fullname, ms.name, r.amount_received,r.payment_method, r.received_by, r.received_on, r.transaction_cancelled, t.transaction_id
                    ,t.amount_paid, t.amount_discounted, t.amount_registration, t.amount_writtenoff, t.amount_unpaid, t.period_start_date, t.period_end_date
                    from {0} r
                    inner join {1} m
                    on r.member_id = m.member_id
                    inner join {2} ms
                    on m.membership_type = ms.code
                    left join {3} t
                    on r.transaction_id = t.transaction_id
                    where r.received_on between @from and @to

                       ", TableMappings.TBL_RECEIPT
                                   , TableMappings.TBL_MEMBER
                                   , TableMappings.TBL_MEMBERSHIP
                                   , TableMappings.TBL_TRANSACTION

                                   );

                IList <ReceiptReport> list = new List <ReceiptReport>();

                List <SqlParameter> parameters = new List <SqlParameter>();
                parameters.Add(CreateParameter("@from", SqlDbType.DateTime, fromDate));
                parameters.Add(CreateParameter("@to", SqlDbType.DateTime, toDate));



                DBConnect();
                SqlDataReader reader = ReadQuery(query.ToString(), parameters);

                while (reader.Read())
                {
                    int           i    = 0;
                    ReceiptReport item = new ReceiptReport();

                    item.ReceiptId      = ReadInt(ref reader, ref i);
                    item.MemberId       = ReadInt(ref reader, ref i);
                    item.MemberName     = ReadString(ref reader, ref i);
                    item.Membership     = ReadString(ref reader, ref i);
                    item.ReceiptAmount  = ReadDouble(ref reader, ref i);
                    item.PaymentMethod  = ReadString(ref reader, ref i);
                    item.ReceivedByUser = ReadString(ref reader, ref i);
                    item.ReceiptDate    = ReadDate(ref reader, ref i);
                    item.IsCancelled    = ReadString(ref reader, ref i) == "Y";
                    item.TransactionId  = ReadInt(ref reader, ref i);

                    item.PaidAmount         = ReadDouble(ref reader, ref i);
                    item.DiscountedAmount   = ReadDouble(ref reader, ref i);
                    item.RegistrationAmount = ReadDouble(ref reader, ref i);
                    item.WrittenOffAmount   = ReadDouble(ref reader, ref i);
                    item.DiscountedAmount   = ReadDouble(ref reader, ref i);
                    item.PeriodStart        = ReadDate(ref reader, ref i);
                    item.PeriodEnd          = ReadDate(ref reader, ref i);

                    list.Add(item);
                }
                reader.Dispose();
                DBDisconnect();

                return(list);
            }
            catch (Exception)
            {
                throw;
            }
        }