コード例 #1
0
ファイル: frmFacturacion.cs プロジェクト: radtek/gnsoft
        private void CrearDocumentoXML(string documentoReceptor, string nombreReceptor, String montoNetoIva, String porcentajeIva, String interesCuota, String ivaCuota, String mora, String ivaMora)
        {
            string fechaFacturacion = DateTime.Today.ToString("yyyy-MM-dd");

            //Datos del documento
            var documento = new Dictionary <string, string>();

            documento["FchEmis"]  = fechaFacturacion;
            documento["MntBruto"] = "1";

            //Datos del emisor
            var emisor = new Dictionary <string, string>();

            emisor["RUCEmisor"]    = "211964430019";
            emisor["RznSoc"]       = "CACFSMEF";
            emisor["CdgDGISucur"]  = "2";
            emisor["DomFiscal"]    = "Colonia 1319";
            emisor["Ciudad"]       = "MONTEVIDEO";
            emisor["Departamento"] = "MONTEVIDEO";

            //Datos del receptor
            var receptor = new Dictionary <string, string>();

            receptor["TipoDocRecep"] = "3";
            receptor["CodPaisRecep"] = "UY";
            receptor["DocRecep"]     = documentoReceptor;
            receptor["RznSocRecep"]  = nombreReceptor;

            //Cambio 27/03/2019 para ver si funciona el tema del IVA por los dos lugares después de la coma
            //Double montoIva = ((Convert.ToDouble(montoNetoIva) * (1 + (Convert.ToDouble(porcentajeIva) / 100))) - (Convert.ToDouble(montoNetoIva)));
            Double montoIva = Convert.ToDouble(ivaCuota) + Convert.ToDouble(ivaMora);
            Double total    = Convert.ToDouble(montoNetoIva) + Convert.ToDouble(montoIva);

            //Datos de los totales
            var totales = new Dictionary <string, string>();

            totales["MntNoGrv"]             = "0";
            totales["MntNetoIvaTasaMin"]    = "0";
            totales["MntNetoIVATasaBasica"] = Convert.ToDouble(montoNetoIva).ToString("##0.00").Replace(",", ".");
            totales["IVATasaMin"]           = "10";
            totales["IVATasaBasica"]        = porcentajeIva.ToString();
            totales["MntIVATasaMin"]        = "0";
            totales["MntIVATasaBasica"]     = montoIva.ToString("##0.00").Replace(",", ".");
            totales["MntTotal"]             = total.ToString("##0.00").Replace(",", ".");
            totales["CantLinDet"]           = "2";
            totales["MntPagar"]             = total.ToString("##0.00").Replace(",", ".");

            //Datos de los items
            var items = new Dictionary <string, string>();

            items["PrecioUnitario1"] = String.Format(interesCuota.ToString(), "##0.00").Replace(",", ".");
            items["PrecioUnitario2"] = String.Format(mora.ToString(), "##0.00").Replace(",", ".");

            ExportXML exportar = new ExportXML();
            //  string nombre = @"c:\Facturas\facturacion_" + DateTime.Today.ToString("dd_MM_yyyy") + "_" + documentoReceptor + ".xml";
            string nombre = ruta + "facturacion_" + DateTime.Today.ToString("dd_MM_yyyy") + "_" + documentoReceptor + ".xml";

            exportar.downloadXML(nombre, documento, emisor, receptor, totales, items);
        }
コード例 #2
0
        private void SaveMenuItem_Click(object sender, RoutedEventArgs e)
        {
            SaveFileDialog dialog = new SaveFileDialog();

            dialog.Filter       = "Settings files (*.xml)|*.xml";
            dialog.AddExtension = true;
            dialog.DefaultExt   = "xml";
            string fileName = currentDataFilePath;

            dialog.InitialDirectory = currentDataFileDir;
            if (dialog.ShowDialog() == true)
            {
                ExportXML exportXML = new ExportXML();
                //3. Записать в файл xml в элемент channelsSettings
                //номера и масштабы каналов из словаря масштабов
                exportXML.saveChannelsSettings(dialog.FileName, currentDataFilePath);
            }
        }
コード例 #3
0
        public void Export(string exportDataType)
        {
            switch (exportDataType)
            {
            case ExportDataType.JSON:
                ExportData = new ExportJSON();
                break;

            case ExportDataType.XML:
                ExportData = new ExportXML();
                break;

            case ExportDataType.SQL:
                ExportData = new ExportSQL();
                break;
            }

            ExportData.Export();
        }
