private void add_CRM(sales_budget invoice) { crm_opportunity crm_opportunity = new crm_opportunity(); crm_opportunity.id_contact = invoice.id_contact; crm_opportunity.id_currency = invoice.id_currencyfx; crm_opportunity.value = invoice.sales_budget_detail.Sum(x => x.SubTotal_Vat); crm_opportunity.sales_budget.Add(invoice); base.crm_opportunity.Add(crm_opportunity); }
private void add_CRM(sales_packing sales_packing) { if (sales_packing.id_sales_packing == 0 || sales_packing == null) { crm_opportunity crm_opportunity = new crm_opportunity(); crm_opportunity.id_contact = sales_packing.id_contact; crm_opportunity.sales_packing.Add(sales_packing); base.crm_opportunity.Add(crm_opportunity); } else { crm_opportunity crm_opportunity = sales_order.Where(x => x.id_sales_order == sales_packing.id_sales_packing).FirstOrDefault().crm_opportunity; crm_opportunity.sales_packing.Add(sales_packing); base.crm_opportunity.Attach(crm_opportunity); } }
private void add_CRM(sales_invoice invoice) { if (invoice.id_sales_order == 0 || invoice.id_sales_order == null) { crm_opportunity crm_opportunity = new crm_opportunity(); crm_opportunity.id_contact = invoice.id_contact; crm_opportunity.id_currency = invoice.id_currencyfx; crm_opportunity.value = invoice.GrandTotal; crm_opportunity.sales_invoice.Add(invoice); base.crm_opportunity.Add(crm_opportunity); } else { crm_opportunity crm_opportunity = sales_order.Where(x => x.id_sales_order == invoice.id_sales_order).FirstOrDefault().crm_opportunity; crm_opportunity.sales_invoice.Add(invoice); base.crm_opportunity.Attach(crm_opportunity); } }
private void add_CRM(sales_order order) { if (order.id_sales_budget == 0 || order.id_sales_budget == null) { crm_opportunity crm_opportunity = new crm_opportunity(); crm_opportunity.id_contact = order.id_contact; crm_opportunity.id_currency = order.id_currencyfx; crm_opportunity.value = order.sales_order_detail.Sum(x => x.SubTotal_Vat); crm_opportunity.sales_order.Add(order); base.crm_opportunity.Add(crm_opportunity); } else { crm_opportunity crm_opportunity = sales_budget.Where(x => x.id_sales_budget == order.id_sales_budget).FirstOrDefault().crm_opportunity; crm_opportunity.sales_order.Add(order); base.crm_opportunity.Attach(crm_opportunity); } }
private void add_CRM(sales_return sales_return) { sales_invoice_detail sales_invoice_detail = sales_return.sales_return_detail.FirstOrDefault().sales_invoice_detail; if (sales_invoice_detail == null) { crm_opportunity crm_opportunity = new crm_opportunity(); crm_opportunity.id_contact = sales_return.id_contact; crm_opportunity.id_currency = sales_return.id_currencyfx; crm_opportunity.value = sales_return.GrandTotal; crm_opportunity.sales_return.Add(sales_return); base.crm_opportunity.Add(crm_opportunity); } else { crm_opportunity crm_opportunity = sales_invoice.Where(x => x.id_sales_invoice == sales_invoice_detail.id_sales_invoice).FirstOrDefault().crm_opportunity; crm_opportunity.sales_return.Add(sales_return); base.crm_opportunity.Attach(crm_opportunity); } }