Пример #1
0
        private void SendGeneralJournal(string CodeCashOut, string totalcashout, int idreg)
        {
            decimal totalcashOut = 0M;
            string  cashoutcode  = "";
            string  datereg      = "";

            GeneralJournalNAV.GeneralJournalPOS_Service JournalService = new GeneralJournalPOS_Service();
            //Credenciales de acceso
            string userconfigsfile = System.Configuration.ConfigurationManager.AppSettings["UserNav"];
            string passconfigsfile = System.Configuration.ConfigurationManager.AppSettings["PasswordNav"];
            var    networkcre      = new NetworkCredential(userconfigsfile, passconfigsfile);

            test2010.TestWS regjournal = new test2010.TestWS();
            regjournal.Credentials = networkcre;

            JournalService.Credentials = networkcre;
            //test2010
            GeneralJournalPOS GeneralJour = new GeneralJournalPOS();

            try
            {
                regjournal.ClearJournal();
                JournalService.Create("POS", ref GeneralJour);
                DataTable datatbacashout = DataCashOut(idreg);
                //0[OutId], 1[Total], 2[Date], 3[Terminal], 4[CodeCashOut]
                string terminalreg = "";
                foreach (DataRow row in datatbacashout.Rows)
                {
                    string totalstring = row[1].ToString();
                    totalcashOut = decimal.Parse(totalstring);
                    datereg      = row[2].ToString();
                    cashoutcode  = row[4].ToString() + idreg.ToString();
                    terminalreg  = row[3].ToString();
                }
                //DataTable datatermaccounts = DataAccountsTerm(terminalreg);
                string CashOutAccount = "";
                string TermAccount    = "";
                //[AccountNAV], [CashOutsAccount]

                /*foreach (DataRow rows in datatermaccounts.Rows)
                 * {
                 *  CashOutAccount = rows[1].ToString();
                 *  TermAccount = rows[0].ToString();
                 * }
                 */
                CashOutAccount = System.Configuration.ConfigurationManager.AppSettings["SucursalAccount"];
                TermAccount    = System.Configuration.ConfigurationManager.AppSettings["TerminalAccount"];

                DateTime dateregtime = DateTime.ParseExact(datereg, "MM/dd/yyyy", CultureInfo.InvariantCulture);
                GeneralJour.Document_Type = Document_Type._blank_;
                GeneralJour.Document_No   = cashoutcode;
                GeneralJour.Account_Type  = Account_Type.G_L_Account;
                GeneralJour.Posting_Date  = dateregtime;
                //GeneralJour.Account_Type = Account_Type.G_L_Account;
                GeneralJour.Account_No       = CashOutAccount;
                GeneralJour.Amount           = totalcashOut;
                GeneralJour.Bal_Account_Type = Bal_Account_Type.G_L_Account;
                GeneralJour.Bal_Account_No   = TermAccount;
                ////GeneralJour.Recipient_Bank_Account = "0001102";
                //GeneralJour.Payment_Method_Code = "01";
                GeneralJour.External_Document_No = terminalreg + '-' + cashoutcode;
                JournalService.Update("POS", ref GeneralJour);
                regjournal.PostJournal(GeneralJour.Document_No);
                regjournal.ClearJournal();
                updatecashout(idreg);
            }
            catch (SqlException sqlex)
            {
                MessageBox.Show(sqlex.Message.ToString());
            }
            catch (WebException webex)
            {
                MessageBox.Show(webex.Message.ToString());
            }
            catch (FormatException formatex)
            {
                MessageBox.Show(formatex.Message.ToString());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
        }
Пример #2
0
        private void sendpayments()
        {
            //MetroFramework.Controls.MetroProgressSpinner spiner= new MetroFramework.Controls.MetroProgressSpinner();
            //this.Controls.Add(this.spiner);
            string AccountTermNav = "";
            string Suc            = "";

            GeneralJournalNAV.GeneralJournalPOS_Service PaymentsService = new GeneralJournalPOS_Service();
            //Credenciales de acceso
            string userconfigsfile = System.Configuration.ConfigurationManager.AppSettings["UserNav"];
            string passconfigsfile = System.Configuration.ConfigurationManager.AppSettings["PasswordNav"];
            string CustomerCodeNAV = System.Configuration.ConfigurationManager.AppSettings["customercode"];
            var    networkcre      = new NetworkCredential(userconfigsfile, passconfigsfile);

            PaymentsService.Credentials = networkcre;
            GeneralJournalNAV.GeneralJournalPOS payment = new GeneralJournalPOS();
            String BathName = "POS";

            PaymentsService.Create(BathName, ref payment);
            //DataTable sales_header = GetSalesHeader();

            if (SalesSync2 != null)
            {
                test2010.TestWS regjournal = new test2010.TestWS();
                regjournal.Credentials = networkcre;
                foreach (DataGridViewRow row in SalesSync2.Rows)
                {
                    //0[NoVenta], 1[Terminal], 2[SalesTotal], 3[CashPay], 4[NoTicket], 5[CorteReg]
                    //PaymentsService.Create(BathName, ref payment)
                    //payment.Line_No = Line;
                    bool continuereg = bool.Parse(row.Cells[7].Value.ToString());
                    if (continuereg)
                    {
                        //GetAccountTerminal(ref AccountTermNav, ref Suc, row);

                        //Datatable Sales ROWS
                        //0"NoVenta", 1"Fecha Registro", 2"NoTicket", 3"SalesTotal", 4"CorteReg", 5"Number", 6"SyncNav"
                        //
                        AccountTermNav = System.Configuration.ConfigurationManager.AppSettings["TerminalAccount"];
                        Suc            = System.Configuration.ConfigurationManager.AppSettings["SucursalAccount"];
                        DateTime DateReg = DateTime.ParseExact(row.Cells[1].Value.ToString(), "MM/dd/yyyy", null);
                        string   CorteId = row.Cells[2].Value.ToString() + DateReg.ToString("MM/dd/yyyy");
                        payment.Posting_Date         = DateReg;//DateTime.Today;
                        payment.Document_Type        = Document_Type.Payment;
                        payment.Document_No          = row.Cells[2].Value.ToString();
                        payment.Account_Type         = Account_Type.Customer;
                        payment.Account_No           = CustomerCodeNAV;
                        payment.External_Document_No = CorteId;
                        decimal totalSalesHeader = decimal.Parse(row.Cells[3].Value.ToString());
                        payment.Payment_Method_Code = "01";
                        payment.Amount           = (totalSalesHeader * -1M);
                        payment.Bal_Account_Type = Bal_Account_Type.G_L_Account;
                        payment.Bal_Account_No   = AccountTermNav;
                        //payment.
                        PaymentsService.Update(BathName, ref payment);

                        if (regjournal.PostJournal(payment.Document_No))
                        {
                            UpdatePaymentSales(row);
                        }
                    }
                }
                regjournal.ClearJournal();

                //PaymentsService.Update(BathName, ref payment);
            }
        }
Пример #3
0
        private void sendpayments()
        {
            //MetroFramework.Controls.MetroProgressSpinner spiner= new MetroFramework.Controls.MetroProgressSpinner();
            //this.Controls.Add(this.spiner);
            string AccountTermNav = "";
            string Suc            = "";

            //GetAccountTerminal(ref AccountTermNav, ref Suc);

            GeneralJournalNAV.GeneralJournalPOS_Service PaymentsService = new GeneralJournalPOS_Service();
            //Credenciales de acceso
            string userconfigsfile = System.Configuration.ConfigurationManager.AppSettings["UserNav"];
            string passconfigsfile = System.Configuration.ConfigurationManager.AppSettings["PasswordNav"];
            string CustomerCodeNAV = System.Configuration.ConfigurationManager.AppSettings["customercode"];

            AccountTermNav = System.Configuration.ConfigurationManager.AppSettings["TerminalAccount"];
            Suc            = System.Configuration.ConfigurationManager.AppSettings["SucursalAccount"];
            var networkcre = new NetworkCredential(userconfigsfile, passconfigsfile);

            PaymentsService.Credentials = networkcre;
            GeneralJournalNAV.GeneralJournalPOS payment = new GeneralJournalPOS();
            String BathName = "POS";

            PaymentsService.Create(BathName, ref payment);
            DataTable sales_header = GetSalesHeader();
            int       Line         = 10000;
            string    CorteId      = Suc + terminal + DateTime.Today.ToString("MM/dd/yyyy");

            if (sales_header != null)
            {
                foreach (DataRow row in sales_header.Rows)
                {
                    //0[NoVenta], 1[Terminal], 2[SalesTotal], 3[CashPay], 4[NoTicket], 5[CorteReg]
                    //PaymentsService.Create(BathName, ref payment)
                    //payment.Line_No = Line;
                    payment.Posting_Date  = DateTime.Today;
                    payment.Document_Type = Document_Type.Payment;
                    payment.Document_No   = row[4].ToString();
                    payment.Account_Type  = Account_Type.Customer;

                    payment.Account_No           = CustomerCodeNAV;
                    payment.External_Document_No = CorteId;
                    decimal totalSalesHeader = decimal.Parse(row[2].ToString());
                    payment.Payment_Method_Code = "01";
                    payment.Amount           = (totalSalesHeader * -1M);
                    payment.Bal_Account_Type = Bal_Account_Type.G_L_Account;
                    payment.Bal_Account_No   = AccountTermNav;
                    //payment.
                    PaymentsService.Update(BathName, ref payment);
                    test2010.TestWS regjournal = new test2010.TestWS();
                    regjournal.Credentials = networkcre;
                    if (regjournal.PostJournal(payment.Document_No))
                    {
                        UpdatePaymentSales(row);
                    }
                }


                //PaymentsService.Update(BathName, ref payment);
            }
        }