Database: sql2000
Datea fields: date, for the A1 (positive is outbound, negative is put in storage), the balance amount A2, start date Dbegin
Example: the original table
Datea A1 A2 Dbegin 1 100-1 100-1 1 0 1-2-2-100
1-3, 100, 100 1-3
1-4 60 40 1-4
1-5, 100, 140 1-5
1-8-10 150 1-8
1-8-160-1-8-10
1-10 of 10 0 1-10
1-12 October 10-12
1 to 13-13 20 30
1-15-30 0 1-15
1-15 October 10-15
1-10 of 17 0 1-17 share data into the table after
Datea A1 A2 Dbegin
1 100-1 100-1
1 0 1-2-2-100
100 make up 1-1
1-3, 100, 100 1-3
1-4 60 40 1-4
1-3 60 complement
1-5, 100, 140 1-5
1-8-10 150 1-8
1-8-160-1-8-10
1-5, 100 for
1-3 40 complement
1-10 of 10 0 1-10
1-12 October 10-12
1 to 13-13 20 30
1-12 10 complement
1-10 of 10 for
1-8-10 complement
1-15-30 0 1-15
1-15 October 10-15
1-13 20 complement
1-10 of 17 0 1-17
CodePudding user response:
You this should be enters sells saves, belongs to a kind of MIS, as the name suggests, your business data should be divided into a library table, an outbound table, a list of inventory, warehousing, outbound simply records, inventory can be updated dynamically when inbound/outbound, don't mix, so that the logic is clear, code is simple,