Sql Transaction for POS - sql

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.

Related

Automatically register payment and generate invoice when amount is zero

When pressing the "Confirm Sale" button, even if the total amount to be paid is zero (because of the 100% discount), the Register Payment popup is getting displayed - and I need to press Cancel in the popup to proceed (generate invoice & and mark it as paid).
Can I bypass displaying the popup - automatically generate the invoice and mark it as paid?
Please let me know.
Thanks.
There are two ways you can achieve this.
Write a module to overwrite the buttons named Create Invoice method and call a method to check if the total amount is zero then prepare the invoice values and automatically generate the invoice and view if needed. The rest with non-zero amount should follow the wizard path.
Create an automated action, where you can filter the SOs which are confirmed and has zero total and automatically create the invoices. You can combine this with scheduled actions to check it every X minutes or hours. This can be tricker than explained and may require some coding in the action.

Need help on implementing this Use-Case Scenario in NetSuite Oracle

I am very new to E-Commerce World.
I have a use case scenario that I want to Implement in Oracle NetSuite.
But I am not sure how to move forward with it.
Use-Case Scenario:
A Sales Order has a few Line Items & Among them, a few are out of stock.
The 3PL currently I am dealing with accepts only one Unique Sales Order ID as an Identifier.
I want to fulfill the items that are currently in stock and Later on, when the Inventory gets updated I want to fulfill the remaining Items back-ordered in the Sales Order.
But the fulfillment should happen only after the customer has paid for the Items.
Can anyone let me know? How can I achieve this?
Thank you.
You will probably need some customisation to achieve this. I don't know the full set of processes you're working with, but as a general approach, I would suggest the following:
Set up a payment term that says the customer must prepay.
Set up a script to run on your fulfilments, handle "prepay" customers.
You'll also want to check your settings in Setup > Accounting > Accounting Preferences > Order Management. Look for the option on sales orders and fulfilment. You'll probably want to default your fulfilment to available quantity only. You may want to prevent overage on your fulfilments.
When the script executes on your fulfilment, it should execute "before load". The script will need to check the sales order it's fulfilling. If the term is "prepay", the script should then check if a payment has been made against the sales order. You'll potentially need to consider deposits and paid invoices. If the script finds no payments, then it should block the fulfilment.
I'm working on the assumption that you will create a fulfilment with a "Picked" status to send to your warehouse. When they confirm the "goods-out", you will want some sort of feedback loop from your 3PL to set the fulfilment to "Shipped" and update your tracking numbers.
I hope this helps.
Mark

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.

MS Access manual Auto incrementing field

Im building a system for my company to keep track of internal orders, inbetween our warehouses, we have material that goes out warehouse 1 to warehouse 2 and we kind of lose track of how much of "x" is in warehouse 1 and how much in warehouse 2, so i want to implement this access db where a user fills a form and says: order 1: 500 of "x" order 2: 300 of "y". then another user fills an exit form where he says 1 of "x" going out, so i would need the program to keep track of total order and how much as gone out to fill order 1 and so on...
My idea here is to have both an order number and an id number for each of "x" everytime someoneone assembles 1 "x" they fill the form and print a label directly from the access (i have this part working already) while keeping a record of when it was assembled, who verified and what was verified (it will work as a quality control also).
What i dont know is how to program the db so when it reaches 500 of "x", the id number for "x" starts again from 1
This is the one major issue with my program right now, i'm not experienced in access db's or vba, but im getting there with a tip and a trick from here and there, so, no need to be careful with the technical language, i will google it if i have to :p
EDIT:
The table structure goes as follows:
1 table as the main table where I record the check that is made for every product, where I include the model of the product, the said ID that I want to reset after a number of products checked, and a concatenated field that includes most of this information to generate a qr code.
Then there is a table for the Order Number, which is connected to a form to record each new order with a date/time field, the order number itself and the number of products. This number of products must then be called from the code that will count how many products have been checked to date and keep the order number field updated so we can keep track of the order.
Then there is another minor table just to get values for the form, the product models
Thank you for your answers ;)
See this MSDN Documentation
Unfortunately in Access, you cannot 'reset' an ID field, unless you move the records to a newly created table and use that table for every 500 records.
As for the user control and login form, I'm afraid those are separate questions that must be asked in a different thread.
To get you started:
You can set the RecordSource of a form to a table, and when users make entries, the data will be saved to the table. You can also use a form with controls (text boxes, comboboxes, etc.) and create a button that runs a query to insert these records into a table.
The login piece - you can encrypt the database with a password. That may/may not be sufficient.
I would suggest you change your schema, if possible. Something like the following:
Orders
OrderID (Autonumber)
ProductID (link to your Products table)
QuantityRequested
Deliverables
DeliverableID (Autonumber)
OrderID (link to your Orders table)
SequenceNumber: in the BeforeInsert event set this value equal to:
DCount("*", "Deliverables", "OrderID=" & Me.OrderID) + 1
I'm assuming that your form has a control named OrderID that is bound to the OrderID field of the Deliverables table.
The code uses the DCount() function to get the count of all the other deliverables that have already been created for this order. If this is the first deliverable, DCount() will return 0. It then adds 1 to this count to get the sequence number of the next deliverable.
If the new SequenceNumber is greater than the quantity requested, you could display a message saying that the order has been filled and cancel the creation of the Deliverable record.
This is just one approach and it is not a complete solution. I'm assuming that once assigned a sequence number a deliverable cannot be deleted. You might need to make allowances for deliverables that get lost or damaged. You could incorporate a status field to the Deliverable table to deal with this, but you would still need to make a decision about what to do with the SequenceNumber.

How to update stock quantity

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.