Ejemplo n.º 1
0
        public override void RowPasted(UnicontaBaseEntity rec)
        {
            var Comp      = api.CompanyEntity;
            var orderLine = rec as ProjectInvoiceProposalLineClient;

            if (orderLine == null)
            {
                return;
            }
            if (Comp._InvoiceUseQtyNow)
            {
                orderLine.QtyNow = orderLine._Qty;
            }
            if (orderLine._Item != null)
            {
                var selectedItem = (InvItem)items.Get(orderLine._Item);
                if (selectedItem != null)
                {
                    PriceLookup?.SetPriceFromItem(orderLine, selectedItem);
                    orderLine.SetItemValues(selectedItem, Comp._OrderLineStorage, true);
                    TableField.SetUserFieldsFromRecord(selectedItem, orderLine);
                }
                else
                {
                    orderLine._Item = null;
                }
            }
        }
Ejemplo n.º 2
0
        private ErrorCodes CreateLines(List <string[]> lines, DebtorClient debtorClient)
        {
            var ols   = new List <DebtorOrderLineClient>();
            var items = _crudAPI.Query <InvItemClient>().Result;

            var order = new DebtorOrderClient();

            order.SetMaster(debtorClient);
            var orderres = _crudAPI.Insert(order).Result;

            foreach (string[] s in lines)
            {
                var item = items.First(i => i.Item == s[1]);

                var fp = new FindPrices(order, _crudAPI);
                fp.UseCustomerPrices = true;
                fp.loadPriceList();

                var ol = new DebtorOrderLineClient
                {
                    Qty  = double.Parse(s[2]),
                    Item = item.Item,
                    //Date = DateTime.Parse(s[3]),
                };
                ol.SetMaster(order);

                fp.SetPriceFromItem(ol, item);

                ols.Add(ol);
            }

            var result = _crudAPI.Insert(ols).Result;

            if (result == ErrorCodes.Succes)
            {
                openOrderLines(order);
            }

            return(result);
        }
Ejemplo n.º 3
0
        private async void createLines(List <string[]> lines)
        {
            var orders = new List <DebtorOrderClient>();
            var ols    = new List <DebtorOrderLineClient>();
            var items  = await crudAPI.Query <InvItemClient>();

            var debtors = await crudAPI.Query <DebtorClient>();

            foreach (string[] s in lines)
            {
                DebtorOrderClient order;
                order = orders.Where(o => o.Account == s[0]).FirstOrDefault();
                if (order == null)
                {
                    order = new DebtorOrderClient();
                    order.SetMaster(debtors.Where(d => d.Account == s[0]).First());
                    orders.Add(order);
                    var orderres = await crudAPI.Insert(order);
                }

                var item = items.Where(i => i.Item == s[1]).First();

                var fp = new FindPrices(order, crudAPI);
                fp.UseCustomerPrices = true;
                fp.loadPriceList();

                var ol = new DebtorOrderLineClient
                {
                    Qty  = double.Parse(s[2]),
                    Item = item.Item,
                    Date = DateTime.Parse(s[3]),
                };
                ol.SetMaster(order);

                fp.SetPriceFromItem(ol, item);

                await crudAPI.Insert(ol);
            }
        }