reverd document discount changes..
This commit is contained in:
		@@ -45,16 +45,13 @@ class CreateDocumentItem extends Job implements HasOwner, HasSource, ShouldCreat
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Apply total discount to amount
 | 
			
		||||
        /*
 | 
			
		||||
        // Disabled this block because broken line item amount..
 | 
			
		||||
        if (! empty($this->request['global_discount'])) {
 | 
			
		||||
            if ($this->request['global_discount_type'] === 'percentage') {
 | 
			
		||||
                //$item_discounted_amount -= $item_discounted_amount * ($this->request['global_discount'] / 100);
 | 
			
		||||
                $item_discounted_amount -= $item_discounted_amount * ($this->request['global_discount'] / 100);
 | 
			
		||||
            } else {
 | 
			
		||||
                //$item_discounted_amount -= $this->request['global_discount'];
 | 
			
		||||
                $item_discounted_amount -= $this->request['global_discount'];
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        */
 | 
			
		||||
 | 
			
		||||
        $tax_amount = 0;
 | 
			
		||||
        $item_tax_total = 0;
 | 
			
		||||
@@ -159,7 +156,7 @@ class CreateDocumentItem extends Job implements HasOwner, HasSource, ShouldCreat
 | 
			
		||||
        $this->request['quantity'] = (double) $this->request['quantity'];
 | 
			
		||||
        $this->request['price'] = round($this->request['price'], $precision);
 | 
			
		||||
        $this->request['tax'] = round($item_tax_total, $precision);
 | 
			
		||||
        $this->request['discount_type'] = ! empty($this->request['discount_type']) ? $this->request['discount_type'] : null;
 | 
			
		||||
        $this->request['discount_type'] = ! empty($this->request['discount_type']) ? $this->request['discount_type'] : 'percent';
 | 
			
		||||
        $this->request['discount_rate'] = ! empty($this->request['discount']) ? $this->request['discount'] : 0;
 | 
			
		||||
        $this->request['total'] = round($actual_price_item, $precision);
 | 
			
		||||
        $this->request['created_from'] = $this->request['created_from'];
 | 
			
		||||
 
 | 
			
		||||
@@ -227,17 +227,6 @@ class CreateDocumentItemsAndTotals extends Job implements HasOwner, HasSource, S
 | 
			
		||||
 | 
			
		||||
            $discount_amount_total += $discount_amount;
 | 
			
		||||
 | 
			
		||||
            // Calculate global discount total
 | 
			
		||||
            if (! empty($item['global_discount'])) {
 | 
			
		||||
                if ($item['global_discount_type'] === 'percentage') {
 | 
			
		||||
                    $global_discount_amount = $document_item->total * ($item['global_discount'] / 100);
 | 
			
		||||
                } else {
 | 
			
		||||
                    $global_discount_amount = $item['global_discount'];
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                $actual_total -= $global_discount_amount;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (! $document_item->item_taxes) {
 | 
			
		||||
                continue;
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user