예제 #1
0
        private void betalingerFraPBSToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string bigString        = null;
            string smallString      = null;
            int    AntalImportFiler = 0;

            clsPbs601 objPbs601 = new clsPbs601();
            clsPbs602 objPbs602 = new clsPbs602();
            clsPbs603 objPbs603 = new clsPbs603();
            clsPbs686 objPbs686 = new clsPbs686();

            clsSFTP objSFTP = new clsSFTP(Program.dbData3060);

            AntalImportFiler = objSFTP.ReadFraSFtp(Program.dbData3060);  //Læs direkte SFTP
            objSFTP.DisconnectSFtp();
            objSFTP = null;
            //AntalImportFiler = objPbs602.ReadFraPbsFile(); //Læs fra Directory FraPBS

            int Antal602Filer = objPbs602.betalinger_fra_pbs(Program.dbData3060);
            int Antal603Filer = objPbs603.aftaleoplysninger_fra_pbs(Program.dbData3060);
            int Antal686Filer = objPbs686.aftaleoplysninger_fra_pbs(Program.dbData3060);

            Tuple <int, int> tresult = objPbs601.advis_auto(Program.dbData3060);
            int AntalAdvis           = tresult.Item1;
            int lobnr = tresult.Item2;

            if ((AntalAdvis > 0))
            {
                objPbs601.advis_email(Program.dbData3060, lobnr);
            }

            clsSumma objSumma        = new clsSumma();
            int      AntalBetalinger = objSumma.BogforIndBetalinger();

            if (AntalBetalinger > 0)
            {
                bigString = String.Format("Der er {0} bogførte betalinger.", AntalBetalinger);
            }
            else
            {
                bigString = "Der er ingen nye betalinger";
            }
            smallString = String.Format("Antal indlæste filer fra PBS: {0} \nAntal nye 602 filer: {1}\nAntal nye 603 filer: {3}\nAntal nye 686 filer: {4}\nAntal nye betalinger: {2}.", AntalImportFiler, Antal602Filer, AntalBetalinger, Antal603Filer, Antal686Filer);



            DialogResult result = DotNetPerls.BetterDialog.ShowDialog(
                "Filer fra PBS",                                         //titleString
                bigString,                                               //bigString
                smallString,                                             //smallString
                null,                                                    //leftButton
                "OK",                                                    //rightButton
                global::nsPuls3060v2.Properties.Resources.Message_info); //iconSet
        }
예제 #2
0
        private void cmdBetal_Click(object sender, EventArgs e)
        {
            string  TilPBSFilename = "Unknown";
            int     AntalBetalinger;
            int     lobnr;
            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.RemoveRange(Program.dbData3060.tempBetalforslag);
            Program.dbData3060.SaveChanges();
            if ((imax == 0))
            {
                this.Label_Betaltekst.Text    = "Der ikke noget at betale";
                this.Label_Betaltekst.Visible = true;
            }
            else
            {
                nsPbs3060v2.tempBetalforslag rec_tempBetalforslag = new nsPbs3060v2.tempBetalforslag
                {
                    betalingsdato = DateTime.Now,
                };
                Program.dbData3060.tempBetalforslag.Add(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;

                    nsPbs3060v2.tempBetalforslaglinie rec_tempBetalforslaglinie = new nsPbs3060v2.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.SaveChanges();

                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;
            }
        }