How to Create a Point of Sale Application in C# - Full Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi and welcome to c-sharp tutorial of point-of-sale application okay let me show you guys how this works i can always select any of the item that had no required and remove from the list and check out the price there let's remove one or two more look at that and we can even reset the whole lot there we go and enter new product in there and you can also see the barcode okay taking account of the sales that have been put together and here we can select cash and maybe let's select amount and click on pay and guess what we can even print it if we want print out the resets that is it right there i'm going to exit out of the receipt because i don't have a printer there we go okay and what else can we do we can just reset again or delete whatever we want to delete from the system and just get rid of that there and you can see the change given is changed and let's reset and use some other payment method and you guys see what's going to happen there we go that is it select another different types of payment method and that's it right there let's tell you well you're paying by visa so you've deposited nothing and that is the amount you pay okay guys let's start work with the new tutorial so i'm going to close this and i'm going to then click on create new project okay make sure c sharp is selected on the template and let's select next and right there i'm going to give my project a name just going to call it cs and score point of sales there just click on create okay now that my development environment is ready i'm going to come in here straight to the properties and let's change that to 1386 by 788 press enter there now the next thing is to come straight to the toolbox and let's select hana grab the panel and i'm going to change the appearance of that panel to let's go straight to the model style and let's change that to fixed 3d now grab the upper panel drop it right there and set it about that much and right click and grab another one bring it all the way over there i'm going to need this one just extend the this one that much and i'm going to need three of them for underneath here all right that's good just drag it that much all the way right and repeat the same thing for these okay now that that is done you notice there's no panel here right here i'm going to go back to the tools and i will then select [Music] data grid view drag that and just dump it right here somewhere there there and let's change the back color oh first of all let's come in here let's just edit it i'm going to add yeah let's add item item click on add the next one is going to be quantity click on add and followed by amount there we go all right add that and that's all there is to that click on ok there i'm going to change the back color let's come right in i will change the back color to something a little bit brighter okay that would do and right underneath here i will add a label all right down let's grab a label there we go that's my label there drag that label that much and change the color of that very label to background white background of it is going to be something brighter and change the border style to fix 3d auto size change that to force and there we go that's my label there scroll right down get rid of the text content in there now the next thing before i proceed is to change this very label the fonts in there will be a barcode now to get a barcode fonts what you guys you have to do is to go to the fonts the phone.com okay right in there you can download the barcode i will include the url the url of these fonts website to your to my description area so that you guys can download your own fonts there the barcode and i would then go for the one with the c right here let's download this very one here yeah this one this little one let's click on download there i've downloaded it and right in here and there it is so all they need to do is just double click on it and get it installed click uninstalled and that's all you need to do okay i've already installed it on my system so i'm going to exit out minimize this so select my label and come right here you see where we have our properties now come right there you see the fonts click on the font and let's change the phone type to barcode that is it right there just look for it and say that's the one you want click on ok and there we go so this now has a font and you can just give it a name barcode barcode there we go that's the name of that that's taken care of the next thing is let's grab some buttons we need about okay so we need okay all together this 12 here and i'm going to need another we're going to have to increase the front of all that all right so bring this that much just drag it here i need about 24 here that's 12. hold on to your control click and drag there all right looking good now underneath dta i'm going to now add another panel and further need three of those come right down here grab a panel drag it that much and change the appearance to border style make that fix 3d that is fine there bring it down now we need labels come right here we need one label here and let's change the details of this very label to something readable make that bold and i'm going to make that about maybe 24 for now and then just hold on to the control click and drag i'm going to select it all okay let's paste it individually another one and another one there okay these ones i'm going to change the appearance too let's come into both the style make that fix 3d and it's going to be white something brighter really and here the that is one here and i'm gonna repeat the same thing there we go all right i'm gonna make a copy of this okay and one more here paste there we go right but here i'm going to need some buttons let's delete all of these off and we'll grab some buttons in there delete delete and delete now let's add some buttons here come in here add one i need another one and then okay so i have my buttons in place so if i run my program right now this is how it's looking so i'm now going to just kind of like speed up the design of the whole interface let me just show it to you guys this is how my interface is looking so i need to tidy up a little bit so let's close that now let's come in here select the button okay and i didn't need to go to the picture i think yeah it should be a property called picture or image yeah image open up that and let's locate where my images are all right here are my images i need this in there click on ok there we go now repeat the same thing for this other one and let's come in here where's the other one this one click on that let's pin this down image and let's look for something cappuccino in there something milky cappuccino whatever yeah grab that and so on guys and here i'm just gonna add just because i'm gonna i intend to speed that up i'm gonna change the font here let's come in here change all of the fonts to something readable make that about 24 bold there and this is just going to be numbers all right so the first one is going to be seven seven eight let's do that again select that that's seven and this is eight this is nine and the next one here that will be four five six we have three two one zero decimal and then so that is already now and we just need to finish up with these now so let's enter a coffee image there let's go for the black one black coffee import um right there there so i'm going to speed that up and get back to you guys shortly all right guys this is how my interface is looking now there okay but let's add let's add a value to the other text box then i'm going to add a zero in it align right and let's add some other components okay print no let's go for print document and print preview yeah just those two i'm gonna get rid of this one print dialogue get rid of this little one delete that all right print document one and print preview select the print preview come straight to the property here you see where we have document change that to print documents there so that one is taken care of okay okay before we do anything let's we might as well just take care of this print button so i'm going to double click on the print button itself just double click on it and up here let's declare the following or call the following objects bitmap i'm just going to call it bitmap there and enter semicolon and right underneath inside the procedure area of that very button itself right here so i'm going to enter the following let's say height equals data review dot height there okay now the next thing is data review dot height let's copy that and just paste it here dot height that will be equal data grid view equals data review dots row and count dot row and count and let's let's multiply that by multiplied by that datagridview dot row template row 10 and dot height dot height i might multiply that by two okay so what i'm trying to achieve is to kind of like take more or less a screenshot of the receipt so the next thing is going to be let me get hold of this my object here called bitmap bitmap is self equals new bitmap and this new bitmap is going to have the width let me enter the width of this data grid view there copy that paste that in here that width there and this width we also need the height of the data grid view itself let me grab this and paste it here okay so take the picture of the width the picture we're taking would be the picture the width and the height of the data preview now let's come right down here and then say the top review itself we now want you to draw to bitmap so indexed dot draw to [Music] bitmap there then we then say beats map comma is going to be in a tr a rectangle that's a rectangle very triangular rectangle and set the coordinate for it is going to be zero by zero that's my coordinate and that is going to be the coordinates of my data review enter data review there that width and the height so grab all of these then copy that and just paste that in here and here enter semicolon okay getting there now one more thing we need to do is to call the print dialog okay say print print preview download we now want it to dot print preview control control and dash zoom [Music] equals one okay you can make yours too i'm going to set you for one then the print dialog one i want and i want you to show the dialogue itself copy that paste it right here print dialog dot show dialog and enter parenthesis now we now want the data review height it was this very height over there equals height grab that paste that right here into semicolon so that takes care of the lines of code for my print button now now when i need the document the other thing is to be on the safe side i think it's advisable you guys enter something like you know try cash so i'm just going to drag that in there all right so let's enter a statement underneath here before i go to the next one so the couch is going to be as follows so come right down here press enter push and that will be exception ex press enter there and i'm just going to show a message message box that show dot show and what am i showing it's going to be ex dot message so if there's any problem the system will handle that for me yeah okay i'm going to just let me grab this and grab that and now let's go straight into our document here this very one double click on the document and now enter try cache and right underneath try cache copy this just write that paste that right underneath there and here now we now want to enter the following message e dot graphic dot draw draw image that's what i want to draw image and this image is going to be in the following that's going to be in the following coordinate zero it's a bitmap and the coordinates is going to be zero by zero and right here i'm just going to enter semicolon and that's all there is to that okay all right take a good look are the lines of code for the print buffing there and right underneath here that is the print document just this very one i only just entered try cash all right let's run that and see how that's going to look like now let's assume we have whatever value in here so i'm going to now try that out click on print and there we go look at that more or less took the picture just scan it and paste it right in there okay close that now that is done let's take care of this resets then we take care of these two these two will require some function but let's take care of this one first ah maybe grab all the try cash again just grab them all come right down here double click on this one and paste that in here and delete this very one delete that there we go and the very first one is going to be btn that's a btn yeah get rid of that dot text equals i'm gonna copy this and paste it for the others now i have btn paste btn change the btn subtotal paste btn tax now btn total paste the other one that i'd like to get rid of is going to be data review dot room rules okay there we go there i will also refresh the data preview as well let's grab it and just refresh it come down here dots refresh you don't have to do that i just want to do that do it for my own use okay that's that done now finally i'm going to also take care of my google box combo box dot text equals clear there we go and that is it all done that takes care of my clair function now let's do one more thing see here double click on that and i want to change these that will be for the combo box copy the combo box that's going to be the item inside the combo box dot items dot add and the very first one is going to be cash there now we need two more copy that paste paste and this one is going to be visa card and finally i'm going to have this as mastercard there we go so if i run my program this is how it's going to look like so run there so i can now select any of the type of payment that i want okay that's good i'm going to log off and let's go straight to my interface right here there's one thing i like to do it looks a little bit plain let me just select the phone go to the properties and i'm going to change the back color of the property to get it blue so just type in cadet blue in there there we go right let's see how that is looking now okay with the cadet blue in that's how it's looking and maybe i should even change the back color of all of these as well okay let's do that and i'm going to select it all so like these this little one here and this let's go straight to the properties and just change that okay that blue as well there i think that is much better so let's select it all i'm just gonna push it up a little bit okay i'm gonna set you for that now you see these buttons i want when i click on these buttons this button should show the amount the customer is depositing now let's do that so i'm going to first of all move this button down a little bit because it all seems to be way way up there okay let's select all of these both things and i'm going to select the zero and the decimal number as well and let's go to the properties here let's go to events and i'm going to select event click let's give her the name i'll call it numbers only press enter okay and right here i'm gonna create an object i'll call it button let's say button b and that is going to be equals open a bracket button close the bracket is going to be using the sender there now let's use an if statement if lbl cache that is the name of the label i intend to enter the customer deposit equals equals zero if you notice i have a zero in there i'm now going to say if it's equals equals zero then lblcash.txt equals less clades clear whatever we have in there first and ldl cache equals b dot text okay right that is for whatever we have in there okay now the next thing we want to do is we want to use else if because we have the the decimal point we say else if if b dot no undo that if b dot text copy that equals equals the decimal point okay let's put that in a bracket and this in the brackets as well then you want as follows all of these grab that lblc equals lbl text plus whatever we have inside b there okay so that is if it is and that's my place okay oh there should be another if statement sorry so i'm going to grab this if because it's not going to work this way if that can move this here there and here so that means if not if not lbl text dot contains the decimal point then i want this to happen then if you allocate a decimal there okay then come right down here and right below here okay we didn't say else we now want this we're gonna assume that is going to be for the text there i think that should take care of that yeah i can't see any error so i'm gonna have to run it and just see how that's gonna look like so let's click on run there and we click on this you see that we can enter whatever value one day let's see this works now let's see what i've done wrong yeah i think this might be the cause let's take that off yeah okay now i'm going to try it again let's run it click on run i think i'm going to end up with the same error though but there's something i've spotted oh the clay is not working yet okay it's working now but here you see here that is supposed to be if not lbl crash this very one year l e l cache the text if not lbs the text that contains that okay and this equals this okay yeah that's logically correct now so let's run that and see again and that's it so let's enter something in there and click on that again so that is fine my decimal point is now working fine so let's take care of the clay i'm just gonna grab this i'm right here double click on clear is that in there that takes care of declare function that is fine now i now need to create a function here so let's go right up there i'm going to move right up there so have a good look at these lines of code for now that's just for the button that is for the form load clear or reset and for my print part of the print and right underneath here i'm going to create as follows so let's create a public public class in here so i'm going to say public public double and that is going to be known as cost of underscore item so that is the name of my function course underscore items within s and i will now enter the following i'm going to say double okay that is going to be sum equals zero there that is the double and the next thing i'm going to play is going to be integer let's say i equals 0 as well then i'm going to use a for loop let's say 4 let's change this one to of case d let's say 4 i equals 0 and i that is going to be less than data grid view data review dot rows dot count the entire second column right there okay and i'm just going to say i plus plus okay so i have my very first let's cover this here as well right and semicolon here they already have a semicolon so that's fine but here i need to enter a semicolon okay so that's good so the next thing i want to now do is i'm going to open up the curly braces for that now say sum equals sum plus convert dot to double and what are we converting to double that is going to be data review dot row dot rows and open up an array close that dot cells and that would be an array as well and that is the second column the second column of my data review dot value right and close this right here okay now what else do we need to do let's respond some we return some that should take care of that so let's say return okay so that's my very first function taking care of let's do one other thing i'm going to declare another one that is going to be a private one so let's deprive it let's avoid add cost close now for art course i'm going to create double as well then i'm going to add tax in there so let's say double that is going to be tax coma and the value for the tax is going to be let's initialize the tax with about 3.9 that's the taxi paying there we go all right so now let's use an if statement so we can let's just grab all of these and we'll grab that with my if statement underneath here if this is less than zero no greater than zero okay yeah that's correct come right down here open up the coily braces in that case lbl tax dot text equals let's convert that to string.format converting it to pounds so i can use a pound sign then i'm going to enter speech mark coil braces and that is going to be zero column zero column two c two that should give me the pound sign that i want okay depend on your own currency sign so in here let's say okay cost cost of item cost of item i want to multiply that 5 times and i then want to divide it come right here divide that by 100 so that will give me my tax value here all right so that is fine that is clear that let's see i have one here one for this one for this one for this okay that's fine all right now let's do the same thing for subtotal i can just grab all of these and come right down here ldl subtotal paste in case of subtotal i'm going to get rid of the tax yeah let's get rid of the tabs this very one we have to go delete and delete these as well and what is we need to delete one of these now we should leave that and delete how many do i have in here get rid of all of this let's take care of the key i'm going to assign a value to q and i'm going to say q equals that as well there now let's go for lb of total ldl total in the case of lbl2 no that should be lbl total the text equals i'm going to grab all of these all of these here and i will add q to it yeah copy that paste that right in here and let's add key plus key right underneath here cross q there and that takes kit of total now i also need the lbl barcode in the case of ldl barcode i'm going to have to say dot text and that will be let's convert that to convert to string dot to spring and that is going to be q plus cost of items grab cost of items i'll just place that there enter semicolon here we need to enter equals here i think that's it so that is taken care of all right now let's take care of the change itself this will take care of my calculation of tax subtotal and total and this will just display ordinary barcode in the case of the very first one here the very first function this function is just to determine which of the column i'll be using for calculation which is column number two so column number two officially the columns is column zero one and two there are three columns in there so i'm using column number two for my calculation okay now i'm going to create another function here we'll just call that public void maybe change because we're going to be it's going to be giving out change so let's enter change in there there we go in the case of change let's move this up let's grab all that we have in here for the change i'm going to grab all of these let me grab everything and just take care of what i don't need now do this first copy this paste it right in here and bring that down and close this okay that is error and in here maybe enter another variable c the tax is there already okay let us review that roll is greater than d so in that case q i'm going to need q let's grab this q here place q there so this is the value of q okay so this is the tax but in this case let's add let's add the cost of item to eat as well okay plus because of item day okay so that is the total of everything so the tax plus because the python will give us the total cost now i'm going to then say c equals whatever we enter which is whatever we enter from our buffers that we created so let's convert to okay instead two so let's then say lbl cache dot text there so that takes care of that so when i click on those buttons whatever number i entered is stored right in here right okay this should be uppercase t now let's see so now get the total is going to be no we need to subtract this from this to get the change so let's come down here and say lbl change the text dot text equals convert dot to format open up a bracket and grab all of these i hate typing those out put them in here and it's going to be c you know this lowercase c minus q and that's it enter semicolon here and that is k of the change so the function for change is taking care of every single function that i need is there okay this is the very first function that will determine the rows where the calculation will take place now the second function is to carry out all of the calculations and the third function right here that we're going to be using that for change all right we can just call this one right away inside the in here let's go to pay so when you enter whatever in there the pay will determine oh let's see this let's move all of this down a little bit and this one's need to come down as well okay right inside pay so double click on pay i'm going to use an if statement if combo dot text equals equals then i want to call change there we go i've just called that function now else and i want ldl change dot text equals player and cache should return back to zero so okay i've taken care of hey now we have this one two it's taking care of three so what is left is this now let's come in and double click on remove item yeah in the case of remove item i'm going to use for each for each data [Music] review it's a view for each disagree view role and let's create a small object there down the road in these dots data group v1 that's my data review selected rules selected rules so for each of that in there and i want it to remove so little review one there we go that is to remove the row and once the roll is removed i now want the add function again this add add cost on that function called once that function is called i might as well grab my okay the cache will do something i'm just going to grab all of that and just paste it right underneath here okay and that takes care of my remove but none of these will do anything because we have to be able to click on those buttons to be able to put all these calculation in pro in progress really see there's nothing happening here so all these ones are just a waste of time see nothing is happening so clear oh when i play when i reset i want this one to come back to zero okay if we say remove okay there's nothing to remove so there's an error okay so we take care of that now anyway so let's come back in and let's see this one should be this is car shopping this is double click on reset clash equals zero now each of these buttons so let's enter some lines of code in this so when i click on this button i want the item to be displayed in here double click on that so right in here i'm going to first of all um create a data type that will be double and this double is going to be cost let's call it cost of items cost of item equals 230 there now let's use the for each statement the might as well grab it's right here just grab it right there grab everything come right down here and just paste it right underneath here there we go now i'll then use it for an if statement again okay here let's move this one right underneath here and i'm going to come back to that on here i'll use an if statement if now we have to use boolean if boolean it was true okay dot cells is the verb first one dot value equals let's say the cops coffee if you have coffee we want the system to do as follows so what i want the system to do with the days okay if it's for the if the cup coffee do as follows right there let's undo that and see what i've just done okay that's fine okay clap copy to become rules dot cell cell rule that is going to be the first one the second one i mean that value the value equals equals double dot pass and what are we passing is going to be let's pass it as a string string row dot cells and these cells in this case is going to be the next number the second one dot value plus one plus one there okay now let's repeat the same thing again for the second one i'm going to copy all of these and paste it right in here so this will become number two so we have zero the very first one the second one the third one okay and in this case this will be one multiply this by this to give us the cost grab that come right here okay all right that is fine so now let's come right down here and just say add the cost add cost parenthesis okay let's take care of this let's enter a bracket in it all right then now let's take care of this one now we now need to add the name this very name we need to add it straight into the row here so all i just need to say is row.add and what am i adding and adding that comma i also want to add the number which is how many that would be one then comma i also want to add the cost of the product grab that and paste it right here just depth any column and that's all there is to it i can just move this one let's move this one right underneath here there okay that's all there is to that so let's get rid of this let's take care of this error there and delete this one there we go all right that takes care of my very first item so let's see if it's going to work run it and see now click on that there we go first item you see automatically calculate the cost as well you see that guys that is good and you can also see my barcode there that is fine so we can select and start removing now yeah you see remove item is working as expected there okay reset brilliant so all that all i'm then going to do is copy all of these copy that and come right here to the second one double click on that the price of that is one pound 90 and changes to 190 and the name of that very high item is see call what is it called this is called okay and that one maybe we just gender to cappuccino so the one with the 1.90 i'm going to change that to cappuccino apple chain or double c right okay and i also need to change this to cappuccino as well come right here change this one to cappuccino there guys so the cost the name of the item let's run and see okay there we go cappuccino there and there so both of them are working and now grab this come on to the next one double click that one it's 90p we can just call that black coffee so come right here that is 90 and change this to black coffee that is easy so you grab that and paste it right in here that is fine now the next one the next one will be okay paste that and that one might be chocolate drink the name is there and i will grab the name and paste that in here check the drink change that and the cost of chocolate drink one that's two pound plus 2.59 right chocolate drink is taken care of now grab those lines of code good for the next one the next one is the original coffee double click on that three pound plus 395 3.95 original coffee ordinary coffee paste that's in there okay it'll be the same thing here there now the next one is 393.75 okay we need we actually need to grab all of these grab that place that's in here that's 375. chain the seven and that is supposed to be chocolate lighten paste there repeat the same thing here paste there okay so i think i've taken care of six yeah that's good so that's right and you guys see how that looks like then we can speed up the rice it's exactly the same lines of codes anyway so let's write and see there we go guys there we go there's the chocolate latte now coffee uh chocolate drink black coffee cappuccino copper coffee there guys it's working as expected apart from this app and already yet so i'm going to now speed that up since you guys get the whole idea but before that let me just show you one show it to you once more so i'm going to double click on these okay and now grab these lines of codes here the same lines of course come right down here paste it right inside the procedural area there and this one is called mixed orange mixed and orange mix here change the name to orange next and change the name here to orange next as well now one last thing we need to know the name is the price is one pound 20p so come right down here and change that to one pound 20p there that is how is done okay i'm now gonna speed up the race and get back to you guys shortly okay guys i i'll finish with the coding so that is it for every single buttons as the last one there we go you see as you can see they are both the same lines of code above the only difference is the price of each item and the names of the item there so that is it i have 24 you can have nine okay so let's run it and see how that's going to look like there we go now decision time so let's select any of these items yeah you want these there we go look at that it's working as we want there and maybe you don't want any of these okay i don't want that to move i don't want this there and let's say the customer intend to pay with cash let's enter the cost in there 50 pounds customize paying click on total there we go if you subtract this from this i should give you 50 pounds with that guys i'm going to call you the end of this very lovely c-sharp tutorial of point of sales application and i'm just gonna call it the end of this tutorial and please do subscribe to my channel and you can also join to become a member of the channel there's a lot of benefit for you as a member and for my members i'm going to say thanks a lot for all your help thank you and you all have a nice day now bye for now
Info
Channel: DJ Oamen
Views: 45,901
Rating: undefined out of 5
Keywords: How to Create an Advanced Point of Sale Application in C#, How to Create an Advanced Point of Sale in C#, Create an Advanced Point of Sale in C#, Advanced Point of Sale in C#, How To Create A Powerful Point Of Sale (POS) Application In C#, POS in C#, Point of Sale Application in C#, Purchase Sale Application
Id: y13C9jn1n6Q
Channel Id: undefined
Length: 64min 27sec (3867 seconds)
Published: Fri Jan 01 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.