пятница, 23 января 2015 г.

Отчётность ПФР, ФСС, Налоговая в XML (электронном) формате

С недавних пор контролирующие органы делают упор на предоставление отчётности в электронном виде.

Для многих специалистов пользовавшихся "бумажным" вариантом, переход на электронную отчётность может превратится в настоящий кошмар #спасибородинезаэто. Контролирующие органы разные, их немало, отчётность везде разная и если раньше можно было найти стандартные формы которые можно было научится заполнять и делать это каждый отчётный период то с электронной отчётностью эти формы как правило не работают.

Заблуждение Первое. Стандартную Форму можно сохранить и отправить в XML формате. Это в большинстве случаев не правда. В большинстве случаев стандартная форма распространяется в виде Word или Excel файла, при сохранении в формате XML, сам документ сохраняется в XML, то есть все параметры таблицы если это Excel и все ширины страниц и формы шрифта, если это Word. В то время как для отчётности в формате XML, это формат должен содержать только отчётность только цифры и ничего больше. Причём это должно быть в специальном формате, который "понимают" электронные сервисы контролирующих органов.

Заблуждение Второе. Без 1С или другой дорогостоящей платформы электронную отчётность не сформировать и не выгрузить. Тоже не правда и тут мы приступаем к "соли" моего поста - любой (требуется проверка, я знаю о ФСС, ПФР и Налоговой) контролирующий орган имеет в общей доступности бесплатное приложение для формирования отчётности в электронном формате.

Теперь по порядку:

Налоговая (nalog.ru)
Приложение Налогоплательщик ЮЛ http://nalog.ru/rn78/program/all/nal_ul/
Оставляет достаточно приятные впечатления, удобно устанавливается, достаточно интуитивное управление и создание документов. Если не знаете с чего начать рекомендую в меню Документы выбрать "Ввод с помощью мастера документов"

Далее нужно заполнить все необходимые данные о налогоплательщике двигаясь по удобно сформированным шагам

На 6 шаге нужно заполнить саму декларацию, то что требует заполнения выделяется зелёным фоном.

Некоторые абзацы отчёта могут быть заполнены но не включены, их нужно включить чтобы они появились в выгрузке
Если какой-то из разделов отсутствует (серый), его нужно добавить. Кроме того рекомендую периодически нажимать на иконку с буквой Р или клавишу F5 чтобы те поля которые высчитываются - посчитались.

Когда документ заполнен нужно нажать на иконку с буквой К и таким образом проверить что ошибок нет. Далее можно сохранять документ и в последнем шаге мастера выгружать в XML формате пригодном для отправки электронной отчётности.

ФСС (fss.ru)
АРМ Подготовка отчётов для ФСС http://fss.ru/ru/fund/download/55818/index.shtml
Скачиваем первый файл вверху страницы, установка не такая интуитивная, необходимо запускать с правами администратора (правой кнопкой мыши -> запуск от имени Администратора). В процессе установки программа будет скачивать базу адресов.

В самой программе необходимо для начала перейти в раздел Справочники и Добавить Страхователя и при необходимости физических лиц или мед учреждения

Затем необходимо перейти в меню "Учётная работа" и выбрать необходимую форму, затем нажать иконку Вставить

Дальше необходимо заполнить форму, к сожалению не так всё очевидно как в налоговой программе по-этому я подразумеваю что вы в курсе как заполнять формы для ФСС, и в конце выбрать иконку "Выгрузить XML", в результате сформируется XML файл который можно использовать для предоставления электронной отчётности
ПФР (pfrf.ru)
Методом проб и ошибок а также научного тыка выбрана программа Spu_orb разработанная в Оренбурге http://www.pfrf.ru/branches/orenburg/info/~rabot/program
Установка и использование довольно интуитивны и понятны. Позже напишу поподробнее.

Будет апдейт.

вторник, 20 января 2015 г.

Incorrectly flashed atmega328p back to life

Hi,

I'm new to microprocessor programming and all the related stuff (bootloaders, fuses, ISPs, etc.), so I faced a newbee issue.

Symptom:

