【发布时间】:2018-11-03 07:33:50
【问题描述】:
我应该在 xampp 中执行此操作需要一个 sp 结构,因为我是一个初学者,如果可能的话,可以帮助为这个场景提供完整的 sp,并提供详细的解释。其他结构如 crud 操作已经用 php,javascript 完成
1. SELECT `cid`, `parent_cat`, `category_name`, `category_life`, `status` FROM `categories`
2. SELECT `pid`, `cid`, `bid`, `product_name`, `product_price`, `product_stock`, `added_date`, `p_status`, `loc`, `in_no`, `gst_no`, `cgst`, `sgst`, `igst`, `total`, `depre`, `pur_from` FROM `products`
我应该从上面两个表中获取记录并计算这些字段并插入下表:
3. SELECT `elapsed_yend`, `remaining_days`, `depreciation_cur`, `current_wdv`, `depreciation_next`, `next_wdv`, `accumulate_depre`, `sale_amount`, `pro_los`, `end_date` FROM `calculation`
例如,这些计算应该发生在产品表中:
CGST:
cgst = product_price * 09
sgst = product_price * 09
igst = product_price * 09
if status is 1 it should calculate igst other cgst,sgst must be 0(zero)
0 it should calculate cgst,sgst other igst must be 0(zero)
Depreciation Amount:
depre = product_price + .5(cgst+sgst+igst)
Elapsede year end :
elapsed_yend = added_date(from products table (No:2)) till every year 31/March/xxxx.
Number of days between these two dates
remaining_days = category_life - (date difference between added_date(from products (No:1)) till date)
category_life(from categories table (No:1))Ex:mobile it's life will be 1080 days.
Current Year depreciation:
depreciation_cur = (depre/category_life)*elapsed_yend
Current Year Written down value:
current_wdv = depre - depreciation_cur
Next Year depreciation :
depreciation_next = (depre / category_life) * D
D = days difference between every year 01/April/xxxx till end_date(from calculation table)
Next Year Written down value:
next_wdv = current_wdv - depreciation_next
Accumulate Depreciation :
accumulate_depre = depreciation_cur + depreciation_next
【问题讨论】:
-
其他用户将您的问题标记为低质量和需要改进。我重新措辞/格式化您的输入,使其更容易阅读/理解。请查看我的更改以确保它们反映您的意图。如果您对我有其他问题或反馈,请随时给我留言。
-
我试图解决你的问题,但老实说:我放弃了。绝对不清楚这里应该如何将事物组合在一起。两件事情。 A) 您希望其他人利用空闲时间来帮助解决您的问题,因此请使用该预览窗口和 edit 帮助信息来编写一个人类可读的问题。 B)最好包括你自己解决问题的努力,不要仅仅因为你在这里倾倒了你的要求而期望别人来做你的工作(正如所说的:你倾倒它们的方式没有激励任何人帮助你)。跨度>
-
如果您有使用过的链接,请将其包含在您的问题中。除此之外,我告诉你的问题有什么问题。将链接放入 cmets ... 对您输入的糟糕格式没有帮助。
-
不,我已经格式化并给出了我的问题,而且我是初学者,所以我正在尝试扩展,但我无法破解它。所以请帮助我
标签: sql stored-procedures