Beispiel #1
0
        private void cmdBetal_Click(object sender, EventArgs e)
        {
            string  TilPBSFilename = "Unknown";
            int     AntalBetalinger;
            int     lobnr;
            int     imax;
            string  keyval;
            string  Navn;
            int     Nr;
            string  Kaldenavn;
            string  Email;
            int     faknr;
            decimal advisbelob;
            string  Bank;

            if ((this.cmdBetal.Text == "Afslut"))
            {
                this.Close();
            }
            this.cmdForslag.Visible = false;
            this.cmdCancel.Visible  = false;
            imax = lvwKrdFaktura.Items.Count;
            this.pgmBetal.Maximum = (imax * 4);
            this.pgmBetal.Minimum = 0;
            this.pgmBetal.Value   = 0;
            this.pgmBetal.Visible = true;
            Program.dbData3060.tempBetalforslags.DeleteAllOnSubmit(Program.dbData3060.tempBetalforslags);
            Program.dbData3060.SubmitChanges();
            if ((imax == 0))
            {
                this.Label_Betaltekst.Text    = "Der ikke noget at betale";
                this.Label_Betaltekst.Visible = true;
            }
            else
            {
                nsPbs3060.tempBetalforslag rec_tempBetalforslag = new nsPbs3060.tempBetalforslag
                {
                    betalingsdato = DateTime.Now,
                };
                Program.dbData3060.tempBetalforslags.InsertOnSubmit(rec_tempBetalforslag);
                var i = 0;
                foreach (ListViewItem lvi in lvwKrdFaktura.Items)
                {
                    this.pgmBetal.Value = ++i;
                    keyval     = lvi.Name;
                    Navn       = lvi.Text;
                    Nr         = int.Parse(lvi.SubItems[1].Text);
                    faknr      = int.Parse(lvi.SubItems[4].Text);
                    advisbelob = decimal.Parse(lvi.SubItems[5].Text);
                    Bank       = lvi.SubItems[6].Text;
                    Kaldenavn  = lvi.SubItems[7].Text;
                    Email      = lvi.SubItems[8].Text;
                    nsPbs3060.tempBetalforslaglinie rec_tempBetalforslaglinie = new nsPbs3060.tempBetalforslaglinie
                    {
                        Nr          = Nr,
                        Navn        = Navn,
                        Kaldenavn   = Kaldenavn,
                        Email       = Email,
                        fakid       = int.Parse(keyval),
                        advisbelob  = (decimal)advisbelob,
                        bankregnr   = Bank.Substring(0, 4),
                        bankkontonr = Bank.Substring(5, 10),
                        faknr       = faknr,
                    };
                    rec_tempBetalforslag.tempBetalforslaglinies.Add(rec_tempBetalforslaglinie);
                }
                Program.dbData3060.SubmitChanges();

                clsOverfoersel   objOverfoersel = new clsOverfoersel();
                Tuple <int, int> t = objOverfoersel.kreditor_fakturer_os1(Program.dbData3060);
                AntalBetalinger     = t.Item1;
                lobnr               = t.Item2;
                this.pgmBetal.Value = imax * 2;
                if ((AntalBetalinger > 0))
                {
                    objOverfoersel.krdfaktura_overfoersel_action(Program.dbData3060, lobnr);
                    this.pgmBetal.Value = (imax * 3);
                    //clsSFTP objSFTP = new clsSFTP(Program.dbData3060);
                    //TilPBSFilename = objSFTP.WriteTilSFtp(Program.dbData3060, lobnr);
                    //objSFTP.DisconnectSFtp();
                    //objSFTP = null;
                    clsBankUdbetalingsUdskrift objBankUdbetalingsUdskrift = new clsBankUdbetalingsUdskrift();
                    objBankUdbetalingsUdskrift.BankUdbetalingsUdskrifter(Program.dbData3060, lobnr);
                    objBankUdbetalingsUdskrift = null;
                    objOverfoersel.overfoersel_mail(Program.dbData3060, lobnr);
                    clsSumma objSumma = new clsSumma();
                    objSumma.BogforUdBetalinger(lobnr);
                }
                this.pgmBetal.Value           = (imax * 4);
                cmdBetal.Text                 = "Afslut";
                this.Label_Betaltekst.Text    = ("Leverance til PBS i filen " + TilPBSFilename);
                this.Label_Betaltekst.Visible = true;
                this.pgmBetal.Visible         = false;
            }
        }
