Real-time Invoicing
how to count the beginning of an arbitrary moment, the period , the final invoicing?
Because inventory every day, all the time is changing, and many hospital drugs need to count any two points between the invoicing situation, such as 2015-05-05 from 10:03:20 to 2015-09-05 10:03:20 beginning, period increase, period reduction, the final inventory, how to count?
Because inventory real-time in the change, every day in the out of the library, warehousing, and even 2015-05-05 10:03:20 and 2015-09-05 10:03:20 two moments of inventory are not measured, not to mention the period of data, of course, can use the most stupid way, starting from the initial inventory, have been projected to these two moments, but if the software began to use the time is very far from May 2015, such as 2010, five years of data, from 2010 to 2015, will be a long time to calculate, or even panic, which is certainly not feasible.
The feasible way I see it now is to define a scheduled task that stores inventory daily in a table, which can be called an Inventory snapshot table, and it's much easier to have this table to calculate the opening and closing and period data.
I. Calculation of the beginning or final number of a period
For example above, assuming that the stock snapshot is stored at 23:00:00 every night, Yp_plan, then how to calculate the inventory number of drug A in 2015-05-05 10:03:20 and 2015-09-05 10:03:20, below I give specific steps:
- First remove 2015-05-04 23:00:00 the Inventory information table for the scheduled task execution
Number of stocks, recorded as S_a
- Then the 2015-05-04 23:00:00 to 2015-05-05 10:03:20 between all the Out
Inventory number of libraries and warehousing s_add,s_reduce
- Finally, the final number of the 2015-05-05 10:03:20 S_b=s_a+s_add-s_reduce,
Note 2015-05-05 10:03:20 time inventory is S_start, the same can be obtained 2015-09-05 10:03:20 inventory count, 2015-09-05 10:03:20 time inventory for S_end
This will only need to calculate the number of hours of out-of-storage data can be counted at each moment of inventory.
Ii. calculation of the number of periods (period increase and period reduction)
- Above, for example, will 2015-05-05 10:03:20 to 2015-05-05 10:03:20 of the increase in the calculation, including warehousing, withdrawal, transfer, disk surplus, as long as the inventory increase can be counted, the period of increase s_add_total
- Reduce the number of 10:03:20 from 2015-05-05 10:03:20 to 2015-05-05, including out-of-Library, allocation, transfer-out, disk-deficit, etc., as long as the inventory reduction can be counted, the period of reduction s_reduce_total
Third, check the correctness of the data
can use S_end=s_start+s_add_total-s_reduce_total to check the accuracy of invoicing, if the system is not accurate description of loopholes or discrepancies in the library without accounting and other issues.
Dong Jisu
March 11, 2016
Real-time Invoicing