My first program developed for a company, ExcelFix (1/2) [ESP-ENG] | C#
¿Qué tal todo? Hace tiempo que no pasaba por acá para hablar sobre lo que he estado haciendo. Para ser más concretos... ¡Desde el 7 de noviembre de 2023! Han pasado muchas cosas, pero, entre todas ellas, hoy quiero hablarles de algo en específico que me ha llenado de alegría. He desarrollado mi primer programa para una compañía, se me ha encomendado un proyecto para automatizar un proceso. A continuación les comento más.
How's it going? It's been a while since I've stopped by to talk about what I've been doing. To be more specific... Since November 7, 2023! Many things have happened, but, among all of them, today I want to talk to you about something specific that has filled me with joy. I have developed my first program for a company, I have been entrusted with a project to automate a process. I will tell you more about it below.
Lo cierto es que ya hacía un tiempo que tenía contacto con esta compañía, pero, hacía trabajos enfocados al área de servicio técnico y soluciones con Excel, ya fuera modificar formulas, adaptar formatos o incluso uno que otro trabajo con macros.
Ahora bien, en esta ocasión la oportunidad surgió como respuesta a un problema. ¿Se puede automatizar esta tarea que llevo haciendo a mano por tanto tiempo?
Y pues claro respondí y procedí a plantear el caso al gerente (aprovechando que había visto que C# ofrece soluciones excelentes para estos casos).
El problema gira en torno a los archivos de consulta que son descargados a diario para corroborar que los pagos se están recibiendo y repartir las comisiones entre los vendedores. Cada banco aquí en Venezuela tiene su "forma" de dar estos movimientos, y, esto por supuesto crea inconsistencias.
Por ejemplo, el Banco Banesco entrega todos los montos combinados en una misma columna, únicamente diferenciados por el signo (para saber si son ingresos o egresos). El Banco Exterior pone todos con el mismo signo, pero, al lado agrega una columna que indica si son positivos o negativos (con el símbolo más o menos). Y el banco mercantil empieza los movimientos en orden inverso (Desde el más reciente al más antiguo, ejemplo desde el 30 de enero al 1 de enero).
Por ello, la primera función de mi programa estuvo enfocada al ajuste de las columnas (tamaño, valores y posición), con el objetivo de facilitar el análisis y manipulación de los movimientos bancarios. A continuación les dejo unos ejemplos de cómo se veían los formatos antes de las modificaciones (evidentemente oculte cierta información sensible, por respeto a la privacidad de la empresa).
The truth is that I had already been in contact with this company for some time, but I was doing work focused on the area of technical service and solutions with Excel, either modifying formulas, adapting formats or even one or another work with macros.
Now, on this occasion the opportunity arose in response to a problem: Can I automate this task that I have been doing by hand for so long?
And of course I answered and proceeded to present the case to the manager (taking advantage of the fact that I had seen that C# offers excellent solutions for these cases).
The problem revolves around the query files that are downloaded daily to corroborate that the payments are being received and to distribute the commissions among the vendors. Each bank here in Venezuela has its own “way” of giving these movements, and, this of course creates inconsistencies.
For example, Banco Banesco gives all the amounts combined in the same column, only differentiated by the sign (to know if they are income or expenses). Banco Exterior puts them all with the same sign, but, next to it, adds a column indicating whether they are positive or negative (with the plus or minus symbol). And the merchant bank starts the movements in reverse order (From the most recent to the oldest, e.g. from January 30 to January 1).
Therefore, the first function of my program was focused on the adjustment of the columns (size, values and position), in order to facilitate the analysis and manipulation of bank movements. Here are some examples of how the formats looked before the modifications (obviously I hid some sensitive information, out of respect for the company's privacy).
¿Cómo resolverlo? Pues para esta ocasión no opté por la vieja confiable de mis herramientas más usadas (Java), ni por C++, del que tantas publicaciones he hecho. Sino que me decanté por C#, un lenguaje en el que he estado incursionando hace poco y que se siente como si C++ y Java hubiesen tenido un bebé.
Para el momento que hice este post ya tengo dos funciones desplegadas, pero en esta publicación (es la primera de dos sobre este tema, al menos por ahora). Hoy nos centraremos en la función de ajustar formatos.
Para lograrlo usé la librería "NPOI", de C#, con ella me fue posible editar filas, columnas y celdas según las necesidades presentes.
Hubieron detalles que me complicaron bastante el proceso (Entre ellos que los formatos iniciales que me entregaron no eran los originales del banco, sino que tenían ediciones, por lo que tuve que hacer cambios posteriores en el código). El tema de las validaciones también fue un dolor de cabeza.
Entre las validaciones que tuve que considerar en esta primera función estuvieron: Evitar que se tratara de ejecutar el programa con el Excel objetivo abierto, que no se ejecutara sin antes tener el archivo adjunto (acceso a la dirección correcta donde está el archivo Excel), que el formato fuera el correcto (no funciona con .xls sino con .xlsx.
Luego hubieron detalles estéticos que validé a través de las propiedades con el editor de Forms (evitar que se cambiara el tamaño de la ventanas y otros detalles pequeños.
Para el tema de las funciones más complicadas me apoyé usando ChatGPT y Gemini para agilizar el proceso (por supuesto me aseguré de adaptar el código a mis necesidades), aunque debo confesar que por cuestiones de tiempo, parte del código quedo un poco "espagueti". Cosa que debo mejorar al largo plazo.
El diseño fue bastante simple, continúa con mi ya clara costumbre de usar la fuente "Consolas" y el color azul claro que aparece como base predeterminada en muchas paletas de colores y que fue muy popular en Windows XP.
How to solve it? Well, for this occasion I didn't opt for the old reliable of my most used tools (Java), nor for C++, of which I have published so many posts. Instead I opted for C#, a language in which I have been dabbling recently and that feels as if C++ and Java had had a baby.
By the time I made this post I already have two functions deployed, but in this post (it's the first of two on this topic, at least for now). Today we will focus on the function to adjust formats.
To achieve this I used the C# library “NPOI”, with it I was able to edit rows, columns and cells according to the needs present.
There were some details that complicated the process (among them that the initial formats that I was given were not the original ones from the bank, but had editions, so I had to make later changes in the code). The issue of validations was also a headache.
Among the validations that I had to consider in this first function were: Avoid trying to run the program with the target Excel open, not to run it without having the file attached (access to the correct address where the Excel file is), that the format was correct (it does not work with .xls but with .xlsx).
Then there were some aesthetic details that I validated through the properties with the Forms editor (to avoid changing the size of the windows and other small details.
For the more complicated functions I used ChatGPT and Gemini to speed up the process (of course I made sure to adapt the code to my needs), although I must confess that due to time issues, some of the code was a little “spaghetti”. Something that I must improve in the long run.
The design was quite simple, it continues with my already clear habit of using the “Consoles” font and the light blue color that appears as default base in many color palettes and that was very popular in Windows XP.
El programa también tiene funciones para ubicar movimientos duplicados, pues el formato del banco Banesco suele ser desordenado y mueve de lugar ciertos movimientos cuando llega el fin de semana. Además, ayuda a mitigar el error humano.
En total, por este primer proyecto acordamos un pago por hora, esto por recomendación de un amigo que es programador (le pedí apoyo por cuanto no sabía cómo cobrar este tipo de trabajos justamente, desde acá te agradezco, Gabriel). Me tomó un total de 29 horas programar todas las funciones y realizar todas las pruebas antes de desplegarlo.
Así que este fue mi primer proyecto, pronto, Dios mediante, estaré comentando un poco más y poniendo el blog al día respecto a otros pequeños proyectos que dejé "congelados" por razones personales.
The program also has functions to locate duplicate transactions, since the Banesco bank format is usually disorderly and moves certain transactions when the weekend arrives. It also helps to mitigate human error.
In total, for this first project we agreed on an hourly rate, this on the recommendation of a friend who is a programmer (I asked him for support because I did not know how to charge for this type of work, from here I thank you, Gabriel). It took me a total of 29 hours to program all the functions and perform all the tests before deploying it.
So this was my first project, soon, God willing, I will be commenting a little more and updating the blog about other small projects that I left “frozen” for personal reasons.
Good to see doing your work properly, it is not always easy to do this kind of work unless you are a professional.
Thanks you @renew45!
¡Hola!
¡Qué maravilla!
¡Que este sea el primero de muchos caminos abiertos!
¡Éxitos en esta nueva labor que te llevará a logros maravillosos seguramente!
¡Saludos!
Muchas gracias Roswel, mucho éxito para ti también
¡Gracias!
¡Abrazos!
Thanks for your contribution to the STEMsocial community. Feel free to join us on discord to get to know the rest of us!
Please consider delegating to the @stemsocial account (85% of the curation rewards are returned).
You may also include @stemsocial as a beneficiary of the rewards of this post to get a stronger support.
Thanks you so much for the support!
Congratulations on your first project! It’s amazing to see how you identified a real-world problem and developed such a useful solution. Your dedication, especially as you explored a new language, really shows.
Thanks you so much!