コード例 #4
0
        static void Main(string[] args)
        {
            //Channel channel1 = new Channel(1, 0);
            //Channel channel2 = new Channel(2, 0);

            //channel1.addDataItem(0);
            //channel1.addDataItem(1.01);
            //channel1.addDataItem(1.02);
            //channel1.addDataItem(1.03);

            //foreach (double dataItem in channel1.getDataArray())
            //{
            //	Console.WriteLine(dataItem);
            //}

            //ChannelsBundle ChannelsBundle1 = new ChannelsBundle(null, null, 1500);

            //channel2.addDataItem(0.001);
            //channel2.addDataItem(1.015);
            //channel2.addDataItem(1.025);
            //channel2.addDataItem(1.035);

            //ChannelsBundle1[0] = channel1;
            //ChannelsBundle1[1] = channel2;

            //foreach (Channel channel in ChannelsBundle1)
            //{
            //	foreach (double dataItem in channel.getDataArray())
            //	{
            //		Console.WriteLine(dataItem);
            //	}
            //}

            //Filters filters1 = Filters.Batterwort;
            //Filters filters2 = Filters.Chebishev;
            //Console.WriteLine(filters1 < filters2);

            //DataFileFacade dataFileFacade = new DataFileFacade(DataFileTypes.OldDataFile);
            //dataFileFacade.getChannels();
            //dataFileFacade.setDAOType(DataFileTypes.NewDataFile);
            //dataFileFacade.getChannels();
            //dataFileFacade.setDAOType(DataFileTypes.OldDataFile);
            //dataFileFacade.getChannels();

            //Mock<IChannelsBundle> mock = new Mock<IChannelsBundle>();
            //mock.Setup(m => m.channelArray).Returns(
            //	new Channel[]{
            //        //new Channel{dataArray = new double?[3]{1, 2, 3}}
            //        //,new Channel{dataArray = new double?[3]{0, 1, 2}}
            //        new Channel{dataArrayList = (new ArrayList(){1, 2, 3})}
            //		,new Channel{dataArrayList = new ArrayList(){0, 1, 2}}
            //	}
            //);
            //foreach (Channel channel in mock.Object.channelArray.AsEnumerable())
            //{
            //	foreach (double dataItem in channel.getDataArray())
            //	{
            //		Console.WriteLine(dataItem);
            //	}
            //}

            //const Int32 count = 10000000;

            //using (new OperationProfiler("Channel<T>"))
            //{
            //	gen.Channel<double> channel1 = new gen.Channel<double>(1, 0);
            //	for (Int32 n = 0; n < count; n++)
            //	{
            //		channel1.addDataItem(n);
            //	}
            //	channel1 = null;  // для гарантированного выполнения сборки мусора
            //}

            //using (new OperationProfiler("Channel"))
            //{
            //	Channel channel1 = new Channel(1, 0);
            //	for (Int32 n = 0; n < count; n++)
            //	{
            //		channel1.addDataItem(n);
            //	}
            //}

            //gen.Channel<double> channel1 = new gen.Channel<double>(1, 0);


            //Channel channel2 = new Channel();
            //channel2 = null;

            /*Чтение бинарных файлов*/

            /*String filePath = @"D:/Temp/10f";
             *
             * ParamsReader paramsReader = new ParamsReader();
             * List<gen.Channel<double>> channelsArrayList =
             * paramsReader.getParams(filePath + ".prm");
             * Console.WriteLine(paramsReader.Count + " " + paramsReader.Frequency + "\n");
             * foreach (gen.Channel<double> channel in channelsArrayList)
             * {
             * Console.WriteLine(channel.number + " " + channel.amp);
             * }*/

            //DataReader dataReader = new DataReader();
            //dataReader.getData(@"D:/Temp/10f" + ".dat", ref channelsArrayList);
            //foreach (double dataItem in channelsArrayList[1].getDataArray())
            //{
            //	Console.WriteLine(dataItem);
            //}

            //*Запись метаданных в XML-файл*/

            Channel channel1 = new Channel(1, 0);
            Channel channel2 = new Channel(2, 0);

            channel1.addDataItem(0);
            channel1.addDataItem(1.01);
            channel1.addDataItem(1.02);
            channel1.addDataItem(1.03);
            channel1.addDataItem(1.51);
            channel1.addDataItem(1.22);
            channel1.addDataItem(1.03);

            channel2.addDataItem(0.001);
            channel2.addDataItem(1.015);
            channel2.addDataItem(1.025);
            channel2.addDataItem(1.035);
            channel2.addDataItem(1.115);
            channel2.addDataItem(1.095);
            channel2.addDataItem(1.035);

            int[] numbersArray = new int[] { channel1.number, channel2.number };
            int[] ampsArray    = new int[] { channel1.amp, channel2.amp };

            ChannelsBundle ChannelsBundle1 = new ChannelsBundle(numbersArray, ampsArray, 1500);

            ChannelsBundle1[0] = channel1;
            ChannelsBundle1[1] = channel2;

            ExportXML exportXML = new ExportXML();

            exportXML.saveChannelsMetadata(ref ChannelsBundle1, ReportTypes.XML);



            ImportXML      importXML       = new ImportXML();
            ChannelsBundle ChannelsBundle2 =
                importXML.getChannelsMetadata(@"ChannelsMetadata.xml");

            Console.WriteLine("frequency = {0}", ChannelsBundle2.frequency);

            foreach (Channel channel in ChannelsBundle2)
            {
                Console.WriteLine("number = {0}; amplification = {1}", channel.number, channel.amp);
            }

            Console.ReadLine();


            /*Чтение бинарных файлов C++*/

            /*String filePath = @"D:/Temp/10f";
             *
             * ParamsReader paramsReader = new ParamsReader();
             * List<gen.Channel<double>> channelsArrayList =
             *  paramsReader.getParams(filePath + ".prm");
             * Console.WriteLine(paramsReader.Count + " " + paramsReader.Frequency + "\n");
             * foreach (gen.Channel<double> channel in channelsArrayList)
             * {
             *  Console.WriteLine(channel.number + " " + channel.amp);
             * }*/
        }