Beispiel #2
0
        private void cmdBetal_Click(object sender, EventArgs e)
        {
            string  TilPBSFilename = "Unknown";
            int     AntalBetalinger;
            int     imax;
            string  keyval;
            int     Nr;
            int     faknr;
            decimal advisbelob;
            string  Bank;

            if ((this.cmdBetal.Text == "Afslut"))
            {
                this.Close();
            }
            this.cmdForslag.Visible = false;
            this.cmdCancel.Visible  = false;
            imax = lvwKrdFaktura.Items.Count;
            this.pgmBetal.Maximum = (imax * 4);
            this.pgmBetal.Minimum = 0;
            this.pgmBetal.Value   = 0;
            this.pgmBetal.Visible = true;
            Program.dbData3060.TempBetalforslag.DeleteAllOnSubmit(Program.dbData3060.TempBetalforslag);
            Program.dbData3060.SubmitChanges();
            if ((imax == 0))
            {
                this.Label_Betaltekst.Text    = "Der ikke noget at betale";
                this.Label_Betaltekst.Visible = true;
            }
            else
            {
                TempBetalforslag rec_tempBetalforslag = new TempBetalforslag
                {
                    Betalingsdato = DateTime.Now,
                };
                Program.dbData3060.TempBetalforslag.InsertOnSubmit(rec_tempBetalforslag);
                var i = 0;
                foreach (ListViewItem lvi in lvwKrdFaktura.Items)
                {
                    this.pgmBetal.Value = ++i;
                    keyval     = lvi.Name;
                    Nr         = int.Parse(lvi.SubItems[1].Text);
                    faknr      = int.Parse(lvi.SubItems[4].Text);
                    advisbelob = decimal.Parse(lvi.SubItems[5].Text);
                    Bank       = lvi.SubItems[6].Text;

                    TempBetalforslaglinie rec_tempBetalforslaglinie = new TempBetalforslaglinie
                    {
                        Nr          = Nr,
                        Fakid       = int.Parse(keyval),
                        Advisbelob  = (decimal)advisbelob,
                        Bankregnr   = Bank.Substring(0, 4),
                        Bankkontonr = Bank.Substring(5, 10),
                        Faknr       = faknr,
                    };
                    rec_tempBetalforslag.TempBetalforslaglinie.Add(rec_tempBetalforslaglinie);
                }
                Program.dbData3060.SubmitChanges();

                clsOverfoersel objOverfoersel = new clsOverfoersel();
                nsPuls3060.clsOverfoersel.SetLobnr += new nsPuls3060.clsOverfoersel.OverfoerselDelegateHandler(On_clsOverfoersel_SetLobnr);

                AntalBetalinger     = objOverfoersel.kreditor_fakturer_os1();
                this.pgmBetal.Value = imax * 2;
                if ((AntalBetalinger > 0))
                {
                    objOverfoersel.krdfaktura_overfoersel_action(m_lobnr);
                    this.pgmBetal.Value = (imax * 3);
                    clsSFTP objSFTP = new clsSFTP();
                    TilPBSFilename = objSFTP.WriteTilSFtp(m_lobnr);
                    objSFTP.DisconnectSFtp();
                    objSFTP = null;
                    objOverfoersel.overfoersel_mail(m_lobnr);
                    clsSumma objSumma = new clsSumma();
                    objSumma.BogforUdBetalinger(m_lobnr);
                }
                this.pgmBetal.Value           = (imax * 4);
                cmdBetal.Text                 = "Afslut";
                this.Label_Betaltekst.Text    = ("Leverance til PBS i filen " + TilPBSFilename);
                this.Label_Betaltekst.Visible = true;
                this.pgmBetal.Visible         = false;
            }
        }