Ejemplo n.º 1
0
        private void Send_btn_Click(object sender, EventArgs e)
        {
            if (Tabs_cbx.Text == "")
            {
                MessageBox.Show("Please Select a Tab", "Select a Tab", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Tabs_cbx.Focus();
                return;
            }
            PlanSwift.Tab CurrentTab;
            CurrentTab = TGlobal.pc.Tabs.ByName(Tabs_cbx.Text);
            CurrentTab.MakeActive();
            AuCad         = new Autodesk.AutoCAD.Interop.AcadApplication();
            AuCad.Visible = true;
            AuDocument    = AuCad.ActiveDocument;

            for (int ItemIndex = 0; ItemIndex <= CurrentTab.Count - 1; ItemIndex++)
            {
                GetItems(CurrentTab[ItemIndex]);
            }

            AuCad.ZoomAll();
            AuCad      = null;
            AuDocument = null;
            this.Close();
        }
Ejemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (Tabs_cbx.Text == "")
            {
                MessageBox.Show("Please Select a Tab", "Select a Tab", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Tabs_cbx.Focus();
                return;
            }
            //Excel.Application oExcel;
            //Excel._Workbook oWBook;
            //Excel._Worksheet oSheet;
            //PlanSwift.Tab CurrentTab;
            int i = 0;

            // Start Excel and get Application object
            oExcel = new Excel.Application();

            // Create new Workbook
            oWBook = (Excel._Workbook)(oExcel.Workbooks.Add(Missing.Value));
            oSheet = (Excel._Worksheet)oWBook.ActiveSheet;
            // Add Header Information
            oSheet.Cells[1, 1] = "Tab";
            oSheet.Cells[1, 2] = "Name";
            oSheet.Cells[1, 3] = "Item Number";
            oSheet.Cells[1, 4] = "Qty";
            oSheet.Cells[1, 5] = "Price Each";
            oSheet.Cells[1, 6] = "Price Total";
            oSheet.Cells[1, 7] = "Item Type";
            // Apply Header Formating
            oSheet.get_Range("A1", "G1").Font.Bold         = true;
            oSheet.get_Range("A1", "G1").VerticalAlignment = Excel.XlVAlign.xlVAlignCenter;

            //Get Selected Planswift Tab
            CurrentTab = TGlobal.pc.Tabs.ByName(Tabs_cbx.Text);
            CurrentTab.MakeActive();
            for (int ItemIndex = 0; ItemIndex <= CurrentTab.Count - 1; ItemIndex++)
            {
                GetItems(CurrentTab[ItemIndex]);
                i = ItemIndex;
            }
            oSheet.get_Range("A1", "G1").EntireColumn.AutoFit();
            oExcel.Visible = true;
            oExcel         = null;
            oWBook         = null;
            oSheet         = null;
        }
Ejemplo n.º 3
0
        private void Send_btn_Click(object sender, EventArgs e)
        {
            if (Tabs_cbx.Text == "")
            {
                MessageBox.Show("Please Select a Tab", "Select a Tab", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Tabs_cbx.Focus();
                return;
            }

            // Start Word and Get Application Object
            oWord = new Word.Application();
            PlanSwift.Tab CurrentTab;
            oWord.Visible = true;
            object FilePath  = Environment.CurrentDirectory + @"\Templates\Work Order.dotx";
            object Readonly  = false;
            object missing   = System.Reflection.Missing.Value;
            object isVisible = true;
            object TStyle    = "Medium Shading 1 - Accent 1";

            //Open Template
            oDocument = (Word._Document)oWord.Documents.Open(ref FilePath, ref missing, ref Readonly, ref missing, ref missing,
                                                             ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref isVisible,
                                                             ref missing, ref missing, ref missing, ref missing);
            // Apply Table Formating Style
            oDocument.Tables[2].set_Style(ref TStyle);
            oDocument.Tables[2].Columns[3].Width = 40;
            oDocument.Tables[2].Columns[4].Width = 70;

            // Get Planswift Items
            CurrentTab = TGlobal.pc.Tabs.ByName(Tabs_cbx.Text);
            CurrentTab.MakeActive();
            for (int ItemIndex = 0; ItemIndex <= CurrentTab.Count - 1; ItemIndex++)
            {
                GetItems(CurrentTab[ItemIndex]);
            }

            //Delete Last unused Row
            oDocument.Tables[2].Rows[ItemNumber].Delete();
            //Free Microsoft Word
            oWord     = null;
            oDocument = null;
            this.Close();
        }
Ejemplo n.º 4
0
        private void send_btn_Click(object sender, EventArgs e)
        {
            if (Tabs_cbx.Text == "")
            {
                MessageBox.Show("Please Select a Tab", "Select a Tab", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Tabs_cbx.Focus();
                return;
            }
            OLook = new OutLook.Application();

            OMail = (OutLook.MailItem)OLook.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem);
            OMail.Display(OMail);
            OMail.To      = to_txt.Text;
            OMail.CC      = CC_txt.Text;
            OMail.Subject = Subject_txt.Text;
            CurrentTab    = TGlobal.pc.Tabs.ByName(Tabs_cbx.Text);
            CurrentTab.MakeActive();
            for (int ItemIndex = 0; ItemIndex <= CurrentTab.Count - 1; ItemIndex++)
            {
                GetItems(CurrentTab[ItemIndex]);
            }
            OMail.BodyFormat = Microsoft.Office.Interop.Outlook.OlBodyFormat.olFormatHTML;
            OMail.HTMLBody   = "<HTML><body><b>Job Name: </b>" + TGlobal.pc.JobNumber +
                               "<br><b>Description: </b>" + TGlobal.pc.JobName + "<br><br><i><b>Item Types</b></i><br>";
            OMail.HTMLBody = OMail.HTMLBody + "<Table width=" + chr + "400" +
                             chr + "Height=" + chr + "9" + chr + ">";
            for (int HtmLoop = 0; HtmLoop <= 1; HtmLoop++)
            {
                if (HtmLoop > 0)
                {
                    OMail.HTMLBody = OMail.HTMLBody + "</Table><br><i><b>Total Quantity’s</b></i>";
                    OMail.HTMLBody = OMail.HTMLBody + "<Table width=" + chr + "400" + chr + "Height=" + chr + "9" + chr + ">";
                }
                String ArrCount;
                if (Folders_ck.Checked)
                {
                    if (HtmLoop == 0)
                    {
                        ArrCount = System.Convert.ToString(FolderArry.Count);
                        AddHtml("Folders", ArrCount);
                    }
                }
                if (Assem_ck.Checked)
                {
                    if (HtmLoop > 0)
                    {
                        ArrCount = GetSum(AssemblyQArry);
                    }
                    else
                    {
                        ArrCount = System.Convert.ToString(AssemblyQArry.Count);
                    }
                    AddHtml("Assemblies", ArrCount);
                }
                if (Parts_ck.Checked)
                {
                    if (HtmLoop > 0)
                    {
                        ArrCount = GetSum(PartQArry);
                    }
                    else
                    {
                        ArrCount = System.Convert.ToString(PartQArry.Count);
                    }
                    AddHtml("Parts", ArrCount);
                }
                if (Area_ck.Checked)
                {
                    if (HtmLoop > 0)
                    {
                        ArrCount = GetSum(AreaQArry);
                    }
                    else
                    {
                        ArrCount = System.Convert.ToString(AreaQArry.Count);
                    }
                    AddHtml("Areas", ArrCount);
                }
                if (Linear_ck.Checked)
                {
                    if (HtmLoop > 0)
                    {
                        ArrCount = GetSum(LinearQArry);
                    }
                    else
                    {
                        ArrCount = System.Convert.ToString(LinearQArry.Count);
                    }
                    AddHtml("Linears", ArrCount);
                }
                if (Segment_ck.Checked)
                {
                    if (HtmLoop > 0)
                    {
                        ArrCount = GetSum(SegmentQArry);
                    }
                    else
                    {
                        ArrCount = System.Convert.ToString(SegmentQArry.Count);
                    }
                    AddHtml("Segments", ArrCount);
                }
                if (Count_ck.Checked)
                {
                    if (HtmLoop > 0)
                    {
                        ArrCount = GetSum(CountQArry);
                    }
                    else
                    {
                        ArrCount = System.Convert.ToString(CountQArry.Count);
                    }
                    AddHtml("Counts", ArrCount);
                }
            }
            OMail.HTMLBody = OMail.HTMLBody + "</Table></body></HTML>";
            OLook          = null;
            OMail          = null;
            this.Close();
        }