More regarding costing valuations
[fa-stable.git] / sales / includes / db / sales_credit_db.inc
index ce1cb17f14ae5fd9097cc7ab5476eaf530a4fa37..d5be9c44b0b16a4a00d7b7e9637ac43f038d6187 100644 (file)
@@ -171,10 +171,14 @@ function write_credit_note(&$credit_note, $write_off_acc)
 // Insert a stock movement coming back in to show the credit note and
 //     a reversing stock movement to show the write off
 //
+
 function add_credit_movements_item(&$credit_note, &$credit_line,
        $credit_type, $price, $credited_invoice=0)
 {
 
+    //Chaitanya : Stamp current cost in stock moves $credit_line does not fetch cost
+    $curr_std_cost = get_standard_cost($credit_line->stock_id);
+
        if ($credit_type == "Return") {
 
                $reference = "Return ";
@@ -188,20 +192,20 @@ function add_credit_movements_item(&$credit_note, &$credit_line,
                if ($credited_invoice)
                        $reference .= "Ex Inv: " . $credited_invoice;
 
-       add_stock_move_customer(ST_CUSTCREDIT,  $credit_line->stock_id,
-               key($credit_note->trans_no), $credit_note->Location,
-               $credit_note->document_date, $reference, -$credit_line->qty_dispatched,
-               $credit_line->standard_cost,  0, $price,
-               $credit_line->discount_percent);
-
-               }
-       add_stock_move_customer(ST_CUSTCREDIT,  $credit_line->stock_id,
-               key($credit_note->trans_no), $credit_note->Location,
-               $credit_note->document_date, $reference, $credit_line->qty_dispatched,
-               $credit_line->standard_cost,  0, $price,
-               $credit_line->discount_percent);
+               add_stock_move_customer(ST_CUSTCREDIT,  $credit_line->stock_id,
+               key($credit_note->trans_no), $credit_note->Location,
+               $credit_note->document_date, $reference, -$credit_line->qty_dispatched,
+               $curr_std_cost,  0, $price,
+               $credit_line->discount_percent);
 
        }
+    add_stock_move_customer(ST_CUSTCREDIT,  $credit_line->stock_id,
+        key($credit_note->trans_no), $credit_note->Location,
+        $credit_note->document_date, $reference, $credit_line->qty_dispatched,
+        $curr_std_cost,  0, $price,
+        $credit_line->discount_percent);
+
+}
 
 //----------------------------------------------------------------------------------------