the0forge / sp

GNU General Public License v3.0
0 stars 1 forks source link

Orders CRUD #2

Closed r31gnf1r3 closed 10 years ago

r31gnf1r3 commented 10 years ago

Orders CRUD

http://en.wikipedia.org/wiki/Create,_read,_update_and_delete

Basic Overview

zvadym commented 10 years ago

Hi Stevo (@r31gnf1r3 )

Can one order have more than one invoice?

r31gnf1r3 commented 10 years ago

An order has a single invoice, but it can be from different companies (i.e. SmartPractice / SmartMethods)

On Fri, May 16, 2014 at 8:23 PM, Vadim notifications@github.com wrote:

Hi Stevo (@r31gnf1r3 https://github.com/r31gnf1r3 )

Can one order have more than one invoice?

— Reply to this email directly or view it on GitHubhttps://github.com/the0forge/sp/issues/2#issuecomment-43330099 .


This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited.

zvadym commented 10 years ago

OK. Next question. Order have lots fields.

class Order(models.Model):
    ....
    sub_total = models.DecimalField(max_digits=12, decimal_places=2, default=0)
    ....
    tax = models.DecimalField(max_digits=12, decimal_places=2, default=0)
    discount = models.DecimalField(max_digits=12, decimal_places=2, default=0)
    total_cost = models.DecimalField(max_digits=12, decimal_places=2, default=0)
    ....
    sp_cost = models.DecimalField(max_digits=12, decimal_places=2, default=0)
    ....
    invoice_company_name = models.CharField(max_length=255)
    invoice_company_reg = models.CharField(max_length=120)
    invoice_address_line_1 = models.CharField(max_length=255)
    invoice_address_line_2 = models.CharField(max_length=255)
    invoice_suburb = models.CharField(max_length=100)
    invoice_state = models.CharField(max_length=100)
    invoice_postcode = models.CharField(max_length=10)
    invoice_country = models.CharField(max_length=100)
    ....
    shipping_attn = models.CharField(max_length=255)
    shipping_address_line_1 = models.CharField(max_length=255)
    shipping_address_line_2 = models.CharField(max_length=255)
    shipping_suburb = models.CharField(max_length=100)
    shipping_state = models.CharField(max_length=100)
    shipping_postcode = models.CharField(max_length=10)
    shipping_country = models.CharField(max_length=100)
    ....
    from_src_order_id = models.IntegerField(null=True, blank=True)
    from_borders_fakeid = models.IntegerField(null=True, blank=True)

    order_notes = models.CharField(max_length=510, null=True, blank=True)

@r31gnf1r3 Which of these fields editable? Which of auto-generate? If 'auto-gen' - where I should get data?

r31gnf1r3 commented 10 years ago

the invoice information comes from the customer/company details. The shipping comes from either customer/company details (unless they unclick 'the delivery address is the same as above). costs/totals/tax should generate..

zvadym commented 10 years ago

costs/totals/tax should generate.. - give me a formula please

zvadym commented 10 years ago
class OrderProduct(models.Model):
    """ 'Line Item' for an order; contains Product ordered on an Order with its quantity
    """
    order = models.ForeignKey(Order)
    product = models.ForeignKey(Product)
    quantity = models.PositiveSmallIntegerField()
    unit_price = models.DecimalField(max_digits=9, decimal_places=2, default=0)
    unit_tax = models.DecimalField(max_digits=9, decimal_places=2, default=0)
    discount_percentage = models.DecimalField(max_digits=5, decimal_places=2, default=0)
    discount_price = models.DecimalField(max_digits=9, decimal_places=2, default=0)
    sp_price = models.DecimalField(max_digits=9, decimal_places=2, default=0)
    royalty_amount = models.DecimalField(max_digits=9, decimal_places=2, default=0)
    back_order = models.BooleanField(default=False)

@r31gnf1r3 unit_price - ? is there Product.sp_cost?

unit_tax - ? discount_percentage - editable
discount_price - ? sp_price - ? what is SP? royalty_amount - ? back_order - ? How is it used?

How to count the fields? Please describe it in detail today.

zvadym commented 10 years ago

How I can count TAX?

r31gnf1r3 commented 10 years ago

Tax is GST (Goods And Services Tax). Can make it a static variable in the settings.py or something along those lines. Currently the GST for Australia is 10% (although there is talk within the government it will change to 12% sometime). In New Zealand for example is it 15%. So we could either add a tax model, or just put in a static variable.

http://en.wikipedia.org/wiki/Goods_and_Services_Tax_(Australia)

r31gnf1r3 commented 10 years ago

image

That should be the correct calculations of an order based on items. In the order summary. If you look at how those figures are reached. There is the formulas.

product.sp_cost is the cost for smartpactice per item (what they have paid to put it into stock). pricelevel.cost_per_item or pricelevel.cost_per_block (usualy block), is what the customer is being charged. That's how you calculate the cost per item (by the price level group, and cost) per item on order.

Then order.discount is applied. Then Tax. Then Shipping.

The order summery works like::

Sub Profit == Money made / Profit for Smart Practice (No Tax or Discount Applied) i.e. _Sub Price - Sub Cost = Sub Profit._ Sub Cost == The cost to Smart Practice (how much they paid for that stock) Sub Price == How much the customer is being charged (No Tax or Discount Applied)

Disc == Discount Amount

Gross Profit / Gross Cost / Gross Price. Is similar to the above but WITH discount applied, and TAX NOT APPLIED.

Tax == Tax Amount (10% currently)

Net Profit / Net Cost / Net Price. Is similar to above with WITH BOTH discount and TAX applied.

Ship == Shipping cost

Total Cost / Total Price. Like above WITH discount, TAX, and shipping applied.

zvadym commented 10 years ago

Hi @r31gnf1r3 can you check Order CRUD?

zvadym commented 10 years ago

Statuses.

I think you need to define some rules for status changes. For example "Cancelled" can not be re-opened or edited.

r31gnf1r3 commented 10 years ago

With cancelled. They just click the button on the bottom (or the status change drop-down). And:

  1. If click button, just change status to cancel and close window.
  2. If change from status drop down, then will just be put into status list.

The delete on the other hand. We could either a. create a boolean for that order 'deleted' True/False, or have a 'new' status that says deleted. In that case, as they have to manually click the delete button (there should be a question popup modal, "are you sure you want to delete this order?"), in that case we keep the record but it can not be re-opened or edited.

But with cancelled, let them still be able to change it, because people will call, and be like I cancelled my order yesterday because my creditcards weren't working. Can I put it through again. Or something like that.

On Tue, Jun 3, 2014 at 6:33 PM, Vadim notifications@github.com wrote:

Statuses.

I think you need to define some rules for status changes. For example "Cancelled" can not be re-opened or edited.

— Reply to this email directly or view it on GitHub https://github.com/the0forge/sp/issues/2#issuecomment-44937981.


This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited.

zvadym commented 10 years ago

@r31gnf1r3 Summary was done

r31gnf1r3 commented 10 years ago

6-11-2014 2-12-15 pm

Position of email/print button.

zvadym commented 10 years ago

@r31gnf1r3 I need template for email/print order

zvadym commented 10 years ago

@r31gnf1r3 I have added new field called "from_mail" to Company model.