Esempio n. 1
0
        public void PrintReportHeaderSection(bool IsReceipt, DateTime OverRidingPrintDate, bool WillUseCompanyCodeForCredit = false)
        {
            //PosExplorer posExplorer = new PosExplorer();
            //DeviceInfo deviceInfo = posExplorer.GetDevice(DeviceType.PosPrinter, mclsTerminalDetails.PrinterName);
            //m_Printer = (PosPrinter) posExplorer.CreateInstance(deviceInfo);

            //m_Printer.Open();
            ////Then the device is disable from other application
            //m_Printer.Claim(1000);
            ////Enable the device.
            //m_Printer.DeviceEnabled = true;

            ////'Output by the high quality mode

            //m_Printer.RecLetterQuality = true;

            ////'Release the exclusive control right

            //m_Printer.Release();

            ////m_Printer.SetBitmap(1, PrinterStation.Receipt, strFilePath, PosPrinter.PrinterBitmapAsIs, PosPrinter.PrinterBitmapCenter);

            msbToPrint.Clear(); // reset the transaction to print in POSPrinter
            msbToPrint = new StringBuilder(); // reset the transaction to print in POSPrinter

            Reports.Receipt clsReceipt = new Reports.Receipt(mConnection, mTransaction);
            Reports.ReceiptDetails clsReceiptDetails;

            clsReceiptDetails = clsReceipt.Details(ReportFormatModule.ReportHeaderSpacer);

            // print Report Header Spacer
            for (int i = 0; i < Convert.ToInt32(clsReceiptDetails.Value); i++)
            { msbToPrint.Append(Environment.NewLine); }

            mclsFilePrinter = new FilePrinter();
            
            if (string.IsNullOrEmpty(mclsSalesTransactionDetails.TransactionNo) || mclsSalesTransactionDetails.TransactionNo == "READY..." || mclsSalesTransactionDetails.TransactionNo == mclsFilePrinter.FileName)
                    mclsFilePrinter.FileName = DateTime.Now.ToString("yyyyMMddhhmmss");
            else if (!IsReceipt)
                mclsFilePrinter.FileName = mclsSalesTransactionDetails.TransactionNo + "_" + DateTime.Now.ToString("yyyyMMddhhmmss");
            else
                mclsFilePrinter.FileName = mclsSalesTransactionDetails.TransactionNo;

            if (WillUseCompanyCodeForCredit && !string.IsNullOrEmpty(CompanyDetails.CompanyCodeForCredit))
            {
                if (mclsTerminalDetails.IsPrinterDotMatrix) msbToPrint.Append(CenterString(CompanyDetails.CompanyCodeForCredit, mclsTerminalDetails.MaxReceiptWidth) + Environment.NewLine);
                else msbToPrint.Append(RawPrinterHelper.escBoldHWOn + RawPrinterHelper.escAlignCenter + CompanyDetails.CompanyCodeForCredit + RawPrinterHelper.escAlignDef + RawPrinterHelper.escBoldHWOff + Environment.NewLine);
            }
            else
            {
                if (mclsTerminalDetails.IsPrinterDotMatrix) msbToPrint.Append(CenterString(CompanyDetails.CompanyCode, mclsTerminalDetails.MaxReceiptWidth) + Environment.NewLine);
                else msbToPrint.Append(RawPrinterHelper.escBoldHWOn + RawPrinterHelper.escAlignCenter + CompanyDetails.CompanyCode + RawPrinterHelper.escAlignDef + RawPrinterHelper.escBoldHWOff + Environment.NewLine);
            }

            // print Report Header
            int iCtr = 0;
            string stModule = "";
            for (iCtr = 1; iCtr <= 10; iCtr++)
            {
                stModule = "ReportHeader" + iCtr;
                clsReceiptDetails = clsReceipt.Details(stModule);

                PrintReportValue(clsReceiptDetails, IsReceipt, OverRidingPrintDate);
            }
            clsReceipt.CommitAndDispose();
        }