I was trying to flash atmega328P with bootloader that will suport 8MHz internal clock (so that I don't need an external oscillator) and can be futher optimized in terms of power consumption. I did everything correctly in terms of wiring USBasp programmer (I was using the following instructable), but then unintentionally (I just knew that LilyPad bootloader would also work) I programmed LilyPad's bootloader which also means LilyPad's fuses, which also means (as I later discovered) usage of external oscillator (nice tool to decode fuses).

So, that brought me all the way to "Yikes invalid signature 000000" with usage of -F option in avrdude, or "avrdude: error: programm enable: target doesn't answer. 1" without it. Different "-B" options (-B250, -B5, etc.) didn't work for me. Chip is just completely silent.

And also "avrdude: stk500_getparm(): (a) protocol error, expect=0x14, resp=0xfc" when I try to talk to the MCU via Serial ports with help of FTDI chip. At least I could see that chip is not dead comletely, it's replying something. Probably abrakadabra and maybe it could be decoded by using a proper avrdude settings, but I tried different baud rates and other settings and nothing worked.

Cause:

MCU just expect an external clock source and just doing nothing without it.

Resolution:

Connect an oscillator. But what if you don't have a spare one? Do it like me:


This is a wireless NRF24L01 board and it has an oscillator on it, just connect board ground (yellow on the photo and PIN1 on this wireless board) to your MCU ground and oscillator lines (green and white) to PIN9 and PIN10 on your atmega328P.

This fixed everything for me, Chip is alive and I can see all fuses, so I was able to reprogram them.

Although it's a little bit ackward - because oscillator is 16Mhz and LilyPad bootloader expects 8Mhz.

Hopefully this post will save some time for someone who faced the same issue.

UPDATE:
Looks like this is only a one part of the puzzle, the other one is protocol issue which I also mentioned above, it is still present after a correct bootloader is flashed.

Apparently the issue is with not very accurate internal oscillator - it just doesn't work with high baud rates for programming. There is a very good and detailed explanation on how to fix this by re-compiling a bootloader to use slower upload speed, I do not have necessary tools to do that, so I do think I'm going to do that, I think for me it's OK to load firmware via the ISP


I was able to confirm that it's working and chip is perfoming properly using its internal oscillator. Then I can install a code that will programmaticaly set slower baud rate if I need to talk to the firmware onboard the atmega chip.

пятница, 16 января 2015 г.

Netgear Stora with connected Arduino and Zabbix

Was able to install Zabbix on my Netgear Stora device. Took some time and setup code modifications were required (because mysql is lower version in Stora as well as some php addons).

Zabbix is very usefull tool to quickly configure the monitoring and notification system with ability to check metric charts and trends and set triggers and actions.

I'm using it now to monitor the free space and overall health of the Netgear Stora device, router traffic (via SNMP) and, what is more important for me - different aspects of Arduino subsystem (I have Arduino Due connected via USB). I've created a PHP script which takes commands as parameters and returns data reported by arduino. Zabbix agent is using this script to get data from Arduino. Currently I monitor RAM usage of my Arduino system (because has a dynamic tree-like memory allocation system for data reported by remote nodes), so that I can see if my Arduino is about to kaboom :) because of too many nodes reporting to the root node or just because of firmware glitch on Arduino, illumination using the photoresistor on one of the nodes (just for testing purposes), here is the chart screenshot


Also I'm collecting number of cycles certain node is unresponsive, so that zabbix can notify me if certain node is not responding anymore. I have plans to use Zabbix way of autodiscovering new nodes and automatically monitoring them, currently I've just added 2 active node manually, here is the configuration of the Zabbix item, Arduino RAM usage in this case.


Below is a config of my zabbix agent. It should be placed as a separate .conf file into zabbix_agentd.conf.d subfolder, but before that you have to uncomment the following line in the main agentd config:

Include=/opt/usr/local/etc/zabbix_agentd.conf.d/*.conf

userparameter_arduino.conf:

UserParameter=arduino.light,/opt/bin/php -f /home/sg_parser/ardu_get.php l 1 3
UserParameter=arduino.ram,/opt/bin/php -f /home/sg_parser/ardu_get.php s 0 3
UserParameter=arduino.cycles[*],/opt/bin/php -f /home/sg_parser/ardu_get.php c $1 3

All of the paramters for ardu_get.php is just to extract the numeric part of certain node, light sensor is on the node 1 for example, while RAM is on the parent or 0 node and cycles can be gathered for any discovered node.

And now non-arduino part of using Zabbix, here is free space on my Stora, Stora CPU usage and traffic via router (using SNMP data). I'm also monitoring mysql load and apache performance.