internal static void PrintCardCheck(List <string> Slip, String DocName) { ShtrihCommandBlock ShtrihCommandBlockPrint = new ShtrihCommandBlock(); ShtrihCommandBlockPrint.PrintDocumentTitle(DocName, 1); foreach (string s in Slip) { String NewS = AddMiddleSpace(s); ShtrihCommandBlockPrint.PrintString(NewS); } ShtrihCommandBlockPrint.CutCheck(); ShtrihCommandBlockPrint.CommandBlockToQwery(); }
//public static bool WriteReg(int RegNum, int RegVal) //{ // System.IO.Ports.SerialPort port = new System.IO.Ports.SerialPort(); // try // { // /* // while (!ToShtrih.Conn()) // { // label1.Text = (Environment.NewLine + "Внимание! Вы не подключили фискальный регистратор. " + Environment.NewLine + // "Продолжение работы невозможно." + Environment.NewLine + // "Поменяйте регистратор и нажмите на кнопку продолжить."); // } // ToShtrih.Disconnect(); // */ // //Shtrih.Disconnect(); // port.WriteTimeout = 5000; // port.ReadTimeout = 20000; // port.BaudRate = 115200; // port.PortName = "com" + Shtrih.ComNumber; // port.NewLine = Environment.NewLine; // port.DtrEnable = true; // port.RtsEnable = true; // port.Parity = Parity.None; // port.ReadBufferSize = 1024; // port.WriteBufferSize = 1024; // port.Handshake = Handshake.None; // port.Open(); // port.DiscardInBuffer(); // port.DiscardOutBuffer(); // byte[] com = HexStringToByteArray("05"); // port.Write(com, 0, 1); // int k = (port.Read(com, 0, 1)); // string sRegNum = Convert.ToString(RegNum, 16); // if (sRegNum.Length == 1) // { // sRegNum = "0" + sRegNum; // } // string sRegVal = Convert.ToString(RegVal, 16); // if (sRegVal.Length == 1) // { // sRegVal = "0" + sRegVal + "00"; // } // else if (sRegVal.Length == 2) // { // sRegVal = sRegVal + " 00"; // } // else if (sRegVal.Length == 3) // { // sRegVal = sRegVal[1].ToString() + sRegVal[2].ToString() + "0" + sRegVal[0].ToString(); // } // else if (sRegVal.Length == 4) // { // sRegVal = sRegVal[2].ToString() + sRegVal[3].ToString() + sRegVal[0].ToString() + sRegVal[1].ToString(); // } // byte[] b = HexStringToByteArray("02 0A FF 00" + sRegNum + "00 " + sRegVal + " 00 00 00 00 00"); // byte xor = 0; // for (int i = 1; i < b.Length - 1; i++) // { // if (i < 3) // { // xor = (byte)(b[1] ^ b[2]); // } // else // { // xor = (byte)(xor ^ b[i]); // } // } // b[b.Length - 1] = xor; // port.Write(b, 0, b.Length); // int kk = (port.Read(com, 0, 1)); // byte[] bb = HexStringToByteArray("06"); // port.Write(bb, 0, bb.Length); // //string s = port.ReadLine(); // port.Close(); // return true; // } // catch (Exception e) // { // port.Close(); // return false; // } //} public static void PrintOutKassetaReport(double Summ, bool Kasseta) { string CurentDate = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss"); ShtrihCommandBlock ShtrihCommandBlockPrint = new ShtrihCommandBlock(); ShtrihCommandBlockPrint.PrintString(CurentDate); if (Kasseta) { ShtrihCommandBlockPrint.PrintString("ОТЧЕТ ИЗЪЯТИЯ КАССЕТЫ "); } else { ShtrihCommandBlockPrint.PrintString("ОТЧЕТ ИЗЪЯТИЯ МОНЕТ "); } ShtrihCommandBlockPrint.PrintString("-------------------------------"); ShtrihCommandBlockPrint.PrintString(" "); ShtrihCommandBlockPrint.PrintWideString("СУММА " + Summ.ToString("0.00").Replace(",", ".")); ShtrihCommandBlockPrint.PrintString(" "); ShtrihCommandBlockPrint.PrintString("-------------------------------"); ShtrihCommandBlockPrint.PrintString(" "); if (Kasseta) { ShtrihCommandBlockPrint.PrintString("КАССЕТА ИЗЪЯТА"); } else { ShtrihCommandBlockPrint.PrintString("МОНЕТЫ ИЗЪЯТЫ"); } ShtrihCommandBlockPrint.FeedDocument(); ShtrihCommandBlockPrint.CutCheck(); //ShtrihCommandBlockPrint.FinishDocument(); PrintCaptionWithFont(1, ShtrihCommandBlockPrint); ShtrihCommandBlockPrint.CommandBlockToQwery(); }
internal static void PrintCardCheck(object _Rcp, bool printCaption = true) { Utils.ToCardLog("PrintCardCheck start"); ShtrihCommandBlock ShtrihCommandBlockPrint = new ShtrihCommandBlock(); string Rcp = (string)_Rcp; try { string[] Str = Rcp.Split(char.ConvertFromUtf32(10)[0]); ShtrihCommandBlockPrint.PrintString(" "); bool ShtrihCut = false; foreach (string str in Str) { if (str.Length < 1) { continue; } string str1 = str.Substring(0, str.Length - 1); int StingWidth = 36; if (str1.Length > 36) { str1 = str1.Replace(" ", " "); if (str1.Length > 36) { str1 = str1.Substring(0, 36); } } str1 = str1.Replace("&&", new string(" "[0], StingWidth - (str1.Length - 2))); if (str1.Length == 0) { ShtrihCommandBlockPrint.PrintString(" "); ShtrihCut = false; } else if (str1.ToCharArray()[0] == 31) { ShtrihCommandBlockPrint.PrintString(" "); ShtrihCommandBlockPrint.PrintString(" "); ShtrihCommandBlockPrint.PrintString(" "); ShtrihCommandBlockPrint.PrintString(" "); ShtrihCommandBlockPrint.PrintString(" "); ShtrihCommandBlockPrint.CutCheck(); ShtrihCut = true; } else if (str1.Contains("0xDA")) { str1 = str1.Replace("0xDA", ""); ShtrihCommandBlockPrint.PrintString(str1); ShtrihCommandBlockPrint.PrintString(" "); ShtrihCommandBlockPrint.PrintString(" "); ShtrihCommandBlockPrint.PrintString(" "); ShtrihCommandBlockPrint.CutCheck(); ShtrihCut = true; } else if (str1.Contains(Convert.ToChar(1))) { //str1 = str1.Replace("0xDA", ""); Utils.ToCardLog("Cutting"); ShtrihCommandBlockPrint.PrintString(" "); ShtrihCommandBlockPrint.PrintString(" "); ShtrihCommandBlockPrint.PrintString(" "); ShtrihCommandBlockPrint.CutCheck(); ShtrihCommandBlockPrint.PrintString(str1); ShtrihCut = true; } else { ShtrihCommandBlockPrint.PrintString(str1); ShtrihCut = false; } } if (!ShtrihCut) { ShtrihCommandBlockPrint.PrintString(" "); ShtrihCommandBlockPrint.PrintString(" "); ShtrihCommandBlockPrint.PrintString(" "); ShtrihCommandBlockPrint.PrintString(" "); ShtrihCommandBlockPrint.PrintString(" "); ShtrihCommandBlockPrint.CutCheck(); } if (printCaption) { PrintCaptionWithFont(1, ShtrihCommandBlockPrint); } ; ShtrihCommandBlockPrint.CommandBlockToQwery(); Utils.ToCardLog("PrintCardCheck End"); } catch (Exception e) { Utils.ToLog("[Error] PrintCardCheck " + e.Message); } //Shtrih.Disconnect(); }