fixes in gross profit report
This commit is contained in:
		
							parent
							
								
									0c541a0fe2
								
							
						
					
					
						commit
						8c45420f19
					
				| @ -25,12 +25,12 @@ def execute(filters=None): | ||||
| 			item_sales_bom.get(row.parenttype, {}).get(row.name, webnotes._dict())) | ||||
| 		 | ||||
| 		buying_amount = buying_amount > 0 and buying_amount or 0 | ||||
| 		 | ||||
| 
 | ||||
| 		gross_profit = selling_amount - buying_amount | ||||
| 		if selling_amount: | ||||
| 			gross_profit = selling_amount - buying_amount | ||||
| 			gross_profit_percent = (gross_profit / selling_amount) * 100.0 | ||||
| 		else: | ||||
| 			gross_profit = gross_profit_percent = 0.0 | ||||
| 			gross_profit_percent = 0.0 | ||||
| 		 | ||||
| 		icon = """<a href="%s"><i class="icon icon-share" style="cursor: pointer;"></i></a>""" \ | ||||
| 			% ("/".join(["#Form", row.parenttype, row.name]),) | ||||
|  | ||||
| @ -366,6 +366,7 @@ class DocType(SellingController): | ||||
| 						 | ||||
| 				# Reduce actual qty from warehouse | ||||
| 				self.make_sl_entry(d, d['warehouse'], - flt(d['qty']) , 0, update_stock) | ||||
| 		 | ||||
| 		get_obj('Stock Ledger', 'Stock Ledger').update_stock(self.values) | ||||
| 
 | ||||
| 
 | ||||
|  | ||||
| @ -171,7 +171,7 @@ def get_buying_amount(item_code, warehouse, qty, voucher_type, voucher_no, vouch | ||||
| 		buying_amount = 0.0 | ||||
| 		for bom_item in item_sales_bom[item_code]: | ||||
| 			if bom_item.get("parent_detail_docname")==voucher_detail_no: | ||||
| 				buying_amount += _get_buying_amount(voucher_type, voucher_no, "[** No Item Row **]", | ||||
| 				buying_amount += _get_buying_amount(voucher_type, voucher_no, voucher_detail_no, | ||||
| 					bom_item.item_code, bom_item.warehouse or warehouse,  | ||||
| 					bom_item.total_qty or (bom_item.qty * qty), stock_ledger_entries) | ||||
| 		return buying_amount | ||||
| @ -187,8 +187,7 @@ def _get_buying_amount(voucher_type, voucher_no, item_row, item_code, warehouse, | ||||
| 		 | ||||
| 	for i, sle in enumerate(relevant_stock_ledger_entries): | ||||
| 		if sle.voucher_type == voucher_type and sle.voucher_no == voucher_no and \ | ||||
| 			((sle.voucher_detail_no == item_row) or (sle.voucher_type != "Stock Reconciliation"  | ||||
| 			and flt(sle.qty) == qty)): | ||||
| 			sle.voucher_detail_no == item_row: | ||||
| 				previous_stock_value = len(relevant_stock_ledger_entries) > i+1 and \ | ||||
| 					flt(relevant_stock_ledger_entries[i+1].stock_value) or 0.0 | ||||
| 				 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user