Esempio n. 2
0
        private void SetParameters(ReportDocument Report)
        {
            int iCtr = 0;
            string stModule = "";
            Reports.Receipt clsReceipt = new Reports.Receipt();
            //			Reports.ReceiptDetails clsReceiptDetails;

            Reports.ReceiptDetails[] ReportHeader = new Reports.ReceiptDetails[6];

            // print report footer
            for (iCtr = 1; iCtr <= 5; iCtr++)
            {
                stModule = "ReportHeader" + iCtr;
                ReportHeader[iCtr] = clsReceipt.Details(stModule);
            }

            Reports.ReceiptDetails[] ReportFooter = new Reports.ReceiptDetails[6];
            // print report footer
            for (iCtr = 1; iCtr <= 5; iCtr++)
            {
                stModule = "ReportFooter" + iCtr;
                ReportFooter[iCtr] = clsReceipt.Details(stModule);
            }

            clsReceipt.CommitAndDispose();

            ParameterFieldDefinition paramField;
            ParameterValues currentValues;
            ParameterDiscreteValue discreteParam;

            paramField = Report.DataDefinition.ParameterFields["CompanyCode"];
            discreteParam = new ParameterDiscreteValue();
            discreteParam.Value = CompanyDetails.CompanyCode;
            currentValues = new ParameterValues();
            currentValues.Add(discreteParam);
            paramField.ApplyCurrentValues(currentValues);

            paramField = Report.DataDefinition.ParameterFields["ReportHeader1"];
            discreteParam = new ParameterDiscreteValue();
            discreteParam.Value = getHeaderFooter(ReportHeader[1]);
            currentValues = new ParameterValues();
            currentValues.Add(discreteParam);
            paramField.ApplyCurrentValues(currentValues);

            paramField = Report.DataDefinition.ParameterFields["ReportHeader2"];
            discreteParam = new ParameterDiscreteValue();
            discreteParam.Value = getHeaderFooter(ReportHeader[2]);
            currentValues = new ParameterValues();
            currentValues.Add(discreteParam);
            paramField.ApplyCurrentValues(currentValues);

            paramField = Report.DataDefinition.ParameterFields["ReportHeader3"];
            discreteParam = new ParameterDiscreteValue();
            discreteParam.Value = getHeaderFooter(ReportHeader[3]);
            currentValues = new ParameterValues();
            currentValues.Add(discreteParam);
            paramField.ApplyCurrentValues(currentValues);

            paramField = Report.DataDefinition.ParameterFields["ReportHeader4"];
            discreteParam = new ParameterDiscreteValue();
            discreteParam.Value = getHeaderFooter(ReportHeader[4]);
            currentValues = new ParameterValues();
            currentValues.Add(discreteParam);
            paramField.ApplyCurrentValues(currentValues);

            paramField = Report.DataDefinition.ParameterFields["CONFIG_ENABLEEVAT"];
            discreteParam = new ParameterDiscreteValue();
            discreteParam.Value = mclsTerminalDetails.EnableEVAT;
            currentValues = new ParameterValues();
            currentValues.Add(discreteParam);
            paramField.ApplyCurrentValues(currentValues);

            paramField = Report.DataDefinition.ParameterFields["ReportFooter1"];
            discreteParam = new ParameterDiscreteValue();
            discreteParam.Value = getHeaderFooter(ReportFooter[1]);
            currentValues = new ParameterValues();
            currentValues.Add(discreteParam);
            paramField.ApplyCurrentValues(currentValues);

            paramField = Report.DataDefinition.ParameterFields["ReportFooter2"];
            discreteParam = new ParameterDiscreteValue();
            discreteParam.Value = getHeaderFooter(ReportFooter[2]);
            currentValues = new ParameterValues();
            currentValues.Add(discreteParam);
            paramField.ApplyCurrentValues(currentValues);

            paramField = Report.DataDefinition.ParameterFields["ReportFooter3"];
            discreteParam = new ParameterDiscreteValue();
            discreteParam.Value = getHeaderFooter(ReportFooter[3]);
            currentValues = new ParameterValues();
            currentValues.Add(discreteParam);
            paramField.ApplyCurrentValues(currentValues);

        }
