npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

sankhya-helper

v1.3.1

Published

[![NPM version](https://img.shields.io/npm/v/sankhya-helper.svg?style=flat)](https://npmjs.org/package/sankhya-helper) [![NPM downloads](https://img.shields.io/npm/dt/sankhya-helper.svg?style=flat)](https://npmjs.org/package/sankhya-helper) [![NPM downloa

Downloads

13

Readme

sankhya-helper

NPM version NPM downloads NPM downloads

Utilitário para criar e formatar objetos JavaScript no padrão de JSON enviado na API de integrações Sankhya.

Instalação

npm i sankhya-helper

Uso

Todas as funções retornam um objeto JSON.

MobileLoginSP.login

const MobileLoginSP = require("sankhya-helper/lib/MobileLoginSP");

MobileLoginSP.login(nomusu: string, interno: string, keepconnected: "S" | "N");

Exemplo:

MobileLoginSP.login("usuario", "senha", "S");
/*{
   "serviceName":"MobileLoginSP.login",
   "requestBody":{
      "NOMUSU":{
         "$":"usuario"
      },
      "INTERNO":{
         "$":"senha"
      },
      "KEEPCONNECTED":{
         "$":"S"
      }
   }
}*/

MobileLoginSP.logout

const MobileLoginSP = require("sankhya-helper/lib/MobileLoginSP");

MobileLoginSP.logout();

Exemplo:

const body = MobileLoginSP.logout();
/*{
   "serviceName":"MobileLoginSP.logout",
   "status":"1",
   "pendingPrinting":"false"
}*/

CACSP.incluirNota

const CACSP = require("sankhya-helper/lib/CACSP");

CACSP.incluirNota(cabecalho: Object, itens: Object[], informarPreco: boolean);

Exemplo:

O campo "NUNOTA" é incluído pela função.

const cabecalho = {
    "CODPARC": 2,
    "DTNEG": "01/02/2021",
    "CODTIPOPER": 18,
    "CODTIPVENDA": 11,
    "CODVEND": 2,
    "CODEMP": 1,
    "TIPMOV": "P"
}

const itens = [
    {
        "CODPROD": 13,
        "QTDNEG": 1,
        "CODLOCALORIG": 0,
        "CODVOL": "UN"
    }
]

CACSP.incluirNota(cabecalho, itens, false);
/*{
   "serviceName":"CACSP.incluirNota",
   "requestBody":{
      "nota":{
         "cabecalho":{
            "NUNOTA":{
               
            },
            "CODPARC":{
               "$":"2"
            },
            "DTNEG":{
               "$":"01/02/2021"
            },
            "CODTIPOPER":{
               "$":"18"
            },
            "CODTIPVENDA":{
               "$":"11"
            },
            "CODVEND":{
               "$":"2"
            },
            "CODEMP":{
               "$":"1"
            },
            "TIPMOV":{
               "$":"P"
            }
         },
         "itens":{
            "INFORMARPRECO":"N",
            "item":[
               {
                  "CODPROD":{
                     "$":"13"
                  },
                  "QTDNEG":{
                     "$":"1"
                  },
                  "CODLOCALORIG":{
                     "$":"0"
                  },
                  "CODVOL":{
                     "$":"UN"
                  },
                  "NUNOTA":{
                     
                  }
               }
            ]
         }
      }
   }
}*/

CACSP.incluirAlterarItemNota

const CACSP = require("sankhya-helper/lib/CACSP");

CACSP.incluirAlterarItemNota(nunota: number | string, item: Object);

Exemplo:

const item = {
    "CODPROD": 129,
    "NUNOTA": 7468,
    "QTDNEG": 10,
    "VLRUNIT": 10,
    "VLRTOT": 432.38,
    "CODVOL": "UN",
    "VLRDESC": 0,
    "PERCDESC": 0,
    "SEQUENCIA": ""
}

CACSP.incluirAlterarItemNota(7468, item);
/*{
   "serviceName":"CACSP.incluirAlterarItemNota",
   "requestBody":{
      "nota":{
         "NUNOTA":"7468",
         "itens":{
            "item":{
               "CODPROD":{
                  "$":"129"
               },
               "NUNOTA":{
                  "$":"7468"
               },
               "QTDNEG":{
                  "$":"10"
               },
               "VLRUNIT":{
                  "$":"10"
               },
               "VLRTOT":{
                  "$":"432.38"
               },
               "CODVOL":{
                  "$":"UN"
               },
               "VLRDESC":{
                  "$":"0"
               },
               "PERCDESC":{
                  "$":"0"
               },
               "SEQUENCIA":{
                  "$":""
               }
            }
         }
      }
   }
}*/

CACSP.excluirItemNota

const CACSP = require("sankhya-helper/lib/CACSP");

CACSP.excluirItemNota(nunota: number | string, sequencia: number | string);

Exemplo:

CACSP.excluirItemNota(7468, 4);
/*{
   "serviceName":"CACSP.excluirItemNota",
   "requestBody":{
      "nota":{
         "itens":{
            "item":{
               "NUNOTA":{
                  "$":"7468"
               },
               "SEQUENCIA":{
                  "$":"4"
               }
            }
         }
      }
   }
}*/

CACSP.cancelarNota

const CACSP = require("sankhya-helper/lib/CACSP");

CACSP.cancelarNota(nunota: number | string, justificativa: string, validarProcessosWmsEmAndamento: boolean);

Exemplo:

CACSP.cancelarNota(3713703, "Lançamento indevido", true)
/*{
   "serviceName":"CACSP.cancelarNota",
   "requestBody":{
      "notasCanceladas":{
         "nunota":[
            {
               "$":"3713703"
            }
         ],
         "justificativa":"Lançamento indevido",
         "validarProcessosWmsEmAndamento":"true"
      }
   }
}*/

CRUDServiceProvider.saveRecord

const CRUDServiceProvider = require("sankhya-helper/lib/CRUDServiceProvider");

CRUDServiceProvider.saveRecord(entidade: string, input: Object, output: string);

Exemplo:

const cidade = {
   NOMECID: "UBERLANDIA",
   UF: 2
}

CRUDServiceProvider.saveRecord("Cidade", cidade, "CODCID,NOMECID,UF");
/*{
   "serviceName":"CRUDServiceProvider.saveRecord",
   "requestBody":{
      "dataSet":{
         "rootEntity":"Cidade",
         "includePresentationFields":"N",
         "dataRow":{
            "localFields":{
               "NOMECID":{
                  "$":"Uberlândia"
               },
               "UF":{
                  "$":"2"
               }
            }
         },
         "entity":{
            "fieldset":{
               "list":"CODCID,NOMECID,UF"
            }
         }
      }
   }
}*/

Licença

sankhya-helper é licenciado sob a licença MIT. MIT

sankhya-helper não é mantido pela Sankhya e sim por terceiros que criam soluções utilizando sua API de integração.