コード例 #5
0
        /// <summary>
        /// Execute Action
        /// </summary>
        /// <param name="oActionCallingContext"></param>
        /// <returns></returns>
        public bool Execute(ActionCallingContext oActionCallingContext)
        {
            SelectionSet Set            = new SelectionSet();
            Project      CurrentProject = Set.GetCurrentProject(true);
            string       ProjectName    = CurrentProject.ProjectName;

            Debug.WriteLine(ProjectName);
            string xlsFileName = Path.GetDirectoryName(CurrentProject.ProjectFullName);

            xlsFileName = Path.Combine(xlsFileName, $"{ DateTime.Now.Year }.{ DateTime.Now.Month }.{ DateTime.Now.Day }_" + Settings.Default.outputFileName);
            // Show ProgressBar
            Progress progress = new Progress("SimpleProgress");

            progress.SetAllowCancel(true);
            progress.SetAskOnCancel(true);
            progress.SetTitle("Wire mark export");
            progress.ShowImmediately();
            progress.BeginPart(25.0, "Export label : ");
            try
            {
                // Executing Action "label"
                ExportXML.Execute(xmlExportFileName);

                if (progress.Canceled())
                {
                    progress.EndPart(true);
                    return(true);
                }
            }
            catch (Exception ex)
            {
                ErrorHandler("ExportXML", ex);
                return(false);
            }

            progress.EndPart();
            progress.BeginPart(25.0, "Parse XML : ");
            try
            {
                // Getting object from XML
                ParseXMLWireFile();

                if (progress.Canceled())
                {
                    progress.EndPart(true);
                    return(true);
                }
            }
            catch (Exception ex)
            {
                ErrorHandler("ParseXMLWireFile", ex);
                return(false);
            }
            progress.EndPart();
            progress.BeginPart(10.0, "Write data to Excel : " + xlsFileName);
            try
            {
                // Export to excel
                // Creating *.xls file
                ExportToExcel.Execute(listOfLines, xlsFileName, progress);

                if (progress.Canceled())
                {
                    progress.EndPart(true);
                    return(true);
                }
            }
            catch (Exception ex)
            {
                ErrorHandler("ExportToExcel.Execute", ex);
                return(false);
            }
            finally
            {
                progress.EndPart(true);
            }

            return(true);
        }