Esempio n. 3
0
        private void SetParameters(ReportDocument Report)
        {
            int    iCtr     = 0;
            string stModule = "";

            Reports.Receipt clsReceipt = new Reports.Receipt();
            //			Reports.ReceiptDetails clsReceiptDetails;

            Reports.ReceiptDetails[] ReportHeader = new Reports.ReceiptDetails[6];

            // print report footer
            for (iCtr = 1; iCtr <= 5; iCtr++)
            {
                stModule           = "ReportHeader" + iCtr;
                ReportHeader[iCtr] = clsReceipt.Details(stModule);
            }

            Reports.ReceiptDetails[] ReportFooter = new Reports.ReceiptDetails[6];
            // print report footer
            for (iCtr = 1; iCtr <= 5; iCtr++)
            {
                stModule           = "ReportFooter" + iCtr;
                ReportFooter[iCtr] = clsReceipt.Details(stModule);
            }

            clsReceipt.CommitAndDispose();

            ParameterFieldDefinition paramField;
            ParameterValues          currentValues;
            ParameterDiscreteValue   discreteParam;

            paramField          = Report.DataDefinition.ParameterFields["CompanyCode"];
            discreteParam       = new ParameterDiscreteValue();
            discreteParam.Value = CompanyDetails.CompanyCode;
            currentValues       = new ParameterValues();
            currentValues.Add(discreteParam);
            paramField.ApplyCurrentValues(currentValues);

            paramField          = Report.DataDefinition.ParameterFields["ReportHeader1"];
            discreteParam       = new ParameterDiscreteValue();
            discreteParam.Value = getHeaderFooter(ReportHeader[1]);
            currentValues       = new ParameterValues();
            currentValues.Add(discreteParam);
            paramField.ApplyCurrentValues(currentValues);

            paramField          = Report.DataDefinition.ParameterFields["ReportHeader2"];
            discreteParam       = new ParameterDiscreteValue();
            discreteParam.Value = getHeaderFooter(ReportHeader[2]);
            currentValues       = new ParameterValues();
            currentValues.Add(discreteParam);
            paramField.ApplyCurrentValues(currentValues);

            paramField          = Report.DataDefinition.ParameterFields["ReportHeader3"];
            discreteParam       = new ParameterDiscreteValue();
            discreteParam.Value = getHeaderFooter(ReportHeader[3]);
            currentValues       = new ParameterValues();
            currentValues.Add(discreteParam);
            paramField.ApplyCurrentValues(currentValues);

            paramField          = Report.DataDefinition.ParameterFields["ReportHeader4"];
            discreteParam       = new ParameterDiscreteValue();
            discreteParam.Value = getHeaderFooter(ReportHeader[4]);
            currentValues       = new ParameterValues();
            currentValues.Add(discreteParam);
            paramField.ApplyCurrentValues(currentValues);

            paramField          = Report.DataDefinition.ParameterFields["CONFIG_ENABLEEVAT"];
            discreteParam       = new ParameterDiscreteValue();
            discreteParam.Value = mclsTerminalDetails.EnableEVAT;
            currentValues       = new ParameterValues();
            currentValues.Add(discreteParam);
            paramField.ApplyCurrentValues(currentValues);

            paramField          = Report.DataDefinition.ParameterFields["ReportFooter1"];
            discreteParam       = new ParameterDiscreteValue();
            discreteParam.Value = getHeaderFooter(ReportFooter[1]);
            currentValues       = new ParameterValues();
            currentValues.Add(discreteParam);
            paramField.ApplyCurrentValues(currentValues);

            paramField          = Report.DataDefinition.ParameterFields["ReportFooter2"];
            discreteParam       = new ParameterDiscreteValue();
            discreteParam.Value = getHeaderFooter(ReportFooter[2]);
            currentValues       = new ParameterValues();
            currentValues.Add(discreteParam);
            paramField.ApplyCurrentValues(currentValues);

            paramField          = Report.DataDefinition.ParameterFields["ReportFooter3"];
            discreteParam       = new ParameterDiscreteValue();
            discreteParam.Value = getHeaderFooter(ReportFooter[3]);
            currentValues       = new ParameterValues();
            currentValues.Add(discreteParam);
            paramField.ApplyCurrentValues(currentValues);
        }