예제 #1
0
        //Print Bill Coti
        public void PrintCotiBT_Click(object sender, RoutedEventArgs e)
        {
            if (PrintCotiBT.IsEnabled == true)
            {
                if (BillProducts.Count == 0)
                {
                    MessageBox.Show("No se puede ralizar impresion ya que no hay productos registrados");
                    return;
                }

                //Create product data object
                var Pdata = new List <NovaAPI.APITickets.ProductClass>();

                foreach (var item in BillProducts)
                {
                    var AddData = new NovaAPI.APITickets.ProductClass()
                    {
                        product_count           = item.product_count,
                        product_id              = item.product_id,
                        product_pricevalue      = item.product_value.ToString(),
                        product_tax             = item.product_tax,
                        product_h               = HStatus,
                        product_discountpercent = item.product_discount,
                        product_discountvalue   = item.product_discountvalue.ToString(),
                        product_code            = item.product_code,
                        product_name            = item.product_name,
                        product_total           = item.product_total.ToString(),
                        product_unity           = item.product_type
                    };
                    Pdata.Add(AddData);
                }

                //Create ticket data object
                var data = new NovaAPI.APITickets.TicketData
                {
                    payment_type         = "0",
                    payment_method       = "0",
                    expiration_date      = "",
                    ticket_total         = TotalValue.ToString(),
                    ticket_iva           = IvaValue.ToString(),
                    ticket_iva5          = Iva5Value.ToString(),
                    ticket_iac           = IacValue.ToString(),
                    ticket_totalpayment  = "0",
                    ticket_changepayment = "0",
                    ticket_leftpayment   = "0",
                    ticket_comment       = "",
                    ticket_h             = HStatus,
                    products             = Pdata,
                    client_name          = ClientNameLB.Content.ToString(),
                    client_documentid    = ClientDocumentLB.Content.ToString(),
                    client_address       = ClientAddressLB.Content == null ? "" : ClientAddressLB.Content.ToString(),
                    client_phones        = ClientPhonesLB.Content.ToString(),
                    ticket_subtotal      = Subtotal.ToString(),
                    ticket_coti          = "1",
                    user_realname        = DataConfig.RealName
                };

                PrintFunctions.PrintFunctions.Print(Classes.Enums.PrintPages.FinalTicket, data);
            }
        }
예제 #2
0
        //Print bill copy
        private void PrintCopyBill_Click(object sender, RoutedEventArgs e)
        {
            var data = NovaAPI.APITickets.tickets.Find(x => x.id == ((Button)sender).Tag.ToString());

            data.ticket_copy = "1";

            //Create product data object
            var Pdata = new List <NovaAPI.APITickets.ProductClass>();

            foreach (var item in data.items)
            {
                var AddData = new NovaAPI.APITickets.ProductClass()
                {
                    product_count           = item.item_count,
                    product_id              = item.item_id,
                    product_pricevalue      = item.item_pricevalue,
                    product_tax             = item.item_tax,
                    product_h               = HStatus,
                    product_discountpercent = item.item_discountpercent,
                    product_discountvalue   = item.item_discountvalue.ToString(),
                    product_code            = item.product_code,
                    product_name            = item.product_name,
                    product_total           = (Convert.ToInt32(item.item_pricevalue) * Convert.ToInt32(item.item_count)).ToString(),
                    product_unity           = item.product_unity
                };
                Pdata.Add(AddData);
            }

            data.products    = Pdata;
            data.ticket_coti = "0";
            data.ticket_h    = HStatus;


            var ClientData = NovaAPI.APIClient.clients.Find(x => x.id == data.client_id);

            if (ClientData != null)
            {
                data.client_address    = ClientData.address;
                data.client_documentid = ClientData.idcomplete;
                data.client_phones     = ClientData.phones;
            }

            NovaAPI.APITickets.TicketID = data.id;

            PrintFunctions.PrintFunctions.Print(Classes.Enums.PrintPages.FinalTicket, data);
        }
예제 #3
0
        //Finish ticket
        private async void FinishBillBT_Click(object sender, RoutedEventArgs e)
        {
            //Create product data object
            var Pdata = new List <NovaAPI.APITickets.ProductClass>();

            foreach (var item in BillProducts)
            {
                var AddData = new NovaAPI.APITickets.ProductClass()
                {
                    product_count           = item.product_count,
                    product_id              = item.product_id,
                    product_pricevalue      = item.product_value.ToString(),
                    product_tax             = item.product_tax,
                    product_h               = HStatus,
                    product_discountpercent = item.product_discount,
                    product_discountvalue   = item.product_discountvalue.ToString(),
                    product_code            = item.product_code,
                    product_name            = item.product_name,
                    product_total           = item.product_total.ToString(),
                    product_unity           = item.product_type
                };
                Pdata.Add(AddData);
            }

            //Create ticket data object
            var data = new NovaAPI.APITickets.TicketData
            {
                branch_id            = DataConfig.WorkPlaceID.ToString(),
                box_id               = DataConfig.WorkPointID.ToString(),
                box_movement_id      = NovaAPI.APIBoxMovements.movement_id,
                client_id            = SelectedClientID,
                payment_type         = PaymentType.SelectedIndex.ToString(),
                payment_method       = PaymentMethodCB.SelectedIndex.ToString(),
                expiration_date      = PaymentType.SelectedIndex != 0 ? BillDatePicker.SelectedDate.Value.ToString("yyyy-MM-dd") : "",
                ticket_total         = TotalValue.ToString(),
                ticket_iva           = IvaValue.ToString(),
                ticket_iva5          = Iva5Value.ToString(),
                ticket_iac           = IacValue.ToString(),
                ticket_totalpayment  = InValue.ToString(),
                ticket_changepayment = InChangeValue.ToString(),
                ticket_leftpayment   = inLeftValue.ToString(),
                ticket_comment       = CommentTX.Text,
                ticket_h             = HStatus,
                products             = Pdata,
                client_name          = ClientNameLB.Content.ToString(),
                client_documentid    = ClientDocumentLB.Content.ToString(),
                client_address       = ClientAddressLB.Content.ToString(),
                client_phones        = ClientPhonesLB.Content.ToString(),
                ticket_subtotal      = Subtotal.ToString()
            };

            TicketData = data;

            //Create Json string request
            string requestData = JsonConvert.SerializeObject(data);

            //Create request
            bool Response = await NovaAPI.APITickets.GetValues("1", DataConfig.LocalAPI, requestData);

            if (Response)
            {
                PrintIn.Visibility     = Visibility.Visible;
                InProductBT.Visibility = Visibility.Collapsed;
                InProductBT.IsEnabled  = false;
                FinalIn.Visibility     = Visibility.Collapsed;
                FinalIn.IsEnabled      = false;

                PrintCotiBT.IsEnabled = false;

                BillFinishExitBT_Click(null, null);

                PrintIn.Focus();
            }
            else
            {
                BillFinishExitBT_Click(null, null);
                MessageBox.Show(NovaAPI.APITickets.Message);
            }
        }