[Solved] Saving & Recalling A GridView from a file
Posted
#1
(In Topic #1318)
Enthusiast

I was just wondering if anyone know a smarter way to store a gridview to a text file and then recall it again
Basically what I need to do is sometimes I have to store a transaction on my Point of sale and I am using the following code
Code (gambas)
- CreateDataFiles.StoreSaleToNetwork(ItemType, Barcode, SaleMode, QtySold, PriceOverride, PriceOverridePrice, UnitPrice)
And this works great BUT if I have a discount on the item example
DVD SALES £10.00
10% Disc -£1.00
That is all stored inside the same row and when the above code read it is it errors out at Dim UnitPrice As Integer = (Val(ToWorkOn) * 100)
This is the code I am using to Create the GridView when my systems loads up
Code (gambas)
- With frmSalescreen.GridCurrentSale
- .Columns.Count = 11
- .Columns[0].Width = 550 'Description
- .Columns[1].Width = 125 'Price
- .Columns[2].Width = 25 'Discount Exampt
- .Columns[3].Width = 30 'VAT Code
- .Columns[4].Width = 0 'Barcode Number
- .Columns[5].Width = 0 'Healthy Start Voucher Ok
- .Columns[6].Width = 0 'Qty Sold
- .Columns[7].Width = 0 'Item Type
- .Columns[8].Width = 0 'PriceOverride
- .Columns[9].Width = 0 'PriceOverridePrice
- .Columns[10].Width = 0 'GT Message Needs to be printed (this is the GT number)
- .Columns[0].Alignment = Align.BottomLeft 'Desciption
- .Columns[2].Alignment = Align.BottomLeft 'Discout exempt
- .Columns[3].Alignment = Align.BottomRight 'VAT
- .Columns[4].Alignment = Align.BottomLeft 'Barcode Number
- .Columns[5].Alignment = Align.BottomLeft 'Healthy Start Voucher
- .Columns[6].Alignment = Align.BottomLeft 'Item Qty
- .Rows.Count = 0
The columns that are 0 width are used by my system in other areas when the sale is completed so i would need to store the completed grid (and ideal if I update the grid in the future to hold other triggers to have them store as well)
The way I am loading the files back into the system at the moment is as below
Code (gambas)
- 'used on the Weston Uniton recall
- 'item type
- 'IT For item
- 'DE For department
- 'ES For Electric service
- 'WE For Weston Union
- 'HE For Health Lottery
- 'PO For Payout (Description would be used for the payout)
- 'LO For Lottery
- '1,I,50201600,Sale,1,65,0,0042
- Line Input #Global.RecalledSaleFile, LineData
- ItemType = Global.LineMessages[0]
- BarcodeNumber = Global.LineMessages[1]
- ItemMode = Global.LineMessages[2]
- ItemCount = Global.LineMessages[3]
- PriceOverride = Global.LineMessages[4]
- PriceOverRideValue = Global.LineMessages[5]
- UnitPrice = Global.LineMessages[6]
- Case "Job"
- Global.JobNumber = BarcodeNumber
- frmbackground.btnEnterJobNumber.Caption = "Job Number " & global.JobNumber
- global.SaleMode = ItemMode
- global.ItemQty = ItemCount
- Global.AgeValueLastUsed = 1
- DatabaseModule.SellProduct(BarcodeNumber, "Recall")
- global.SaleMode = ItemMode
- global.ItemQty = ItemCount
- SalePrice = UnitPrice
- SalePrice = (UnitPrice / ItemCount)
- Case "ELEC"
- ElectronicServices.ElectricKeyProcess(SalePrice, "Recall", Global.AddOnServericeVAT)
- Case "GASP"
- ElectronicServices.GasKeyProcess(SalePrice, "Recall", Global.AddOnServericeVAT)
- Case "MTUP"
- ElectronicServices.MobileTopUpProcess(SalePrice, "Recall", Global.AddOnServericeVAT)
- Case "Bill"
- ElectronicServices.BillPaymentProcess(SalePrice, "Recall", Global.AddOnServericeVAT)
- SendAmt = SalePrice
- SentFee = SalePrice
- WestonUnionModule.SendVaulesToSalescreen(SendAmt, SentFee, "Recall", global.WestonUnionVAT)
- ElectronicServices.HealthLotteryProcess(ItemCount, "Recall", Global.AddOnServericeVAT)
- DatabaseModule.SellProduct(BarcodeNumber, "Recall")
- Global.RecalledSaleFile.Close
- Kill FileName
- frmRecallFromNetwork.Close
- Menu_Salescreen.SaleScreenMenu
- frmSalescreen.SetFocus
I am sure someone smarter them me would have a idea how I could streamline this process or even a way I can just store the discount so it would work as well when recalled (as that is the major problem as I can not tell a customer they can not store a sale if it is any discount applied to any items)
I am 100% open to ideas and way to store this data as the best I have come up with still is not working 100%
Kind regards to everyone
Andy
Posted
Guru

Hopefully it will give you some ideas.
<IMG src="https://www.cogier.com/gambas/Shopdata.png">
</IMG>
1 guest and 0 members have just viewed this.



