Example #1
0
        //WebBrowser wbh;
        private void HTML_VIEW()
        {
            string USERNAME = _GLOBAL_PARAMETERS._KULLANICI_ADI_SOYADI.Replace(".", "");
            //  if (File.Exists(appPath + @"_PRINT\" + USERNAME + "TMP.html")) File.Delete(appPath + @"_PRINT\" +  USERNAME + "TMP.html");

            DataRow dr = gridView_LIST.GetFocusedDataRow();
            string  xmlfl = "", xsltfl = "";

            if (dr != null)
            {
                DateTime FILEYEAR_ = Convert.ToDateTime(dr["DATE_"].ToString());
                string   GIBFILE   = _GLOBAL_PARAMETERS._SIRKET_KODU + FILEYEAR_.ToString("yyyy") + "_" + dr["FICHENO"].ToString();
                BR_FILE.Caption = appPath + @"_OUTBOX_PRINT\" + _GLOBAL_PARAMETERS._SIRKET_KODU + @"\" + GIBFILE + ".xml";
                xmlfl           = appPath + @"_OUTBOX_PRINT\" + _GLOBAL_PARAMETERS._SIRKET_KODU + @"\" + GIBFILE + ".xml";
                xsltfl          = appPath + @"_XSLT\" + _GLOBAL_PARAMETERS._SIRKET_KODU + @"\GENERIC_TEMPLATE.xslt";
                if (!File.Exists(xmlfl))
                {
                    UBL.ERP_CREATE_XML_PRINT createxml = new UBL.ERP_CREATE_XML_PRINT();
                    createxml.Create(_GLOBAL_PARAMETERS._SIRKET_KODU, Cfg, dr, "_OUTBOX_PRINT");
                    //e_master.SmartInv.UBL.LOGO_CREATEXML_PRINT createxml = new UBL.LOGO_CREATEXML_PRINT();
                    //xmlfl = createxml.Create(Masters._firmaKodu, Cfg, dr, "_OUTBOX_PRINT");
                }
                if (xsltfl != "")
                {
                    if (File.Exists(xmlfl))
                    {
                        wbh = null;
                        wbh = new WebBrowser();
                        XslCompiledTransform XSLT     = new XslCompiledTransform();
                        XsltSettings         settings = new XsltSettings();
                        settings.EnableScript = true;
                        XSLT.Load(xsltfl, settings, new XmlUrlResolver());
                        XSLT.Transform(xmlfl, @"c:\temp\_PRINT\" + USERNAME + "TMP.html");
                        //UBL_VIEWER vv = new UBL_VIEWER();
                        String appdir = Path.GetDirectoryName(Application.ExecutablePath);
                        String myfile = Path.Combine(appdir, @"c:\temp\_PRINT\" + USERNAME + "TMP.html");
                        wbh.Url = new Uri("file:///" + myfile);
                        Show();
                        wbh.ScrollBarsEnabled      = true;
                        wbh.ScriptErrorsSuppressed = true;
                        // wbh.Document.Body.Style = "zoom:75%;";
                        // wbh.Document.Body.Style += ";zoom:" + 75;
                        pnlControl_INVVIEW.Controls.Add(wbh);
                        wbh.Dock = DockStyle.Fill;
                        wbh.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(wbh_DocumentCompleted);
                        wbh.Refresh();
                        //  wbh.Document.Body.Style += ";zoom:95%;";
                        wbh.BringToFront();
                        //wbh.Print();
                    }
                    else
                    {
                        MessageBox.Show("xml file erişilemedi.");
                    }
                }
            }
        }
Example #2
0
 private void BTN_FATURA_OLUSTUR_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     int[] selectedRows = gridView_LIST.GetSelectedRows();
     for (int ix = 0; ix <= selectedRows.Length - 1; ix++)
     {
         dr = gridView_LIST.GetDataRow(selectedRows[ix]);
         //e_master.SmartInv.UBL.LOGO_CREATEXML_PRINT createxml = new UBL.LOGO_CREATEXML_PRINT();
         UBL.ERP_CREATE_XML_PRINT createxml = new UBL.ERP_CREATE_XML_PRINT();
         createxml.Create(_GLOBAL_PARAMETERS._SIRKET_KODU, Cfg, dr, "_OUTBOX_PRINT");
     }
     DATA_LOAD();
     // Show a sample alert window.
     // info.Text += "Son İndirme : " + DateTime.Now.ToShortTimeString() + Environment.NewLine;
     info.Text += "Oluşturulan Fatura Sayısı : " + selectedRows.Length + Environment.NewLine;
     alertControls.Show(this, info);
     // MessageBox.Show("Dosyalar Oluşturuldu");
 }
Example #3
0
        private void YAZDIR()
        {
            int[] selectedRows = gridView_LIST.GetSelectedRows();
            for (int ix = 0; ix <= selectedRows.Length - 1; ix++)
            {
                string USERNAME = _GLOBAL_PARAMETERS._KULLANICI_ADI_SOYADI.Replace(".", "");
                if (File.Exists(@"c:\temp\_PRINT\" + ix + USERNAME + "TMP.html"))
                {
                    File.Delete(@"c:\temp\_PRINT\" + ix + USERNAME + "TMP.html");
                }

                DataRow dr = gridView_LIST.GetDataRow(selectedRows[ix]);
                pnlControl_INVVIEW.Controls.Clear();
                string xmlfl = "", xsltfl = "";

                if (dr != null)
                {
                    BR_FILE.Caption = appPath + @"_OUTBOX_PRINT\" + _GLOBAL_PARAMETERS._SIRKET_KODU + @"\" + dr["FICHENO"] + ".xml";
                    xmlfl           = appPath + @"_OUTBOX_PRINT\" + _GLOBAL_PARAMETERS._SIRKET_KODU + @"\" + dr["FICHENO"] + ".xml";
                    xsltfl          = appPath + @"_XSLT\" + _GLOBAL_PARAMETERS._SIRKET_KODU + @"\GENERIC_TEMPLATE.xslt";/// +dr["FICHENO"] + "_" + dr["GUID"] + ".xslt";
                    if (!File.Exists(xmlfl))
                    {
                        UBL.ERP_CREATE_XML_PRINT createxml = new UBL.ERP_CREATE_XML_PRINT();
                        string FILE_NAME = createxml.Create(_GLOBAL_PARAMETERS._SIRKET_KODU, Cfg, dr, "_OUTBOX_PRINT");
                    }

                    if (xsltfl != "")
                    {
                        if (File.Exists(xmlfl))
                        {
                            if (File.Exists(xsltfl))
                            {
                                wbh = null;
                                wbh = new WebBrowser();
                                System.Threading.Thread.Sleep(700);
                                XslCompiledTransform XSLT     = new XslCompiledTransform();
                                XsltSettings         settings = new XsltSettings();
                                settings.EnableScript = true;
                                XSLT.Load(xsltfl, settings, new XmlUrlResolver());
                                XSLT.Transform(xmlfl, @"c:\temp\_PRINT\" + ix + USERNAME + "TMP.html");

                                String    appdir = Path.GetDirectoryName(Application.ExecutablePath);
                                String    myfile = Path.Combine(appdir, @"c:\temp\_PRINT\" + ix + USERNAME + "TMP.html");
                                WaitPrint vv     = new WaitPrint(myfile, ix);
                                vv.ShowDialog();
                                vv.Dispose();
                            }
                            //  wbh.Url = new Uri("file:///" + myfile);
                            //  wbh.Refresh();

                            // // wbh.Show();
                            //  //// Show();
                            //  //wbh.ScrollBarsEnabled = true;
                            //  //wbh.ScriptErrorsSuppressed = true;
                            //  //pnlControl_INVVIEW.Controls.Add(wbh);
                            //  //wbh.Dock = DockStyle.Fill;
                            //  //wbh.BringToFront();
                            ////  wbh.Refresh();
                            //  wbh.Print();
                        }
                    }
                }
            }
        }
Example #4
0
        private void BTN_PDF_MAIL_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            FILE_NAME_ADRESS = "";
            int[] selectedRows = gridView_LIST.GetSelectedRows();
            for (int ix = 0; ix <= selectedRows.Length - 1; ix++)
            {
                string  USERNAME = _GLOBAL_PARAMETERS._KULLANICI_ADI_SOYADI.Replace(".", "");
                DataRow dr       = gridView_LIST.GetDataRow(selectedRows[ix]);
                pnlControl_INVVIEW.Controls.Clear();
                string xmlfl = "", xsltfl = "";
                if (dr != null)
                {
                    BR_FILE.Caption = appPath + @"_OUTBOX\" + _GLOBAL_PARAMETERS._SIRKET_KODU + @"\" + dr["FICHENO"] + ".xml";
                    xmlfl           = appPath + @"_OUTBOX\" + _GLOBAL_PARAMETERS._SIRKET_KODU + @"\" + dr["FICHENO"] + ".xml";
                    xsltfl          = appPath + @"_XSLT\" + _GLOBAL_PARAMETERS._SIRKET_KODU + @"\GENERIC_TEMPLATE.xslt";
                    if (!File.Exists(xmlfl))
                    {
                        UBL.ERP_CREATE_XML_PRINT createxml = new UBL.ERP_CREATE_XML_PRINT();
                        string FILE_NAME = createxml.Create(_GLOBAL_PARAMETERS._SIRKET_KODU, Cfg, dr, "_OUTBOX_PRINT");
                    }
                    if (xsltfl != "")
                    {
                        if (File.Exists(xmlfl))
                        {
                            if (xsltfl != "")
                            {
                                if (File.Exists(xmlfl))
                                {
                                    wbh = null;
                                    wbh = new WebBrowser();

                                    // System.Threading.Thread.Sleep(100);
                                    if (File.Exists(@"c:\temp\_PRINT\" + ix + USERNAME + "TMP.html"))
                                    {
                                        File.Delete(@"c:\temp\_PRINT\" + ix + USERNAME + "TMP.html");
                                    }
                                    XslCompiledTransform XSLT     = new XslCompiledTransform();
                                    XsltSettings         settings = new XsltSettings();
                                    settings.EnableScript = true;
                                    XSLT.Load(xsltfl, settings, new XmlUrlResolver());
                                    XSLT.Transform(xmlfl, @"c:\temp\_PRINT\" + ix + USERNAME + "TMP.html");

                                    WKHtmlToPdf(@"c:\temp\_PRINT\" + ix + USERNAME + "TMP.html", @"c:\temp\_PRINT\", dr["FICHENO"] + ".pdf");
                                    string     sFile         = @"c:\temp\_PRINT\" + dr["FICHENO"] + ".pdf";
                                    FileStream objfilestream = new FileStream(sFile, FileMode.Open, FileAccess.Read);
                                    int        len           = (int)objfilestream.Length;
                                    Byte[]     mybytearray   = new Byte[len];
                                    objfilestream.Read(mybytearray, 0, len);
                                    WebServices.SALES_INVOICES savedocument = new WebServices.SALES_INVOICES();
                                    savedocument.SaveDocument(mybytearray, sFile.Remove(0, sFile.LastIndexOf("\\") + 1));
                                    objfilestream.Close();
                                    FILE_NAME_ADRESS += (dr["FICHENO"] + ".pdf") + ";";
                                }
                                else
                                {
                                    MessageBox.Show("xml file erişilemedi.");
                                }
                            }
                        }
                    }
                }
            }

            MAIL_TO_SEND snd = new MAIL_TO_SEND();

            snd.ShowDialog();
            if (snd._Button != "CANCEL")
            {
                WebServices.SALES_INVOICES fr = new WebServices.SALES_INVOICES();
                fr.SendMailAsync("noreply." + _GLOBAL_PARAMETERS._SIRKET_KODU + "@groupm.com", snd.to.ToString(), snd.subject.ToString(), snd.aciklama.ToString(), FILE_NAME_ADRESS);
                fr.SendMailCompleted += fr_SendMailCompleted;
            }
        }
Example #5
0
        private void BTN_PDF_SAVE_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            FolderBrowserDialog brwsr = new FolderBrowserDialog();

            if (brwsr.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }
            else
            {
                int[] selectedRows = gridView_LIST.GetSelectedRows();
                for (int ix = 0; ix <= selectedRows.Length - 1; ix++)
                {
                    string  USERNAME = _GLOBAL_PARAMETERS._KULLANICI_ADI_SOYADI.Replace(".", "");
                    DataRow dr       = gridView_LIST.GetDataRow(selectedRows[ix]);
                    pnlControl_INVVIEW.Controls.Clear();
                    string xmlfl = "", xsltfl = "";
                    if (dr != null)
                    {
                        BR_FILE.Caption = appPath + @"_OUTBOX\" + _GLOBAL_PARAMETERS._SIRKET_KODU + @"\" + dr["FICHENO"] + ".xml";
                        xmlfl           = appPath + @"_OUTBOX\" + _GLOBAL_PARAMETERS._SIRKET_KODU + @"\" + dr["FICHENO"] + ".xml";
                        xsltfl          = appPath + @"_XSLT\" + _GLOBAL_PARAMETERS._SIRKET_KODU + @"\GENERIC_TEMPLATE.xslt";/// +dr["FICHENO"] + "_" + dr["GUID"] + ".xslt";
                    }
                    if (!File.Exists(xmlfl))
                    {
                        // e_master.SmartInv.UBL.LOGO_CreateXML createxml = new UBL.LOGO_CreateXML();
                        UBL.ERP_CREATE_XML_PRINT createxml = new UBL.ERP_CREATE_XML_PRINT();
                        string FILE_NAME = createxml.Create(_GLOBAL_PARAMETERS._SIRKET_KODU, Cfg, dr, "_OUTBOX_PRINT");
                    }
                    if (xsltfl != "")
                    {
                        if (File.Exists(xmlfl))
                        {
                            if (xsltfl != "")
                            {
                                if (File.Exists(xmlfl))
                                {
                                    wbh = null;
                                    wbh = new WebBrowser();
                                    System.Threading.Thread.Sleep(100);
                                    if (File.Exists(@"c:\temp\_PRINT\" + ix + USERNAME + "TMP.html"))
                                    {
                                        File.Delete(@"c:\temp\_PRINT\" + ix + USERNAME + "TMP.html");
                                    }
                                    XslCompiledTransform XSLT     = new XslCompiledTransform();
                                    XsltSettings         settings = new XsltSettings();
                                    settings.EnableScript = true;
                                    XSLT.Load(xsltfl, settings, new XmlUrlResolver());
                                    XSLT.Transform(xmlfl, @"c:\temp\_PRINT\" + ix + USERNAME + "TMP.html");
                                    //String appdir = Path.GetDirectoryName(Application.ExecutablePath);
                                    //String myfile = Path.Combine(appdir, appPath + @"_PRINT\" + ix + USERNAME + "TMP.html");
                                    //WaitPrint vv = new WaitPrint(myfile, ix);
                                    //vv.ShowDialog();
                                    //vv.Dispose();
                                    WKHtmlToPdf(@"c:\temp\_PRINT\" + ix + USERNAME + "TMP.html", brwsr.SelectedPath, dr["FICHENO"] + ".pdf");
                                }
                                else
                                {
                                    MessageBox.Show("xml file erişilemedi.");
                                }
                            }
                        }
                    }
                }
                MessageBox.Show(selectedRows.Length + " Adet Dosya Kaydedildi");
            }
        }