How to update stock quantity - vb.net

VB.NET
Well, I'm using Access as DB containing five tables viz. Vendors, PurOrder, Customers, SalesOrder, Stock.
Vendors: VendorID(PK), Name, Contact, Phone, Address.
PurOrder: POID(PK), Items, Quantity, Rate, Total
Customers: CustID(PK), Name, Phone, Address
SalesOrder: SOID(PK), Items, Quantity, Rate, Total
Stock: SItemID(PK), Items, Quantity, Rate, Total
I'm using the Database Wizard in VB.NET Express. I do not need to code for that. I click on Data Sourses > add the Database > Drag that to my Purchase and Sales form and that automaticaly creates the ADD, DELETE, & SAVE as well as Navigation buttons as toolstrip. and furthermore I drag the Purchase order table (for example) to the form in Datagrid mode and that's it! Now, I can SAVE, DELETE, & ADD records to my database as Purchases.
Well I am able to enter and save/update purchase and sales vouchers and retrieve the reports Customer/Vendor ID-wise and print that.
The only problem I have is that I don't know what to do in order to automatically update the sock quantity when purchase or sale is made.
Thanks in advance.

In many other mainstream database software, they support Trigger, which achieves your goal (automatic update the purchase count). Consider using other database software, as MS Access's performance is not so good.
To answer your question, you have to do an extra query to update the value.

Related

Need item selected from drop down to compare a quantity of that item and update table

So I've been building an MS Access database for our business to track repair tickets and other info. I'm almost finished with it, but want to add a function based on a selection of a drop down.
I have a table with items listed that we use for repairs, along with an on-hand quantity. Within the repair ticket form, I want to be able to select an item from a drop down, compare the on-hand quantity of that item within the table, which will then determine the next steps. Essentially, if there is an on-hand > 0, then the status of the ticket changes, as well as update the quantity of of the table (like if on-hand = 25, selecting that item automatically removes 1 from the quantity, making it 24, etc.). In addition, if the repair isn't approved, it should obviously add 1 to the quantity since that item wasn't used for that repair.
There is already a drop down that populates the item to the repairticket table, and want to use the same drop down for the added function, if that makes any sense.
I can write the code for status changes and whatnot, but don't know how to make it compare the quantities and update the separate Item List table.
Any help and guidance would be much appreciated!! And thanks in advance!!
-Andrew

Adding new product with category tree - specific price problems

I installed an add-on for bulk action (called ba_importer v 1.1.24), I upload an Excel file with my data and create a group of products.
I can set the categories' tree or manually add ID of main categories and associated. I tried with no luck to use the tree features (like Home/Products/etc) and so I use all the ID of main category and all the associated. The result is a product with the correct categories set, but with no specific price from the customer group linked to a category.
I tried to edit a single product, remove all categories and set it one by one (set one, save, set one, save etc.) and then the specific price from the group linked to a category appears to the product.
Is there a better solution? I'm thinking about make a personal PHP page that reads an Excel file and sets all the information about the product, but I'm scared to face the same problem with the specific price. 
There is no such thing as "category-related specific price",
if you have specific prices tied to customer groups , these are created as a result of the add/update product action with ps_specific_price DB entries having id_group with your restricted ID.
It is likely that the bulk module acts directly with DB queries to speed up things and bypasses this operation, I've seen this behaviour with those kind of modules in the past.
Since you are talking of a paid add-on, I would definitely seek help from the developer.

Does transaction locks the row to prevent the data inconsistancy

I am new to MSSQL and creating a website where Customers can place orders.
Each order may have multiple items with any number of quantity.
I am interested in before saving my order to check if the desired quantity is available for each item, if yes then I will place the order and update the items inventory, otherwise I want to rollback.
But at the same time I want that any other order should wait till first transaction is finished. So that up updates don't overwrite the changes and produce inconsistency.
If each order is processed within a transaction, is it enough or do I have to consider something else too?
If you go on any Online retail website, you will notice that you go through the shop, buying stuff (not actually buying but being added to a basket) and once you have completed your shopping you go to Checkout that is, where you are asked to provide payment details etc.
So the idea is, the website shows everything (that has at least 1 stock item) to every customer, At this point no item inventory is being updated or inserted, at the checkout stage a complete order is compiled and submitted to system, (at this stage you will do the actual updates/inserts to item stock inventory) now how you want to handle the orders is entirely up to you.
Do you want to rollback entire order when any one item has less stock than
the quantity ordered?
Do you want to commit all order lines and only rollback those order lines where the items has less stock than quantity ordered?
Or do you want to place a provisional
order regardless of the stock availability and manipulate the delivery date?
Depending on what path you chose to go with (this should be a business decision a developer shouldn't be making these decisions) there is a lot of flexibility, but one thing you never do is as soon as someone has select to buy an item, you update the inventory. All this should be done right in the end of the Purchase process and all should be done at Once.

Sql Transaction for POS

I am developing a POS for a pharmacy the scenario is like this:
1. a user select category and then Item, then the item will be pass to DataGridview, the use can increase and decrease the value of item.
2. the user select customer and other necessary information.
3. the user press the pay button and all insertion to stock, account register, sales invoice will be done in back of this pay button.
P.S: this system is multi User, mean Lan based.
Now, my question is that, I am trying to tell that system that check with still no changes come to qty of item in stock, if come rollback else commit.
Can I use Sql Transaction or no?
Thanks in Advance for answer.

MS Access tables that need to be in the listbox

OK, I have the worst VB class in the world. The friggin textbook has you do programming projects but the stupid book doesn't even explain everything required for the project. Oh yeah, the professor for the class doesn't help worth a crap (online schooling).
So needless to say, I have been struggling with the class for a very VERY LONG TIME...
Well, here's my request:
Here is visual representation of what is required
Now, I have been fighting this thing for MANY MANY hours and would like some tips and advice on how to get this stupid thing done. I usually get more specific when it comes to posting in this website except this time, it seems like I have a problem with EVERYTHING!!!
Here is the instructions:
"The database Microland.accdb is maintained by the Microland Computer Warehouse, a mail-order computer-supply company. The tables below show data in the three tables in the database. The table Customers identifies each customer by an ID number and gives, in addition to the name and address, the total amount of purchases during the current year prior to today. The table Inventory identifies each product in stock by an ID number and gives, in addition to its description and price (per unit), the quantity in stock at the beginning of the day. The table Orders gives the orders received today. Assume that it is now the end of the day. Write a Visual Basic program that uses the three tables to do the following two tasks:
Display in a listbox the items that are out of stock and those that must be reordered to satisfy today’s orders.
Display in a listbox bills for all customers who ordered during the day. Each bill should show the customer’s name, address, items ordered (with costs), and total cost of the order.
So, if any of you VB geniuses would like to tell me how to do some of this stuff, that would be absolutely awesome. Any kind of help will definitely make a difference for me.
(I'm assuming it's VB.NET) Here's some pointers on the bigger picture, you'll need Google to fill-in the details:
1) Establish a connection to your Access database using ADO.NET. Maybe do this in code or use the data tools in Visual Studio?
2) Write a query (in Access or plain SQL) to find the count of the distinct stock items that have been purchased today and subtract that from the count of the items in stock at the beginning of the day. Select the items where the count is zero or less.
You can use the visual builder in Access and save the query object, referring to this query object in code. Or you can copy the SQL generated by Access and use this with ADO.NET command objects.
3) Show the results of this query in a listbox. Either step through the DataReader adding items to listbox in code, or investigate databinding to your datasource.
4) Write another query that shows the data requested in step 2 in your question and then list those results in another listbox.
Try to get a little further with it and then respond with progress and further issues.