Advertisement
penright

Untitled

Oct 3rd, 2023
1,491
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 17.16 KB | None | 0 0
  1.     Sub FixPrintForm()
  2.         'This is so we can have a common print form for all stores.
  3.         '  The parts that vary from store to store about between a commented
  4.         '  sections. This functions reads the default replaces comment sections
  5.         '  as needed. And remove others as needed.
  6.  
  7.  
  8.         'Dim all Markers as strings here
  9.         Dim ReceiptHeaderBitmap As String = "Receipt Header BitMap"
  10.         Dim ReceiptHeaderBitMapReplacment As String = ""
  11.         Dim PrintOrderNumberChit As String = "Print Order Number Chit"
  12.         Dim PrintOrderNumberChitReplacment As String = ""
  13.         Dim PrintOrderNumber As String = "Print Order Number"
  14.         Dim PrintOrderNumberReplacemnt As String = ""
  15.         Dim PrintOrderNumberCharge As String = "Print Order Number Charge"
  16.         Dim PrintOrderNumberChargeReplacemnt As String = ""
  17.         Dim GrillPrintOrderNumberChit As String = "Grill Print Order Number Chit"
  18.         Dim GrillPrintOrderNumberChitReplacemnt As String = ""
  19.         Dim TrailerBitMap As String = "Trailer Bit Map"
  20.         Dim TrailerBitMapReplacemnt As String = ""
  21.  
  22.  
  23.         Dim lstOrgPrintForm As List(Of String) = System.IO.File.ReadAllLines("c:\iris\data\Print.frm").ToList
  24.         PrintFormClean(lstOrgPrintForm, ReceiptHeaderBitmap)
  25.         PrintFormClean(lstOrgPrintForm, PrintOrderNumberChit)
  26.         PrintFormClean(lstOrgPrintForm, PrintOrderNumber)
  27.         PrintFormClean(lstOrgPrintForm, PrintOrderNumberCharge)
  28.         PrintFormClean(lstOrgPrintForm, GrillPrintOrderNumberChit)
  29.         PrintFormClean(lstOrgPrintForm, TrailerBitMap)
  30.  
  31.         'Build Common Replacments
  32.         'Grill Print Order Number Chit
  33.         GrillPrintOrderNumberChitReplacemnt = GrillPrintOrderNumberChitReplacemnt & "#prtr,=,Grill1" & vbCrLf
  34.         GrillPrintOrderNumberChitReplacemnt = GrillPrintOrderNumberChitReplacemnt & "`dh,dw,c" & vbCrLf
  35.         GrillPrintOrderNumberChitReplacemnt = GrillPrintOrderNumberChitReplacemnt & "`FontSize3" & vbCrLf
  36.         GrillPrintOrderNumberChitReplacemnt = GrillPrintOrderNumberChitReplacemnt & "~ExpoNum,-5~~TotalOrderItems,3~" & vbCrLf
  37.         GrillPrintOrderNumberChitReplacemnt = GrillPrintOrderNumberChitReplacemnt & "#destination,>,1" & vbCrLf
  38.         GrillPrintOrderNumberChitReplacemnt = GrillPrintOrderNumberChitReplacemnt & "`dh,dw,c" & vbCrLf
  39.         GrillPrintOrderNumberChitReplacemnt = GrillPrintOrderNumberChitReplacemnt & "" & vbCrLf
  40.         GrillPrintOrderNumberChitReplacemnt = GrillPrintOrderNumberChitReplacemnt & "**********  To Go   **********" & vbCrLf
  41.         GrillPrintOrderNumberChitReplacemnt = GrillPrintOrderNumberChitReplacemnt & "" & vbCrLf
  42.         GrillPrintOrderNumberChitReplacemnt = GrillPrintOrderNumberChitReplacemnt & "#" & vbCrLf
  43.         GrillPrintOrderNumberChitReplacemnt = GrillPrintOrderNumberChitReplacemnt & "`sh,sw" & vbCrLf
  44.         GrillPrintOrderNumberChitReplacemnt = GrillPrintOrderNumberChitReplacemnt & "#" & vbCrLf
  45.         'End of Common Replacement
  46.         'Build PrintForm String and Preform replacement
  47.         Dim OrgPrintForm As String = Join(lstOrgPrintForm.ToArray, vbCrLf)
  48.         PrintFormReplacment(OrgPrintForm, GrillPrintOrderNumberChit, GrillPrintOrderNumberChitReplacemnt)
  49.         'Process each register
  50.         For xLoop As Integer = 0 To PosMaint.RegisterInformations.Count - 1
  51.             Dim RegInfo As PosMaint10.RegInfo = PosMaint.RegisterInformations(xLoop)
  52.             'Build Register replacements
  53.             ReceiptHeaderBitMapReplacment = ""
  54.             PrintOrderNumberReplacemnt = ""
  55.             PrintOrderNumberChargeReplacemnt = ""
  56.             PrintOrderNumberChitReplacment = ""
  57.             TrailerBitMapReplacemnt = ""
  58.             'Trailer Bit Map
  59.             If IO.File.Exists("c:\iris\images\Braums_Guarantee.bmp") Then
  60.                 DispThis("  Reg " & RegInfo.RegisterNumber.ToString & " has a trailer bit map, ")
  61.                 TrailerBitMapReplacemnt = TrailerBitMapReplacemnt & "`sh" & vbNewLine
  62.                 TrailerBitMapReplacemnt = TrailerBitMapReplacemnt & "`c,hilogo" & vbNewLine
  63.                 TrailerBitMapReplacemnt = TrailerBitMapReplacemnt & "`sh" & vbNewLine
  64.                 TrailerBitMapReplacemnt = TrailerBitMapReplacemnt & "`sh" & vbNewLine
  65.                 If RegInfo.PrinterType = ePrinterType.Old Then
  66.                     DispThis("loading old printer, ")
  67.                     TrailerBitMapReplacemnt = TrailerBitMapReplacemnt & "c:\iris\images\Braums_Guarantee.bmp,2" & vbNewLine
  68.                 Else
  69.                     DispThis("loading OPOS printer, ")
  70.                     TrailerBitMapReplacemnt = TrailerBitMapReplacemnt & "c:\iris\images\Braums_Guarantee.bmp" & vbNewLine
  71.                 End If
  72.                 DispThis("Done" & NewLine)
  73.             End If
  74.             'End of Trailer Bit Map
  75.             'Start Set correct Header bit map
  76.             Select Case RegInfo.DefaultConcept
  77.                 Case eDefaultConcept.Fountain
  78.                     If RegInfo.PrinterType = ePrinterType.Old Then
  79.                         ReceiptHeaderBitMapReplacment = "c:\iris\images\braumprt_fountain.bmp,1" & vbCrLf
  80.                     Else
  81.                         ReceiptHeaderBitMapReplacment = "c:\iris\images\braumprt_fountain.bmp" & vbCrLf
  82.                     End If
  83.                 Case eDefaultConcept.Lobby
  84.                     'Receipt Header BitMap
  85.                     If RegInfo.PrinterType = ePrinterType.Old Then
  86.                         ReceiptHeaderBitMapReplacment = "c:\iris\images\braumprt_lobby.bmp,1" & vbCrLf
  87.                     Else
  88.                         ReceiptHeaderBitMapReplacment = "c:\iris\images\braumprt_lobby.bmp" & vbCrLf
  89.                     End If
  90.                 Case eDefaultConcept.DualLane1, eDefaultConcept.DualLane2, eDefaultConcept.Tender, eDefaultConcept.TenderBlockReg, eDefaultConcept.SplitScreen
  91.                     If RegInfo.PrinterType = ePrinterType.Old Then
  92.                         ReceiptHeaderBitMapReplacment = "c:\iris\images\braumprt_drive.bmp,1" & vbCrLf
  93.                     Else
  94.                         ReceiptHeaderBitMapReplacment = "c:\iris\images\braumprt_drive.bmp" & vbCrLf
  95.                     End If
  96.                 Case Else
  97.                     If RegInfo.PrinterType = ePrinterType.Old Then
  98.                         ReceiptHeaderBitMapReplacment = "c:\iris\images\braumprt_package.bmp,1" & vbCrLf
  99.                     Else
  100.                         ReceiptHeaderBitMapReplacment = "c:\iris\images\braumprt_package.bmp" & vbCrLf
  101.                     End If
  102.             End Select
  103.             'End Set correct Header bit map
  104.             'Start Fix for Tray Chit
  105.             If RegInfo.DefaultConcept = eDefaultConcept.Lobby OrElse RegInfo.DefaultConcept = eDefaultConcept.FreshMarket Then
  106.                 'Print Order Number
  107.                 PrintOrderNumberReplacemnt = PrintOrderNumberReplacemnt & "`dh,dw,c" & vbCrLf
  108.                 PrintOrderNumberReplacemnt = PrintOrderNumberReplacemnt & "" & vbCrLf
  109.                 PrintOrderNumberReplacemnt = PrintOrderNumberReplacemnt & "#SeatEXPOnum,#,0" & vbCrLf
  110.                 PrintOrderNumberReplacemnt = PrintOrderNumberReplacemnt & "&paystate,=,1" & vbCrLf
  111.                 PrintOrderNumberReplacemnt = PrintOrderNumberReplacemnt & "&destination,<,3" & vbCrLf
  112.                 PrintOrderNumberReplacemnt = PrintOrderNumberReplacemnt & "Paid Group Order" & vbCrLf
  113.                 PrintOrderNumberReplacemnt = PrintOrderNumberReplacemnt & "#else" & vbCrLf
  114.                 PrintOrderNumberReplacemnt = PrintOrderNumberReplacemnt & "#destination,<,3" & vbCrLf
  115.                 PrintOrderNumberReplacemnt = PrintOrderNumberReplacemnt & "`nonl" & vbCrLf
  116.                 PrintOrderNumberReplacemnt = PrintOrderNumberReplacemnt & "Order# " & vbCrLf
  117.                 '                If RegInfo.PrinterType = ePrinterType.Old Then
  118.                 PrintOrderNumberReplacemnt = PrintOrderNumberReplacemnt & "`FontSize5" & vbCrLf
  119.                 '               End If
  120.                 PrintOrderNumberReplacemnt = PrintOrderNumberReplacemnt & "#SeatEXPOnum,#,0" & vbCrLf
  121.                 PrintOrderNumberReplacemnt = PrintOrderNumberReplacemnt & "~SeatExpoNum~" & vbCrLf
  122.                 PrintOrderNumberReplacemnt = PrintOrderNumberReplacemnt & "#else" & vbCrLf
  123.                 PrintOrderNumberReplacemnt = PrintOrderNumberReplacemnt & "~ExpoNum~" & vbCrLf
  124.                 PrintOrderNumberReplacemnt = PrintOrderNumberReplacemnt & "#" & vbCrLf
  125.                 PrintOrderNumberReplacemnt = PrintOrderNumberReplacemnt & "#" & vbCrLf
  126.                 PrintOrderNumberReplacemnt = PrintOrderNumberReplacemnt & "#" & vbCrLf
  127.                 PrintOrderNumberReplacemnt = PrintOrderNumberReplacemnt & "`sh,sw" & vbCrLf
  128.  
  129.  
  130.                 'Print Order Number and Order Number Charge is the same except the starting test
  131.                 ' So we just build the body and #(end if) the same. Set the  PrintOrderNumberReplacemnt
  132.                 ' then add the appropriate test to the start
  133.                 PrintOrderNumberChargeReplacemnt = PrintOrderNumberReplacemnt
  134.                 PrintOrderNumberChargeReplacemnt = PrintOrderNumberChargeReplacemnt & ""
  135.                 PrintOrderNumberChargeReplacemnt = "#State,=,1" & vbCrLf &
  136.                             "&paytype,<>,201" & vbCrLf &
  137.                             "&paytype,<>,202" & vbCrLf &
  138.                             "&paytype,<>,203" & vbCrLf &
  139.                             "&paytype,<>,701" & vbCrLf &
  140.                             PrintOrderNumberChargeReplacemnt &
  141.                             "#" & vbCrLf
  142.                 'PrintOrderNumberReplacemnt = "#State,=,1" & vbCrLf & PrintOrderNumberReplacemnt
  143.                 'Print Order Number Chit Replacement
  144.                 If PosMaint.PrtExpoNumberPriName.ToUpper = "NONE" Then
  145.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "#State,=,1" & vbCrLf
  146.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "&destination,<,3" & vbCrLf
  147.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "`cut" & vbCrLf
  148.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "`dh,dw,c" & vbCrLf
  149.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "#SeatEXPOnum,#,0" & vbCrLf
  150.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "`FontSize1" & vbCrLf
  151.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "Group Order" & vbCrLf
  152.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "`FontSize3" & vbCrLf
  153.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "~SeatExpoNum~~TotalTrayItems,3~" & vbCrLf
  154.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "#BusSeatModified,=,1" & vbCrLf
  155.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "`FontSize1" & vbCrLf
  156.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "!!Tray Count Change!!" & vbCrLf
  157.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "`sh,sw" & vbCrLf
  158.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "#" & vbCrLf
  159.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "#else" & vbCrLf
  160.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "`FontSize3" & vbCrLf
  161.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "~ExpoNum~~TotalOrderItemsPlusChildren,3~" & vbCrLf
  162.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "#" & vbCrLf
  163.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "#destination,>,1" & vbCrLf
  164.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "`dh,dw,c" & vbCrLf
  165.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "" & vbCrLf
  166.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "**********  To Go   **********" & vbCrLf
  167.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "" & vbCrLf
  168.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "#" & vbCrLf
  169.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "`sh,sw" & vbCrLf
  170.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "#" & vbCrLf
  171.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "<item>" & vbCrLf
  172.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "#itemnum,=,300001" & vbCrLf
  173.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "`FontSize1" & vbCrLf
  174.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "** Order Changed **" & vbCrLf
  175.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "`Sh,Sw" & vbCrLf
  176.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "#" & vbCrLf
  177.                 Else
  178.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "#prtr,=,Grill1" & vbCrLf
  179.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "&destination,<,3" & vbCrLf
  180.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "`dh,dw,c" & vbCrLf
  181.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "#SeatEXPOnum,#,0" & vbCrLf
  182.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "`FontSize1" & vbCrLf
  183.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "Group Order" & vbCrLf
  184.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "`FontSize3" & vbCrLf
  185.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "~SeatExpoNum~~TotalTrayItems,3~" & vbCrLf
  186.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "#BusSeatModified,=,1" & vbCrLf
  187.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "`FontSize1" & vbCrLf
  188.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "!!Tray Count Change!!" & vbCrLf
  189.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "`sh,sw" & vbCrLf
  190.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "#" & vbCrLf
  191.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "#else" & vbCrLf
  192.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "`FontSize3" & vbCrLf
  193.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "~ExpoNum~~TotalOrderItemsPlusChildren,3~" & vbCrLf
  194.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "#" & vbCrLf
  195.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "#destination,>,1" & vbCrLf
  196.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "`dh,dw,c" & vbCrLf
  197.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "" & vbCrLf
  198.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "**********  To Go   **********" & vbCrLf
  199.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "" & vbCrLf
  200.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "#" & vbCrLf
  201.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "`sh,sw" & vbCrLf
  202.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "#" & vbCrLf
  203.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "<item>" & vbCrLf
  204.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "#itemnum,=,300001" & vbCrLf
  205.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "`FontSize1" & vbCrLf
  206.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "** Order Changed **" & vbCrLf
  207.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "`Sh,Sw" & vbCrLf
  208.                     PrintOrderNumberChitReplacment = PrintOrderNumberChitReplacment & "#" & vbCrLf
  209.                 End If
  210.             End If
  211.             'End   Fix for Tray Chit
  212.  
  213.             'Build Register PrintForm String and Preform register replacment
  214.             Dim RegPrintForm As String = OrgPrintForm
  215.             PrintFormReplacment(RegPrintForm, ReceiptHeaderBitmap, ReceiptHeaderBitMapReplacment)
  216.             PrintFormReplacment(RegPrintForm, PrintOrderNumber, PrintOrderNumberReplacemnt)
  217.             PrintFormReplacment(RegPrintForm, PrintOrderNumberCharge, PrintOrderNumberChargeReplacemnt)
  218.             PrintFormReplacment(RegPrintForm, PrintOrderNumberChit, PrintOrderNumberChitReplacment)
  219.             PrintFormReplacment(RegPrintForm, TrailerBitMap, TrailerBitMapReplacemnt)
  220.             IO.File.WriteAllText("c:\iris\reginfo\reg" & RegInfo.RegisterNumber & "\data\Print.frm", RegPrintForm)
  221.             Sleep(10)
  222.         Next
  223.         IO.File.Copy("c:\iris\data\print.frm", "c:\iris\reginfo\common\data\Print.frm", True)
  224.     End Sub
  225.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement