Пример #1
0
        private void RecalcPrice()
        {
            databindings.q1 A = new databindings.q1();
            { A.lq1 = string.Format("{0:C}", Convert.ToDecimal(vari.p1 * PriceMulti * 100) / 100); }
            this.lq1.DataContext = A;

            databindings.q2 B = new databindings.q2();
            { B.lq2 = string.Format("{0:C}", Convert.ToDecimal(vari.p2 * PriceMulti * 100) / 100); }
            this.lq2.DataContext = B;

            databindings.q3 C = new databindings.q3();
            { C.lq3 = string.Format("{0:C}", Convert.ToDecimal(vari.p3 * PriceMulti * 100) / 100); }
            this.lq3.DataContext = C;

            databindings.q4 D = new databindings.q4();
            { D.lq4 = string.Format("{0:C}", Convert.ToDecimal(vari.p4 * PriceMulti * 100) / 100); }
            this.lq4.DataContext = D;
        }
Пример #2
0
        private void PreCalcExcel()
        {
            Excel.Application xlApp;
            Excel.Workbook    xlWorkBook;
            Excel.Worksheet   xlWorkSheet;
            object            misValue = System.Reflection.Missing.Value;

            xlApp               = new Excel.Application();
            xlWorkBook          = xlApp.Workbooks.Open(vari.DefaultDirectory + vari.MicaTemplateName, 0, false, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
            xlWorkSheet         = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
            xlApp.DisplayAlerts = false;
            //MessageBox.Show(xlWorkSheet.get_Range("B3").Value.ToString());

            //WRITE DATA TO EXCEL SHEET
            xlWorkSheet.Cells[3, 3]  = myComboBox.Text;
            xlWorkSheet.Cells[4, 3]  = tbQty1.Text;
            xlWorkSheet.Cells[5, 3]  = tbQty2.Text;
            xlWorkSheet.Cells[6, 3]  = tbQty3.Text;
            xlWorkSheet.Cells[7, 3]  = tbQty4.Text;
            xlWorkSheet.Cells[9, 3]  = tbSeg.Text;
            xlWorkSheet.Cells[10, 3] = cmbLockup.Text;
            xlWorkSheet.Cells[11, 3] = tbDia.Text;
            xlWorkSheet.Cells[12, 3] = tbWidth.Text;
            xlWorkSheet.Cells[13, 3] = cmbTermStyle.Text;
            xlWorkSheet.Cells[14, 3] = tbLeads.Text;
            xlWorkSheet.Cells[15, 3] = tbLeadCov.Text;
            xlWorkSheet.Cells[16, 3] = tbWatts.Text;
            xlWorkSheet.Cells[17, 3] = tbVolts.Text;
            xlWorkSheet.Cells[19, 3] = tbHoles.Text;
            xlWorkSheet.Cells[20, 3] = tbCutouts.Text;
            xlWorkSheet.Cells[21, 3] = cmbTermLoc.Text;
            xlWorkSheet.Cells[22, 3] = tbTermMeasure.Text;
            xlWorkSheet.Cells[23, 3] = tbMulti.Text;
            xlWorkSheet.Cells[20, 6] = tbSpecials.Text;
            xlWorkSheet.Cells[3, 13] = tbSMT.Text;
            xlWorkSheet.Cells[3, 4]  = lMulti.Text;
            xlWorkSheet.Cells[7, 13] = tbManualAdder.Text;

            databindings.q1 A = new databindings.q1();
            { A.lq1 = string.Format("{0:C}", Convert.ToDecimal(xlWorkSheet.get_Range("F4").Value)); }
            this.lq1.DataContext = A;
            vari.p1 = xlWorkSheet.get_Range("F4").Value;
            databindings.q2 B = new databindings.q2();
            { B.lq2 = string.Format("{0:C}", Convert.ToDecimal(xlWorkSheet.get_Range("F5").Value)); }
            this.lq2.DataContext = B;
            vari.p2 = xlWorkSheet.get_Range("F5").Value;
            databindings.q3 C = new databindings.q3();
            { C.lq3 = string.Format("{0:C}", Convert.ToDecimal(xlWorkSheet.get_Range("F6").Value)); }
            this.lq3.DataContext = C;
            vari.p3 = xlWorkSheet.get_Range("F6").Value;
            databindings.q4 D = new databindings.q4();
            { D.lq4 = string.Format("{0:C}", Convert.ToDecimal(xlWorkSheet.get_Range("F7").Value)); }
            this.lq4.DataContext = D;
            vari.p4 = xlWorkSheet.get_Range("F7").Value;

            databindings.PN E = new databindings.PN();
            { E.lPN = string.Format("{0:C}", xlWorkSheet.get_Range("C1").Value); }
            this.lPN.DataContext = E;
            vari.pn = xlWorkSheet.get_Range("C1").Text;

            vari.desc = xlWorkSheet.get_Range("B26").Text;


            xlWorkBook.SaveAs(vari.TempDir + vari.MicaTemplateName);
            xlWorkBook.Close(true, misValue, misValue);
            xlApp.Quit();

            releaseObject(xlWorkSheet);
            releaseObject(xlWorkBook);
            releaseObject(xlApp);

            AddersCalc2();
        }
        private void PreCalcExcel()
        {
            Excel.Application xlApp;
            Excel.Workbook    xlWorkBook;
            Excel.Worksheet   xlWorkSheet;
            object            misValue = System.Reflection.Missing.Value;

            xlApp               = new Excel.Application();
            xlWorkBook          = xlApp.Workbooks.Open(vari.DefaultDirectory + vari.CartTemplateName, 0, false, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
            xlWorkSheet         = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
            xlApp.DisplayAlerts = false;

            //WRITE DATA TO EXCEL SHEET
            xlWorkSheet.Cells[3, 4] = myComboBox.Text;
            xlWorkSheet.Cells[3, 7] = lMulti.Text;
            xlWorkSheet.Cells[4, 4] = tbQty1.Text;
            xlWorkSheet.Cells[5, 4] = tbQty2.Text;
            xlWorkSheet.Cells[6, 4] = tbQty3.Text;
            xlWorkSheet.Cells[7, 4] = tbQty4.Text;

            xlWorkSheet.Cells[8, 4]  = cmbDiameter.Text;
            xlWorkSheet.Cells[9, 4]  = tbLength.Text;
            xlWorkSheet.Cells[10, 4] = cmbTermStyle.Text;
            xlWorkSheet.Cells[11, 4] = tbLeads.Text;
            xlWorkSheet.Cells[12, 4] = tbLeadCov.Text;
            xlWorkSheet.Cells[13, 4] = tbWatts.Text;
            xlWorkSheet.Cells[14, 4] = tbVolts.Text;

            xlWorkSheet.Cells[16, 4] = tbLabor.Text;
            xlWorkSheet.Cells[9, 15] = tbManualAdder.Text;

            xlWorkSheet.Cells[18, 4] = tbSpecials.Text;

            xlWorkSheet.Cells[3, 15] = tbSMT.Text;

            databindings.q1 A = new databindings.q1();
            { A.lq1 = string.Format("{0:C}", Convert.ToDecimal(xlWorkSheet.get_Range("G4").Value)); }
            this.lq1.DataContext = A;
            vari.p1 = xlWorkSheet.get_Range("G4").Value;
            databindings.q2 B = new databindings.q2();
            { B.lq2 = string.Format("{0:C}", Convert.ToDecimal(xlWorkSheet.get_Range("G5").Value)); }
            this.lq2.DataContext = B;
            vari.p2 = xlWorkSheet.get_Range("G5").Value;
            databindings.q3 C = new databindings.q3();
            { C.lq3 = string.Format("{0:C}", Convert.ToDecimal(xlWorkSheet.get_Range("G6").Value)); }
            this.lq3.DataContext = C;
            vari.p3 = xlWorkSheet.get_Range("G6").Value;
            databindings.q4 D = new databindings.q4();
            { D.lq4 = string.Format("{0:C}", Convert.ToDecimal(xlWorkSheet.get_Range("G7").Value)); }
            this.lq4.DataContext = D;
            vari.p4 = xlWorkSheet.get_Range("G7").Value;

            databindings.PN E = new databindings.PN();
            { E.lPN = string.Format("{0:C}", xlWorkSheet.get_Range("D1").Value); }
            this.lPN.DataContext = E;
            vari.pn = xlWorkSheet.get_Range("D1").Text;

            xlWorkBook.SaveAs(vari.TempDir + vari.CartTemplateName);
            xlWorkBook.Close(true, misValue, misValue);
            xlApp.Quit();

            releaseObject(xlWorkSheet);
            releaseObject(xlWorkBook);
            releaseObject(xlApp);

            AddersCalc2();
        }