123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279 |
- <%
- /**** Pagina de login do site ****/
- Local cLCodLogin := ""
- if type ("cCodLogin") <> "U"
- cLCodLogin := cCodLogin
- Endif
- %>
- <!DOCTYPE html>
- <html class="fixed sidebar-left-collapsed">
- <head>
- <!-- Basic -->
- <meta charset="iso-8859-1">
- <link rel="shortcut icon" href="images/favicon.png" type="image/x-icon" />
-
- <title><%=cTitle%></title>
-
- <meta name="keywords" content="<%=cTitle%>" />
- <meta name="description" content="<%=cTitle%>">
- <meta name="author" content="SMSTI">
- <meta http-equiv="Chache-Control" content="no-cache" />
- <meta http-equiv="Expires" content="0" />
- <meta http-equiv="Pragma" content="no-cache" />
-
- <!-- Mobile Metas -->
- <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
-
- <!-- Web Fonts -->
- <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800|Shadows+Into+Light" rel="stylesheet" type="text/css">
-
- <!-- Vendor CSS -->
- <link rel="stylesheet" href="assets/vendor/bootstrap/css/bootstrap.css" />
- <link rel="stylesheet" href="assets/vendor/font-awesome/css/font-awesome.css" />
- <link rel="stylesheet" href="assets/vendor/magnific-popup/magnific-popup.css" />
- <link rel="stylesheet" href="assets/vendor/bootstrap-datepicker/css/bootstrap-datepicker3.css" />
- <link rel="stylesheet" href="assets/vendor/bootstrap-select/css/bootstrap-select.min.css" />
- <style>
- body .btn {
- white-space: nowrap !important;
- display: inline;
- overflow-y: hidden;
- }
-
- </style>
- <!-- Specific Page Vendor CSS -->
- <link rel="stylesheet" href="assets/vendor/select2/css/select2.css" />
- <link rel="stylesheet" href="assets/vendor/select2-bootstrap-theme/select2-bootstrap.min.css" />
- <link rel="stylesheet" href="assets/vendor/jquery-datatables-bs3/assets/css/datatables.css" />
- <link rel="stylesheet" href="assets/vendor/bootstrap-fileupload/bootstrap-fileupload.min.css" />
- <link rel="stylesheet" href="assets/vendor/pnotify/pnotify.custom.css" />
-
- <!-- Theme CSS -->
- <link rel="stylesheet" href="assets/stylesheets/theme.css" />
-
- <!-- Skin CSS -->
- <link rel="stylesheet" href="assets/stylesheets/skins/default.css" />
-
- <!-- Theme Custom CSS -->
- <link rel="stylesheet" href="assets/stylesheets/theme-custom.css">
-
- <!-- Head Libs -->
- <script src="assets/vendor/modernizr/modernizr.js"></script>
- <script src="assets/vendor/style-switcher/style.switcher.localstorage.js"></script>
-
- <style>
- .flexContainer {
- display: flex;
- }
-
- .smsediticon {
- flex: 1;
- }
-
- .btedit { /* margem e largura da imagem */
- margin-left: -45px;
- width: 47px;
- }
- </style>
- </head>
- <body>
- <section class="body">
-
- <!-- start: header -->
- <header class="header">
- <%=cHeader%>
- </header>
- <!-- end: header -->
-
- <div class="inner-wrapper">
- <!-- start: sidebar -->
- <aside id="sidebar-left" class="sidebar-left">
-
- <div class="sidebar-header">
- <div class="sidebar-title">
- Menu
- </div>
- <div class="sidebar-toggle hidden-xs" data-toggle-class="sidebar-left-collapsed" data-target="html" data-fire-event="sidebar-left-toggle">
- <i class="fa fa-bars" aria-label="Toggle sidebar"></i>
- </div>
- </div>
-
- <div class="nano">
- <div class="nano-content">
- <nav id="menu" class="nav-main" role="navigation">
-
- <ul class="nav nav-main">
- <%=cMenus%>
- </ul>
- </nav>
- </div>
-
- <script>
- // Maintain Scroll Position
- if (typeof localStorage !== 'undefined') {
- if (localStorage.getItem('sidebar-left-position') !== null) {
- var initialPosition = localStorage.getItem('sidebar-left-position'),
- sidebarLeft = document.querySelector('#sidebar-left .nano-content');
-
- sidebarLeft.scrollTop = initialPosition;
- }
- }
- </script>
- </div>
-
- </aside>
- <!-- end: sidebar -->
-
- <section role="main" class="content-body">
- <header class="page-header">
- <h2><%=cPagina%></h2>
-
- <div class="right-wrapper pull-right">
- </div>
- </header>
-
- <!-- start: page -->
- <section class="panel">
- <!-- <header class="panel-heading">
- </header> -->
- <div class="panel-body">
- <div class="row">
- <div class="col-lg-12">
- <section class="panel form-wizard" id="w9">
- <form action = "" method="post" class="form-horizontal" id="formOrc">
- <div class="tabs">
- <ul class="nav nav-tabs nav-justify">
- <li class="active">
- <a href="#orc-informar" data-toggle="tab" class="text-center">Orçamento</a>
- </li>
- <!--
- <li class="">
- <a href="#orc-anexos" data-toggle="tab" class="text-center">Anexos</a>
- </li>
- -->
- </ul>
-
- <div class="tab-content">
- <div id="orc-informar" class="tab-pane active">
- <!--
- <%=cVendedor%>
- -->
-
- <!-- linha 0: dados do Orçamento -->
- <%=cFilOrc%>
- <%=cCodOrc%>
- <div class="mb-md hidden-lg hidden-xl"></div>
- <div class="mb-md hidden-lg hidden-xl"></div>
- <!-- linha 1: dados da empresa -->
- <div class="row form-group">
- <div class="col-lg-6">
- <label class="control-label">Cliente</label>
- <%=cCliente%>
- </div>
-
- <div class="col-lg-5">
- <label class="control-label">Oportunidade</label>
- <%=cOport%>
- </div>
- <div class="col-lg-1">
- <label class="control-label">Revisão</label>
- <%=cRevOpt%>
- </div>
-
- </div>
-
-
- <!-- linha 3: input -->
- <div class="row form-group">
- <div class="col-lg-3">
- <label class="control-label">Tipo de Cliente</label>
- <%=cTpCliente%>
- </div>
- <div class="col-lg-2">
- <label class="control-label">Grupo de Tributação</label>
- <%=cGrpTrib%>
- </div>
- <div class="col-lg-5" style="display:none;">
- <label class="control-label">Tabela de Preço</label>
- <%=cTabela%>
- </div>
- <div class="col-lg-4">
- <label class="control-label">Contato</label>
- <%=cContato%>
- </div>
- <div class="col-lg-1">
- <label class="control-label">DDD</label>
- <%=cContDDD%>
- </div>
- <div class="col-lg-2">
- <label class="control-label">Telefone</label>
- <%=cContTel%>
- </div>
- </div>
-
- <!-- linha 4 input -->
- <div class="row form-group">
- <div class="col-lg-6">
- <label class="control-label">Cliente de Entrega</label>
- <%=cCliEntr%>
- </div>
- <div class="col-lg-6">
- <label class="control-label">Local de Entrega</label>
- <%=cLocalEnt%>
- </div>
- </div>
- <!-- linha 5 input -->
- <div class="row form-group">
-
- <div class="col-lg-6">
- <label class="control-label">Obra</label>
- <%=cObra%>
- </div>
-
- <div class="col-lg-3">
- <label class="control-label">Status da Obra</label>
- <%=cStatusObra%>
- </div>
- <div class="col-lg-3">
- <label class="control-label">Previsão de Fechamento</label>
- <%=cPrevFecha%>
- </div>
- </div>
- <!-- linha 6 input -->
- <div class="row form-group">
- <div class="col-lg-3">
- <label class="control-label">Condição de Pagamento</label>
- <%=cCondPag%>
- </div>
- <div class="col-lg-6">
- <label class="control-label">Intermediador</label>
- <%=cIntermed%>
- </div>
- <div class="col-lg-2">
- <label class="control-label">Retorno</label>
- <%=cRetorno%>
- </div>
- </div>
-
- <!-- linha 7 input -->
- <div class="row form-group">
- <div class="col-lg-2">
- <label class="control-label">Estudo Luminotécnico</label>
- <%=cEstudo%>
- </div>
- <div class="col-lg-2">
- <label class="control-label">Num. Estudo</label>
- <%=cNumEst%>
- </div>
- <div class="col-lg-3">
- <label class="control-label">Segmento</label>
- <%=cSegmento%>
- </div>
- <div class="col-lg-2">
- <label class="control-label">Prospecção</label>
- <%=cProsp%>
- </div>
- <div class="col-lg-3">
- <label class="control-label">Prospectado Por</label>
- <%=cProspPor%>
- </div>
- </div>
-
- <!-- linha 8: input -->
- <div class="row form-group">
- <div class="col-lg-4">
- <label class="control-label">Regional</label>
- <%=cRegional%>
- </div>
- <div class="col-lg-4">
- <label class="control-label">Vendedor 2</label>
- <%=cVend2%>
- </div>
- <div class="col-lg-4">
- <label class="control-label">Vendedor 3</label>
- <%=cVend3%>
- </div>
- </div>
- <!-- linha 9: input -->
- <div class="row form-group">
- <div class="col-lg-4">
- <label class="control-label">Vendedor 4</label>
- <%=cVend4%>
- </div>
- <div class="col-lg-4">
- <label class="control-label">Especificado por</label>
- <%=cEspecif%>
- </div>
- <div class="col-lg-4">
- <label class="control-label">Negociadora</label>
- <%=cNegociad%>
- </div>
- </div>
- <!-- linha 10: input -->
- <div class="row form-group">
- <div class="col-lg-2">
- <label class="control-label">Validade</label>
- <%=cValidade%>
- </div>
- <div class="col-lg-2">
- <label class="control-label">Prazo de Embarque</label>
- <%=cPrazoEmb%>
- </div>
- <div class="col-lg-2">
- <label class="control-label">Tipo de Frete</label>
- <%=cTpFrete%>
- </div>
-
- <div class="col-lg-2">
- <label class="control-label">% Frete</label>
- <%=cPFrete%>
- </div>
- <div class="col-lg-2">
- <label class="control-label">Valor do Frete</label>
- <%=cValFre%>
- </div>
- <div class="col-lg-2">
- <label class="control-label">% RT</label>
- <%=cComRT%>
- </div>
- <!--
- <div class="col-lg-4">
- <label class="control-label">Transportadora</label>
- <%=cTransp%>
- </div>
- -->
- </div>
-
-
-
- <!-- linha 11 input -->
- <div class="row form-group">
-
- <div class="col-md-5">
- <label class="control-label" for="textareaDefault">Observação Comercial</label>
- <textarea class="form-control" rows="3" data-plugin-maxlength="" maxlength="240" id="CJ_OBS" name="CJ_OBS" <%=Iif(!lEdit,'disabled','')%>><%=cObsCom%></textarea>
- </div>
-
- <%=cMargemCont%>
- </div>
-
- <!-- linha 12 input -->
- <div class="row form-group">
-
-
- </div>
-
-
-
- <br>
- <br>
-
- <!-- tabela com os produtos do orçamento -->
- <div class="table-responsive" id="ItensOrc" style="overflow-x:visible">
- <section class="panel">
- <header class="panel-heading">
- <h2 class="panel-title">Itens do Orçamento</h2>
- </header>
- <table class="table table-bordered table-striped mb-none table-hover table-condensed" id="datatable-editable" aria-describedby="datatable-details_info">
- <thead>
- <tr>
- <%=cOrcCabec%>
- </tr>
- </thead>
- <tbody>
- <%=cOrcItens%>
- </tbody>
- </table>
- </section>
- </div>
- <br>
-
- <!-- botões com ações na tabela dos itens -->
- <%=cBtnItens%>
- <br>
- <br>
-
- <!-- Totais -->
- <div class="col-lg-13">
- <section class="panel">
- <header class="panel-heading">
- <h2 class="panel-title">Totais do Orçamento</h2>
- </header>
- <div class="panel-body">
-
- <div class="form-inline" align="center">
- <div class="row">
- <div class="col-sm-12">
- <label class="">Itens </label>
- <input class="form-control text-right" id="TOTAL_ITENS" name="TOTAL_ITENS" placeholder="0,00" disabled="" type="text" value=<%=Transform(nTVlrUnit,"@E 999,999,999,999.99")%>></input>
-
-
- <label class="">Impostos </label>
- <input class="form-control text-right" id="TOTAL_IMP" name="TOTAL_IMP" placeholder="0,00" disabled="" type="text" value=<%=Transform(nTImpostos,"@E 999,999,999,999.99")%>></input>
-
-
-
- <label class="">Frete </label>
- <input class="form-control text-right" id="TOTAL_FRETE" name="TOTAL_FRETE" placeholder="0,00" disabled="" type="text" value=<%=Transform(nTFrete,"@E 999,999,999,999.99")%>></input>
-
-
-
- <label class="text-weight-extrabold">Total </label>
- <input class="form-control text-right text-weight-bold" id="TOTAL_ORC" name="TOTAL_ORC" placeholder="0,00" disabled="" type="text" value=<%=Transform(nTTotal,"@E 999,999,999,999.99")%>></input>
- </div>
- </div>
- <br>
- <!--
- <div class="row">
- <div class="col-sm-12">
- <label class="">Desconto </label>
- <input class="form-control text-right" id="TOTAL_ACRESC" name="TOTAL_ACRESC" placeholder="0,00" disabled="" type="text" value=<%=Transform(nTAcresc,"@E 999,999,999,999.99")%>></input>
-
- <label class="">Total </label>
- <input class="form-control text-right" id="TOTAL_ORC" name="TOTAL_ORC" placeholder="0,00" disabled="" type="text" value=<%=Transform(nTTotal,"@E 999,999,999,999.99")%>></input>
- </div>
- </div>
-
- <div class="row">
- <div class="col-sm-12">
- <label class="">Comissão Prevista </label>
- <input class="form-control text-right" id="TOTAL_COM" name="TOTAL_COM" placeholder="0,00" disabled="" type="text" value=<%=Transform(nTComiss,"@E 999,999,999,999.99")%>></input>
- </div>
- </div>
- -->
- </div>
- </div>
- </section>
- </div>
-
- <br>
- <br>
-
- <div class="row form-group" align="center">
- <%=cBotoes%>
- </div>
- </div>
-
- <!-- aba de anexos
- <div id="orc-anexos" class="tab-pane">
- <div class="form-group">
- <label class="col-md-3 control-label">Anexar: </label>
- <div class="col-md-9">
- <div class="fileupload fileupload-new" data-provides="fileupload">
- <div class="input-append">
- <div class="uneditable-input">
- <i class="fa fa-file fileupload-exists"></i>
- <span class="fileupload-preview"></span>
- </div>
- <span class="btn btn-default btn-file">
- <span class="fileupload-exists">Selecionar</span>
- <span class="fileupload-new">Arquivo</span>
- <input type="file" name="anexo" id="anexo" />
- </span>
- <a href="#" id="btnOrcUpload" class="btn btn-default fileupload-exists" data-dismiss="fileupload">Gravar</a>
- </div>
- </div>
- </div>
- </div>
-
- <div class="row mg-files" data-sort-destination data-sort-id="media-gallery" id="OrcAnexos">
- <%=cAnexos%>
- </div>
- </div>
- -->
- </div>
- </div>
- </form>
- </section>
- </div>
- </div>
- </div>
- </section>
-
-
- <div style="display:none;">
- <form action="U_OrcUpload.apw?PR=<%=cLCodLogin%>" method="post" id="frmOrcUpload" enctype="multipart/form-data">
- <input type="hidden" name="dirOrc" value="<%=cDirOrc%>" />
- </form>
- </div>
- <footer class="panel-footer text-right">
- Desenvolvido por <img src="images/sms.png" />
- </footer>
- </div>
- </section>
- <!-- end: page -->
-
- <div id="dialogRemover" class="modal-block mfp-hide">
- <section class="panel">
- <header class="panel-heading">
- <h2 class="panel-title">Exclusão da linha</h2>
- </header>
- <div class="panel-body">
- <div class="modal-wrapper">
- <div class="modal-text">
- <p>Confirma a exclusão desta linha?</p>
- </div>
- </div>
- </div>
- <footer class="panel-footer">
- <div class="row">
- <div class="col-md-12 text-right">
- <button id="dialogConfirm" class="btn btn-primary">Confirma</button>
- <button id="dialogCancel" class="btn btn-default">Cancela</button>
- </div>
- </div>
- </footer>
- </section>
- </div>
-
- <div id="modalSuccess" class="modal-block modal-block-success mfp-hide">
- <section class="panel">
- <header class="panel-heading">
- <h2 class="panel-title">Success!</h2>
- </header>
- <div class="panel-body">
- <div class="modal-wrapper">
- <div class="modal-icon">
- <i class="fa fa-check"></i>
- </div>
- <div class="modal-text">
- <h4>Success</h4>
- <p>This is a successfull message.</p>
- </div>
- </div>
- </div>
- <footer class="panel-footer">
- <div class="row">
- <div class="col-md-12 text-right">
- <button class="btn btn-success modal-dismiss">OK</button>
- </div>
- </div>
- </footer>
- </section>
- </div>
- <!-- Vendor -->
- <script src="assets/vendor/jquery/jquery.js"></script>
- <script src="assets/vendor/jquery-browser-mobile/jquery.browser.mobile.js"></script>
- <script src="assets/vendor/bootstrap/js/bootstrap.js"></script>
- <script src="assets/vendor/nanoscroller/nanoscroller.js"></script>
- <script src="assets/vendor/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>
- <script src="assets/vendor/bootstrap-datepicker/locales/bootstrap-datepicker.pt-BR.min.js"></script>
- <script src="assets/vendor/magnific-popup/jquery.magnific-popup.js"></script>
- <script src="assets/vendor/jquery-placeholder/jquery-placeholder.js"></script>
- <script src="assets/vendor/fuelux/js/spinner.js"></script>
- <!-- Custom -->
- <script src="custom/js/bootbox.js"></script>
- <script src="custom/js/moeda.js"></script>
-
- <!-- Specific Page Vendor -->
- <script src="assets/vendor/select2/js/select2.js"></script>
- <script src="assets/vendor/jquery-datatables/media/js/jquery.dataTables.js"></script>
- <script src="assets/vendor/jquery-datatables/extras/TableTools/js/dataTables.tableTools.min.js"></script>
- <script src="assets/vendor/jquery-datatables-bs3/assets/js/datatables.js"></script>
- <script src="assets/vendor/jquery-datatables/media/js/jquery.dataTables.js"></script>
- <script src="assets/vendor/bootstrap-maxlength/bootstrap-maxlength.js"></script>
- <script src="assets/vendor/autosize/autosize.js"></script>
- <script src="assets/vendor/bootstrap-fileupload/bootstrap-fileupload.min.js"></script>
- <script src="assets/vendor/pnotify/pnotify.custom.js"></script>
- <script src="assets/vendor/bootstrap-select/bootstrap-select.min.js"></script>
-
- <!-- Theme Base, Components and Settings -->
- <script src="assets/javascripts/theme.js"></script>
-
- <!-- Theme Initialization Files -->
- <script src="assets/javascripts/theme.init.js"></script>
-
- <!-- Theme Custom -->
- <script src="assets/javascripts/theme.custom.js"></script>
-
- <script src="custom/js/jquery.maskMoney.js"></script>
- <script src="custom/js/portalMask.js"></script>
- <script type="text/javascript">
- var tblDesc = [];
- var optProd = '<%=cOptProd%>';
- var optCond = '<%=cOptCond%>';
- var optCli = '<%=cOptCli%>';
- /**
- Desabilita o enter na página
- **/
- $(function () {
- $('form').bind("keypress", function (e) {
- if (e.keyCode == 13) return false;
- });
- });
- //Remove as opções da tabela e adiciona o scroll
- $(document).ready(function () {
- $('#datatable-editable').DataTable({
- "scrollX": true,
- "ordering": false,
- "searching": false,
- "paging": false,
- "autoWidth": true,
- "info": false
- });
- $('.dataTables_length').addClass('.w-auto'); //ajusta o tamanho das colunas automaticamente
- });
- //Formata campos de moeda
- $(function() {
- //$('#iCK_PRCVEN01').maskMoney({thousands:'.', decimal:','});
- $('.myformato').maskMoney({thousands:'.', decimal:','});
- $('.percentual').maskMoney({thousands:'.', decimal:',', suffix:'%',allowNegative:true});
- })
-
- function formate() {
- $('.myformato').maskMoney({thousands:'.', decimal:','});
- $('.percentual').maskMoney({thousands:'.', decimal:',', suffix:'%',allowNegative:true});
- }
- <%=cTblDesc%>
-
-
- function sleep(ms) {
- return new Promise(resolve => setTimeout(resolve, ms));
- }
-
- //Manipulando as colunas
- function ocultaColumn (colIndex) {
- var table = document.getElementById('datatable-editable');
- for (var r = 0; r < table.rows.length; r++)
- table.rows[r].cells[colIndex].style.display = 'none';
- }
- function mostraColumn (colIndex) {
- var table = document.getElementById('datatable-editable');
- for (var r = 0; r < table.rows.length; r++)
- table.rows[r].cells[colIndex].style.display = '';
- }
- /**
- Funcao excutada ao selecionar o cliente
- **/
- function SelCliente(){
- var cliente;
- var lOK = false;
- var dialogCli = bootbox.dialog({
- message: '<p class="text-center"><i class="fa fa-spin fa-spinner"></i> Buscando dados do cliente. Aguarde...</p>',
- closeButton: false
- });
- cliente = $("#CJ_CLIENTE").val();
-
- //Verifica se cliente tem títulos em atraso
- $.ajax({
- url: "U_GetSitCli.apw?PR=<%=cLCodLogin%>",
- type: "POST",
- data: 'cliente='+cliente,
- cache: false,
- success: function(data){
- dialogCli.modal('hide');
- if (data.indexOf('<META HTTP-EQUIV') >= 0 ) {
- $("html").html(data);
- return;
- }
- aCli = data.split('|#|');
- if (aCli[1] != "" && aCli[1] != "::" && aCli[1].indexOf("Expires") == -1) {
- var dialog = bootbox.dialog({
- title: 'Mensagem do Cliente',
- message: "<p>"+aCli[1]+"</p>",
- backdrop: true,
- buttons: {
- ok: {
- label: "OK"
- }
- }
- });
- }
- //cliente bloqueado para comprar
- if (aCli[0] == "0"){
-
- //Bloqueia os campos para impossibilitar continuar a inclusão
- atuModoCpo('B')
- } else {
- //Desbloqueia os campos
- atuModoCpo('D')
- $("#select2-CJ_TIPOCLI-container").html($("#CJ_TIPOCLI option[value='"+aCli[2]+"']").html());
- $("#CJ_TIPOCLI").val(aCli[2]);
- $("#CJ_GRPTRIB").val(aCli[3]);
- if (aCli[4] != ""){
- $("#CJ_CONDPAG").val(aCli[4]);
- $("#select2-CJ_CONDPAG-container").html($("#CJ_CONDPAG option[value='"+aCli[4]+"']").html());
- }
- $("#CJ_CONDPAG").removeAttr('disabled');
-
- $("#CJ_UFENT").val(aCli[5]);
- //Adiciona as opções do cliente
- //optCli = document.querySelector("#CJ_CLIENTE").options;
- //$("#CJ_CLIINTE").append($(optCli).clone(true).removeAttr('id').attr("id","CJ_CLIINTE"));
- $("#CJ_CLIINTE").append($.parseHTML(optCli));
- $('.selectpicker').selectpicker('render');
- $('.selectpicker').selectpicker('refresh');
-
-
- $("#CJ_CLIENT").append($.parseHTML(optCli));
- $('.selectpicker').selectpicker('render');
- $('.selectpicker').selectpicker('refresh');
- $('#CJ_CLIENT').selectpicker('val', cliente);
- $("#CJ_NROPOR").focus();
- }
- }
- });
- }
-
- /**
- Atualiza o modo de edição do campo
- **/
- function atuModoCpo(cTipo){
- var aCampos = ["CJ_CLIENTE","CJ_NROPOR","CJ_XCONTAT","CJ_XCONDDD","CJ_XCONTEL","CJ_CLIENT","CJ_UFENT","CJ_OBRA","CJ_VEND6","CJ_TERMOME","CJ_CONDPAG","CJ_CLIINTE","CJ_RETORNO","CJ_LUMINOT","CJ_SEGMENT","CJ_PROPECC","CJ_REGIAO","CJ_VEND","CJ_VEND3","CJ_VEND4","CJ_CODESP","CJ_VEND7","CJ_VALIDA","CJ_PRZEMB","CJ_TPFRETE","CJ_PERCFRT","CJ_FRETE","CJ_OBS","CK_PRODUTO01"];
- var nI = 0;
- //Atualiza os campos
- for (nI = 0; nI < (aCampos.length-1) ; nI++) {
- if(cTipo == 'B'){
- $("#"+aCampos[nI]).attr("disabled","");
- } else {
- $("#"+aCampos[nI]).removeAttr('disabled');
- $("#"+aCampos[nI]).attr("disabled",false);
- }
- }
- }
- /**
- Preenche a revisão da oportunidade
- **/
- function atuRevOpt(){
- var cOport = $("#CJ_NROPOR").val();
- var cobjOport = $("#CJ_NROPOR")[0];
- var cRevisa = cobjOport.options[cobjOport.selectedIndex].text.substr(7,2)
- var dialog = bootbox.dialog({
- message: '<p class="text-center"><i class="fa fa-spin fa-spinner"></i> Buscando dados da oportunidade... Aguarde...</p>',
- closeButton: false
- });
- if(cOport != ""){
- $("#CJ_REVISA").val(cRevisa);
-
- $.ajax({
- url: "U_GetDadosOpt.apw?PR=<%=cLCodLogin%>",
- data: 'oportunidade='+cOport+'&revisao='+cRevisa,
- type: "POST",
- async: false,
- success:
- function(dados) {
- if (dados.indexOf('<META HTTP-EQUIV') >= 0 ) {
- $("html").html(dados);
- return;
- } else {
- if (dados.substr(0, 2) == "OK") {
- aVlr = dados.substr(5).split('|#|');
-
- //Atualiza a comissão
- $("#CJ_COMISTR").val(aVlr[0]);
- //Atualiza o vendedor
- $("#CJ_VEND3").append($.parseHTML(aVlr[1]));
- $('.selectpicker').selectpicker('render');
- $('.selectpicker').selectpicker('refresh');
- $("#select2-CJ_VEND3-container").html($("#CJ_VEND3 option[value='"+aVlr[2]+"']").html());
-
- } else {
- bootbox.alert("Falha ao localizar os dados da oportunidade!");
- }
- }
- }
- });
- } else {
- $("#CJ_REVISA").val("");
- }
- dialog.modal('hide');
- }
- /**
- Atualiza o valor do frete
- **/
- function atuVlrFrete(){
- var cUFEnt = $("#CJ_UFENT").val().substr(0,2)
- var cMunEnt = $("#CJ_UFENT").val().substr(3,5)
-
- if(cUFEnt != ""){
-
- $.ajax({
- url: "U_GetPerFrt.apw?PR=<%=cLCodLogin%>",
- data: 'uf='+cUFEnt+'&mun='+cMunEnt,
- type: "POST",
- async: false,
- success:
- function(frete) {
- if (frete.indexOf('<META HTTP-EQUIV') >= 0 ) {
- $("html").html(frete);
- return;
- } else {
- //Atualiza o frete
- $("#CJ_PERCFRT").removeAttr("disabled");
- $("#CJ_PERCFRT").val(frete);
- }
- }
- });
- }
- }
- /**
- Valida o estudo
- **/
- function vldEstudo(){
- var cEstudo = $("#CJ_LUMINOT").val();
- if(cEstudo == "1"){
- $("#CJ_REGLUMI").removeAttr('disabled');
- } else {
- $("#CJ_REGLUMI").val("");
- $("#select2-CJ_REGLUMI-container").html($("#CJ_REGLUMI option[value='']").html());
- $("#CJ_REGLUMI").attr("disabled","");
- }
- }
- /**
- Valida a prospecção
- **/
- function vldProspec(){
- var cProspec = $("#CJ_PROPECC").val();
- if(cProspec == "S"){
- $("#CJ_PROSCOD").removeAttr('disabled');
- } else {
- $("#CJ_PROSCOD").val("");
- $("#select2-CJ_PROSCOD-container").html($("#CJ_PROSCOD option[value='']").html());
- $("#CJ_PROSCOD").attr("disabled","");
- }
- }
- /**
- Valida o campo prospectado por
- **/
- function vldProsPor(){
- var cProspec = $("#CJ_PROPECC").val();
- var cProsPor = $("#CJ_PROSCOD").val();
- if(cProspec == "S" && cProsPor == ""){
- bootbox.alert("Informe o campo Prospectado Por!")
- }
- if (cProspec == "N"){
- $("#CJ_PROSCOD").val("");
- $("#select2-CJ_PROSCOD-container").html($("#CJ_PROSCOD option[value='']").html());
- $("#CJ_PROSCOD").attr("disabled","");
- }
- }
-
- /**
- Busca os produtos a partir da tabela de preço
- **/
- function selProd(){
- var tabpreco;
- var cliente;
- var item;
-
- cliente = $("#CJ_CLIENTE").val();
- tabpreco = $("#CJ_TABELA").val();
- item = $("#PROXIMO").val();
-
- $.ajax({
- url: "U_GetProdutos.apw?PR=<%=cLCodLogin%>",
- data: 'cliente='+cliente+'&tabela='+tabpreco,
- type: "POST",
- async: false,
- success:
- function(produtos) {
- if (produtos.indexOf('<META HTTP-EQUIV') >= 0 ) {
- $("html").html(produtos);
- return;
- }
-
- if ( produtos == "" ) {
- bootbox.alert('Não foram encontrados produtos para a tabela de preço '+tabpreco+'!');
- $("#CJ_TABELA").focus();
- }
- else {
- //Bloqueia a edição do campo de tabela
- $("#CJ_TABELA").attr("disabled","");
-
- //Preenche o select dos produtos
- $("#CK_PRODUTO"+item).append($.parseHTML(produtos));
- $('.selectpicker').selectpicker('render');
- $('.selectpicker').selectpicker('refresh');
- optProd = produtos;
- }
- }
- });
- }
-
-
- /**
- Busca as condições de pagamento disponíveis de acordo com a modalidade
- **/
- function condPag(){
- var modali = $("#CJ_XMODALI").val();
- var dialogTab = bootbox.dialog({
- message: '<p class="text-center"><i class="fa fa-spin fa-spinner"></i> Buscando condições de pagamento... Aguarde...</p>',
- closeButton: false
- });
-
- $.ajax({
- url: "U_GetCondPgto.apw?PR=<%=cLCodLogin%>",
- data: 'modali='+modali,
- type: "POST",
- async: false,
- success:
- function(condicao) {
- if (condicao.indexOf('<META HTTP-EQUIV') >= 0 ) {
- $("html").html(condicao);
- return;
- }
-
- if ( condicao == "" ) {
- bootbox.alert('Falha ao localizar as condições de pagamento para esta modalidade!');
- document.getElementById('CJ_CONDPAG').innerText = null;
- $('.selectpicker').selectpicker('render');
- $('.selectpicker').selectpicker('refresh');
- $("#CJ_XMODALI").focus();
- }
- else {
-
- //Preenche o select das condições
- document.getElementById('CJ_CONDPAG').innerText = null;
- $("#CJ_CONDPAG").append(condicao);
- optCond = condicao;
- if ($("#CJ_XMODALI").val() != "") {
- $("#CJ_CONDPAG").removeAttr('disabled');
- }
- //Para cartão habilita as opções de parcela e bandeira
- if ($("#CJ_XMODALI").val() == "03") {
- $("#CJ_XPARC").removeAttr('disabled');
- $("#CJ_XPARC").attr("required","");
- $("#CJ_XPARC").attr("aria-required","true"); //torna obrigatório
-
- // $("#CJ_XBAND").removeAttr('disabled');
- // $("#CJ_XBAND").attr("required","");
- // $("#CJ_XBAND").attr("aria-required","true"); //torna obrigatório
-
- } else {
- $("#CJ_XPARC").attr('disabled',"");
- //$("#CJ_XBAND").attr('disabled',"");
- }
- }
- }
- });
- dialogTab.modal('hide');
- }
-
- /**
- Valida a condição de pagamento selecionada
- **/
- function vldCond(){
- var valDesc = 0;
-
- $.ajax({
- url: "U_VldCondPg.apw?PR=<%=cLCodLogin%>",
- data: 'condPgto='+$("#CJ_CONDPAG").val(),
- type: "POST",
- async: false,
- success:
- function(retorno) {
- valDesc = parseFloat(retorno);
-
- //Atualiza a variável
- $("#DESCCOND").val(valDesc);
-
- if (valDesc > 0) {
- bootbox.alert("Condição de pagamento com desconto. Ao salvar o orçamento será aplicado o desconto de "+mascaraValor(valDesc.toFixed(2))+"%.");
- } else {
- $("#DESCCOND").val("0");
- }
- //Atualiza o valor do produto quando altera a condição de pagamento
- if ($('#iCK_PRCVEN01').val()!=$('#CK_PRCVEN01').val() || $("#DESCCOND").val()=="0"){
- AtuValProd();
- }
- }
- });
- }
-
- /**
- Monta a tela para selecionar o produto
- **/
- function getProduto(btPesquisa){
- var objProd = btPesquisa.closest("td").find("[autocomplete=off]");
- var cProdBusca = $("#"+objProd.attr("name")).val().toUpperCase();
- //var nItem = btPesquisa[0].id.substr(8,2);
- var nItem = objProd.attr("name").substr(10);
- $("#PROXIMO").val(nItem);
- // Usando a função buscarProdutos com um callback
- buscarProdutos(cProdBusca, nItem, function (produtosEncontrados) {
- if (produtosEncontrados.length >= 1) {
- var selectOptions = '<select id="produtoSelecionado">';
- //var selectOptions = '<select data-plugin-selectTwo class="form-control populate placeholder" data-plugin-options="{ "placeholder": "Selecione...", "allowClear": false }" id="produtoSelecionado">';
- var indiceHifen;
- var selOptions = '';
- produtosEncontrados.forEach(function (produto) {
- selectOptions += "<option value='" + produto + "'>" + produto + "</option>";
- //selOptions+= "{text: '"+produto+"',value: '"+produto+"'},";
- });
- selectOptions += "</select>";
- bootbox.dialog({
- title: 'Produtos',
- message: "<p>Selecione o produto desejado:</p>" + selectOptions,
- backdrop: false,
- size: 'large',
- buttons: {
- confirm: {
- label: 'Confirmar',
- className: 'btn-primary',
- callback: function () {
- var produtoSelecionado = $("#produtoSelecionado").val();
- // Atualiza o campo original com o produto escolhido
- $("#CK_PRODUTO" + nItem).val(produtoSelecionado);
- // Encontra a posição do primeiro h?fen na string
- indiceHifen = produtoSelecionado.indexOf("-");
- //Pega apenas o codigo do produto
- produtoSelecionado = produtoSelecionado.substring(0, indiceHifen);
- //Remove espaços vazios
- produtoSelecionado = produtoSelecionado.trim();
- //gatProduto(objProd,produtoSelecionado);
- }
- },
- cancel: {
- label: 'Cancelar',
- className: 'btn-default',
- callback: function () {
- }
- }
- }/*,
- callback: function (result) {
- console.log(result);
- }*/
- });
- /*
- bootbox.dialog({
- title: 'Produtos',
- message: "<p>Selecione o produto desejado:</p>" + selectOptions,
- backdrop: false,
- size: 'large',
- buttons: {
- confirm: {
- label: 'Confirmar',
- className: 'btn-primary',
- callback: function () {
- var produtoSelecionado = $("#produtoSelecionado").val();
- // Atualiza o campo original com o produto escolhido
- $("#CK_PRODUTO" + nItem).val(produtoSelecionado);
- // Encontra a posição do primeiro h?fen na string
- indiceHifen = produtoSelecionado.indexOf("-");
- //Pega apenas o codigo do produto
- produtoSelecionado = produtoSelecionado.substring(0, indiceHifen);
- //Remove espaços vazios
- produtoSelecionado = produtoSelecionado.trim();
- gatProduto(objProd,produtoSelecionado);
- }
- },
- cancel: {
- label: 'Cancelar',
- className: 'btn-default',
- callback: function () {
- }
- }
- }
- });*/
- } else {
- // Nenhum produto encontrado
- bootbox.alert("Nenhum produto encontrado!")
- }
- });
- }
-
- /**
- Busca dados do produto a partir do código ou descrição
- **/
- function buscarProdutos(cProdBusca,item,callback){
- var cliente = $("#CJ_CLIENTE").val();
- var tabpreco = $("#CJ_TABELA").val();
- var item = $("#PROXIMO").val();
- if (cProdBusca != ""){
- if(cliente == ""){
- bootbox.alert("Selecione o cliente para continuar!");
- return false;
- }
- $.ajax({
- url: "U_GetLikePro.apw?PR=<%=cLCodLogin%>",
- data: 'cliente=' + cliente + '&tabela=' + tabpreco + '&digit=' + cProdBusca,
- method: "POST",
- async: false,
- success: function( produtos ) {
- if (produtos.toLowerCase().indexOf('<META HTTP-EQUIV') >= 0 ||produtos.toLowerCase().indexOf("Expires") != -1) {
- $("html").html(produtos);
- callback([]); // Retorna uma lista vazia em caso de erro
- }
-
- if (produtos == "") {
- bootbox.alert('Não foram encontrados produtos para o termo pesquisado!');
- callback([]); // Retorna uma lista vazia em caso de erro
- } else {
- $("#CK_PRODUTO" + item).empty(); // Limpa o conteúdo existente
- /*
- // Preenche o select dos produtos
- $("#CK_PRODUTO" + item).empty(); // Limpa o conteúdo existente
- $("#CK_PRODUTO"+item).append($.parseHTML(produtos));
- $('.selectpicker').selectpicker('render');
- $('.selectpicker').selectpicker('refresh');
- optProd = produtos;
- */
- var selectpicker = $("<select>", {
- class: "selectpicker",
- title: "Selecione um produto"
- });
- selectpicker.append($.parseHTML(produtos));
- // Adiciona os valores dos elementos <option> listaProdutos
- var listaProdutos = selectpicker.find('option').map(function () {
- //return $(this).val();
- ////Luiz SMS - 04/01/2024
- return $(this).text();//Pegar o texto completo
- }).get();
- $("#CK_PRODUTO" + item).append(selectpicker);
- callback(listaProdutos); // Retorna a lista de produtos encontrados
- }
- }
- });
- } else {
- bootbox.alert("Informe o produto para busca!");
- }
- }
- /**
- Busca dados do produto a partir do código de barras
- **/
- function Maiuscula(cItemAtu){
- var cCodBar = $("#"+cItemAtu.attr("id")).val().toUpperCase();
- $(cItemAtu).val(cCodBar);
- }
-
- /**
- Gatilho acionado ao selecionar o produto para preencher os valores
- **/
- function gatProduto(objInput) {
- var nItens = parseFloat($("#PROXIMO").val());
- var lProdOK = true
- var nItem = objInput.attr("name").substr(10);
- var dialogProd = bootbox.dialog({
- message: '<p class="text-center"><i class="fa fa-spin fa-spinner"></i> Buscando dados do produto... Aguarde...</p>',
- closeButton: false
- });
-
-
- //valida a digitação duplicada de itens
- for (i = 1; i<=nItens; i++) {
- cItem = String(i);
- if (parseInt(i) < 10 ){cItem = "0"+String(i)};
-
- cItmOrc = $("#CK_ITEM"+cItem).val();
-
- if(cItmOrc != "x" && nItem != cItem ) {
- if ($('#CK_PRODUTO'+cItem).val() == objInput.val()){
- lProdOK = false;
- $('#CK_PRODUTO'+nItem).val("");
- $("#select2-CK_PRODUTO"+cItem+"-container").html("Selecione...");
- }
- }
- }
-
- if (!lProdOK ) {
- bootbox.alert("Este item já foi informado no orçamento!");
- dialogProd.modal('hide');
- }
- //Fim da validação de itens duplicados
-
- if ( ! objInput.is('[readonly]') && $.trim(objInput.val()) != "" && lProdOK ) {
-
- jQuery.ajax({
- type: "POST",
- url: "U_GATPROD.APW?PR=<%=cLCodLogin%>",
- data: 'produto='+encodeURIComponent(objInput.val()),
- error: function (jqXHR, textStatus, error){
- dialogProd.modal('hide');
- bootbox.alert("Falha ao recuperar informações!");
- console.log(error);
- },
- success: function( data ) {
- var aVlr;
- var cMsgErro;
- var nItem = objInput.attr("name").substr(10);
-
- dialogProd.modal('hide');
-
- if (data.substr(0, 2) == "OK") {
- aVlr = data.substr(3).split('|#|');
- $("input[name='CK_UM"+nItem+"']").val(aVlr[0]);
- $.trim($("input[name='CK_PRCVEN"+nItem+"']").val(aVlr[1]));
- $.trim($("input[name='iCK_PRCVEN"+nItem+"']").val(aVlr[1]));
- $.trim($("input[name='CK_XVALICM"+nItem+"']").val(aVlr[2]));
- $.trim($("input[name='CK_XVALIPI"+nItem+"']").val(aVlr[3]));
- $.trim($("input[name='CK_XICMST"+nItem+"']").val(aVlr[4]));
- $.trim($("input[name='CK_LOCAL"+nItem+"']").val(aVlr[15]));
-
- //Input hidden
- $("input[id='ALIQ_IPI"+nItem+"']").val(aVlr[5]);
- $("input[id='ALIQ_ICMS"+nItem+"']").val(aVlr[6]);
- $("input[id='ALIQ_ST"+nItem+"']").val(aVlr[12]);
- $("input[id='BASE_IPI"+nItem+"']").val(aVlr[11]);
- $("input[id='BASE_ICMS"+nItem+"']").val(aVlr[9]);
- $("input[id='BASE_ST"+nItem+"']").val(aVlr[10]);
- $("input[id='VAL_ICMS"+nItem+"']").val(aVlr[2]);
- $("input[id='VAL_ST"+nItem+"']").val(aVlr[4]);
- $("input[id='VAL_IPI"+nItem+"']").val(aVlr[3]);
-
- $("input[id='QTD_EMB"+nItem+"']").val(aVlr[7]);
- $("input[id='CK_TES"+nItem+"']").val(aVlr[8]);
- $("input[id='GRUPO"+nItem+"']").val(aVlr[13]);
- $("input[id='QTDMIN"+nItem+"']").val(aVlr[14]);
- $("input[id='EST_DISP"+nItem+"']").val(aVlr[16]);
-
- //Limpa os inputs, caso tenha trocado o produto
- $("input[name='CK_QTDVEN"+nItem+"']").removeAttr('disabled');
- if ($("#CK_XCODBAR"+nItem).val() == ""){
- $("input[name='CK_QTDVEN"+nItem+"']").val("");
- } else {
- if ($("#XCODBAR"+nItem).val() != aVlr[16] && $("#XCODBAR"+nItem).val() != aVlr[17]){
- $("#XCODBAR"+nItem).val() = "";
- }
- }
- $("input[name='CK_VALOR"+nItem+"']").val("0,00");
-
- } else {
-
- if (data.substr(0, 4) == "ERRO") {
- cMsgErro = data.substr(5);
- bootbox.alert(cMsgErro);
- LimpaLinha(nItem);
- } else {
- cMsgErro = "Houve falha ao localizar os dados do produto. Tente novamente!";
- bootbox.alert(cMsgErro);
- LimpaLinha(nItem);
- // Quando ocorre erro no protheus
- console.log(data);
- }
- }
- }
- });
-
- } else if ($.trim(objInput.val()) == "" ) {
- LimpaLinha(nItem);
- }
-
- return false;
- }
-
- /**
- Funcao de calculo do total do item
- **/
- function TotalItem(cItemAtu) {
- var nQuant;
- var nVlrUnit;
- var nVlrTabela;
- var nTotalUnit;
- var nICMS;
- var nICMSST;
- var nIPI;
- var nPerDesc = 0;
- var nValFrete;
- var nVlrTotal;
- var nBaseIPI;
- var nBaseICMS;
- var nBaseST;
- var cFaixaDesc;
- var nPerCom = 0;
- var nValCom = 0;
- var nValDesc = 0;
-
- cCodProd = $("#CK_PRODUTO"+cItemAtu).val();
- nQuant = parseFloat($("#CK_QTDVEN"+cItemAtu).val().replace('.',"").replace(",","."));
- nVlrTabela = $('#iCK_PRCVEN'+cItemAtu).maskMoney('unmasked')[0];
- //nVlrTabela = $('#CK_PRCVEN'+cItemAtu).maskMoney('unmasked')[0];
- //nVlrUnit = $('#iCK_PRCVEN'+cItemAtu).maskMoney('unmasked')[0];
- nValFrete = $("#CJ_FRETE").maskMoney('unmasked')[0];
- if ($('#CK_DESCONT'+cItemAtu).maskMoney('unmasked')[0] != 0){
- nPerDesc = $("#CK_DESCONT"+cItemAtu).maskMoney('unmasked')[0];
- }
- nVlrUnit = nVlrTabela - (nVlrTabela*(nPerDesc/100));
- nVlrTotal = nVlrTabela*nQuant;
- nTotalUnit = nVlrTotal
- nValDesc = nVlrTotal*(nPerDesc/100);
- nVlrTotal = nVlrTotal - nValDesc;
-
-
- //Tratamento para os impostos
- nICMS = $('#CK_XVALICM'+cItemAtu).maskMoney('unmasked')[0];
- nICMSST = $('#CK_XICMST'+cItemAtu).maskMoney('unmasked')[0];
- nIPI = $("#CK_XVALIPI"+cItemAtu).maskMoney('unmasked')[0];
-
- //Aliquotas
- nAliqIPI = parseFloat($("#ALIQ_IPI"+cItemAtu).val());
- nAliqICMS = parseFloat($("#ALIQ_ICMS"+cItemAtu).val());
- nAliqST = parseFloat($("#ALIQ_ST"+cItemAtu).val());
-
- //Valores Base
- nBaseIPI = parseFloat($("#BASE_IPI"+cItemAtu).val());
- nBaseICMS = parseFloat($("#BASE_ICMS"+cItemAtu).val());
- nBaseST = parseFloat($("#BASE_ST"+cItemAtu).val());
-
- //Valor do imposto
- nIPI = nBaseIPI * nQuant * (nAliqIPI /100)
- nICMS = nBaseICMS * nQuant * (nAliqICMS /100)
- nICMSST = nQuant * parseFloat($("#VAL_ST"+cItemAtu).val().replace(",","."));
-
- //nIPI = nVlrTotal*(nAliqIPI /100)
- //nICMS = nVlrTotal*(nAliqICMS /100)
- //nIPI = nQuant * parseFloat($("#VAL_IPI"+cItemAtu).val().replace(",","."));
- //nICMS = nQuant * parseFloat($("#VAL_ICMS"+cItemAtu).val().replace(",","."));
- //nICMSST = nQuant * parseFloat($("#VAL_ST"+cItemAtu).val().replace(",","."));
-
- nVlrTotal = nVlrTotal+nIPI+nICMSST;
- nTotalUnit = nVlrTotal / nQuant;
-
- //Atualiza o campo do total
- $.trim($("#CK_XVALICM"+cItemAtu).val(mascaraValor(nICMS.toFixed(2))));
- $.trim($("#CK_XVALIPI"+cItemAtu).val(mascaraValor(nIPI.toFixed(2))));
- $.trim($("#CK_XICMST"+cItemAtu).val(mascaraValor(nICMSST.toFixed(2))));
- $.trim($("#iCK_PRCVEN"+cItemAtu).val(mascaraValor(nVlrUnit.toFixed(2))));
- $.trim($("#CK_VALOR"+cItemAtu).val(mascaraValor(nVlrTotal.toFixed(2))));
- $.trim($("#CK_XPRCIMP"+cItemAtu).val(mascaraValor(nTotalUnit.toFixed(2))));
- //Atualiza o total geral
- TotalGeral();
- }
-
- /**
- Total Geral
- **/
- function TotalGeral() {
- var nItens = parseFloat($("#PROXIMO").val());
- var i;
- var nVlrTabela = 0;
- var nVlrUnit = 0;
- var nICMS = 0;
- var nICMSST = 0;
- var nIPI = 0;
- var nImpostos = 0;
- var nValFrete = 0;
- var nTotal = 0;
- var nAcresc = 0;
- var nDescCond = 0;
- var nQuant = 0;
- var nValCom = 0;
- var cCodProd;
- var cItmOrc;
- var nTotQuant = 0.00;
- var nSaldo = 0;
- var nTotalProm = 0
-
- for (i = 1; i<=nItens; i++) {
- cItem = String(i);
- if (parseInt(i) < 10 ){cItem = "0"+String(i)};
-
- cCodProd = $("#CK_PRODUTO"+cItem).val();
- cItmOrc = $("#CK_ITEM"+cItem).val();
- if(cItmOrc != "x") {
- nQuant = parseFloat($("#CK_QTDVEN"+cItem).val().replace('.',"").replace(",","."));
- nTotQuant += nQuant;
- nVlrUnit += nQuant * $('#iCK_PRCVEN'+cItem).maskMoney('unmasked')[0];
- nICMS += $('#CK_XVALICM'+cItem).maskMoney('unmasked')[0];
- nICMSST += $('#CK_XICMST'+cItem).maskMoney('unmasked')[0];
- nIPI += $("#CK_XVALIPI"+cItem).maskMoney('unmasked')[0];
- nValCom += $("#VAL_COM"+cItem).maskMoney('unmasked')[0];
- nTotal += $('#CK_VALOR'+cItem).maskMoney('unmasked')[0];
- if ($("#PROMOCAO"+cItem).val() == "1"){
- nTotalProm += $('#CK_VALOR'+cItem).maskMoney('unmasked')[0];
- }
- nSaldo += $('#SALDO'+cItem).maskMoney('unmasked')[0];
- }
- }
- nImpostos = nICMSST+nIPI; //nICMS
- nValFrete = $("#CJ_FRETE").maskMoney('unmasked')[0];
-
- /*
- //Verifica acrescimo da condição de pagamento
- $.ajax({
- url: "U_ValAcresc.apw?PR=<%=cLCodLogin%>",
- data: 'condPgto='+$("#CJ_CONDPAG").val()+'&valor='+nTotal,
- type: "POST",
- async: false,
- success:
- function(retorno) {
- //nAcresc = parseFloat(retorno);
- nAcresc = parseFloat(nTotal*(retorno/100))
- }
- });
- */
- nDescCond = parseFloat((nTotal-nTotalProm)*($("#DESCCOND").val()/100)); //desconto da condição de pagamento
- //nDescCond = parseFloat(nTotal*($("#DESCCOND").val()/100)); //desconto da condição de pagamento
- nTotal = (nTotal+nValFrete+nAcresc)-nDescCond;
-
- //Atualiza os totais
- $("#TOTAL_QITENS").val($.trim(mascaraValor(nTotQuant.toFixed(2))));
- $("#TOTAL_ITENS").val($.trim(mascaraValor(nVlrUnit.toFixed(2))));
- $("#TOTAL_IMP").val($.trim(mascaraValor(nImpostos.toFixed(2))));
- $("#TOTAL_FRETE").val($("#CJ_FRETE").val());
- $("#TOTAL_ACRESC").val($.trim(mascaraValor(nDescCond.toFixed(2))));
- //$("#TOTAL_ACRESC").val($.trim(mascaraValor(nAcresc.toFixed(2))));
- $("#TOTAL_ORC").val($.trim(mascaraValor(nTotal.toFixed(2))));
- $("#TOTAL_COM").val($.trim(mascaraValor(nValCom.toFixed(2))));
- $("#TOTAL_SALDO").val($.trim(mascaraValor(nSaldo.toFixed(2))));
- }
-
- /**
- Atualiza o valor do produto ao trocar a condição de pagamento
- **/
- function AtuValProd(){
- var nItens = parseFloat($("#PROXIMO").val());
- var i;
- var nvalorcheio = 0;
- for (i = 1; i<=nItens; i++) {
- cItem = String(i);
- if (parseInt(i) < 10 ){cItem = "0"+String(i)};
- cItmOrc = $("#CK_ITEM"+cItem).val();
- if(cItmOrc != "x") {
- nvalorcheio = $('#CK_PRCVEN'+cItem).val();
- $('#iCK_PRCVEN'+cItem).val(nvalorcheio);
- TotalItem(cItem);
- }
- }
- }
- /**
- Verifica se a quantidade é múltiplo da embalagem
- **/
- function VldQtd(cItemAtu) {
- var nQuant;
- var nQtdEmb;
- var nQtdMin;
- var resto;
- cCodProd = $("#CK_PRODUTO"+cItemAtu).val();
- var lRet = true
-
- //Valida a quantidade por embalagem
- nQtdEmb = parseFloat($("#QTD_EMB"+cItemAtu).val());
- nQtdMin = $("#QTDMIN"+cItemAtu).val();
- nQuant = parseFloat($("#CK_QTDVEN"+cItemAtu).val().replace('.',"").replace(",","."));
- if (nQuant > 0){
-
- //Valida a quantidade da embalagem
- if (nQtdEmb > 0){
- if (nQuant < (nQtdEmb)){
- bootbox.alert("A quantidade deve ser múltiplo de "+nQtdEmb.toString()+".");
- $("#CK_QTDVEN"+cItemAtu).val("");
- lRet = false;
- return false;
- } else {
- resto = nQuant % nQtdEmb;
- if (resto != 0 ){
- bootbox.alert("A quantidade deve ser múltiplo de "+nQtdEmb.toString()+".");
- $("#CK_QTDVEN"+cItemAtu).val("");
- lRet = false;
- return false;
- }
- }
- }
- var dialogProd = bootbox.dialog({
- message: '<p class="text-center"><i class="fa fa-spin fa-spinner"></i> Buscando dados do produto... Aguarde...</p>',
- closeButton: false
- });
- //Atualiza o preço de acordo com a quantidade
- jQuery.ajax({
- type: "POST",
- url: "U_GATPROD.APW?PR=<%=cLCodLogin%>",
- data: 'produto='+encodeURIComponent(cCodProd)+'&quant='+nQuant,
- error: function (jqXHR, textStatus, error){
- dialogProd.modal('hide');
- bootbox.alert("Falha ao recuperar informações!");
- console.log(error);
- },
- success: function( data ) {
- var aVlr;
- var cMsgErro;
-
- dialogProd.modal('hide');
-
- if (data.substr(0, 2) == "OK") {
- aVlr = data.substr(3).split('|#|');
- $("input[name='CK_UM"+cItemAtu+"']").val(aVlr[0]);
- $.trim($("input[name='CK_PRCVEN"+cItemAtu+"']").val(aVlr[1]));
- $.trim($("input[name='iCK_PRCVEN"+cItemAtu+"']").val(aVlr[1]));
- $.trim($("input[name='CK_XVALICM"+cItemAtu+"']").val(aVlr[2]));
- $.trim($("input[name='CK_XVALIPI"+cItemAtu+"']").val(aVlr[3]));
- $.trim($("input[name='CK_XICMST"+cItemAtu+"']").val(aVlr[4]));
- $.trim($("input[name='CK_LOCAL"+cItemAtu+"']").val(aVlr[15]));
-
- //Input hidden
- $("input[id='ALIQ_IPI"+cItemAtu+"']").val(aVlr[5]);
- $("input[id='ALIQ_ICMS"+cItemAtu+"']").val(aVlr[6]);
- $("input[id='ALIQ_ST"+cItemAtu+"']").val(aVlr[12]);
- $("input[id='BASE_IPI"+cItemAtu+"']").val(aVlr[11]);
- $("input[id='BASE_ICMS"+cItemAtu+"']").val(aVlr[9]);
- $("input[id='BASE_ST"+cItemAtu+"']").val(aVlr[10]);
- $("input[id='VAL_ICMS"+cItemAtu+"']").val(aVlr[2]);
- $("input[id='VAL_ST"+cItemAtu+"']").val(aVlr[4]);
- $("input[id='VAL_IPI"+cItemAtu+"']").val(aVlr[3]);
-
- $("input[id='QTD_EMB"+cItemAtu+"']").val(aVlr[7]);
- $("input[id='CK_TES"+cItemAtu+"']").val(aVlr[8]);
- $("input[id='GRUPO"+cItemAtu+"']").val(aVlr[13]);
- $("input[id='QTDMIN"+cItemAtu+"']").val(aVlr[14]);
-
- } else {
-
- if (data.substr(0, 4) == "ERRO") {
- cMsgErro = data.substr(5);
- bootbox.alert(cMsgErro);
- LimpaLinha(cItemAtu);
- } else {
- cMsgErro = "Houve falha ao localizar os dados do produto. Tente novamente!";
- bootbox.alert(cMsgErro);
- LimpaLinha(cItemAtu);
- // Quando ocorre erro no protheus
- console.log(data);
- }
- }
- }
- });
-
- } else {
- bootbox.alert("Informe a quantidade!");
- lRet = false;
- return false;
- }
-
- if (lRet == true){
- //Valida o estoque do produto
- vldEstoque(cItemAtu);
- }
-
- //Gatilho para total do item
- TotalItem(cItemAtu);
- }
-
-
-
-
- /**
- Verifica se existe estoque disponível
- **/
- function vldEstoque(cItem){
- var produto = $("#CK_PRODUTO"+cItem).val();
- var quantidade = parseFloat($("#CK_QTDVEN"+cItem).val().replace('.',","));
- var qtd = $("#CK_QTDVEN"+cItem).val();
- var lret = true;
- var retVld = true;
-
- var dialogTab = bootbox.dialog({
- message: '<p class="text-center"><i class="fa fa-spin fa-spinner"></i> Verificando estoque disponível... Aguarde...</p>',
- closeButton: false
- });
-
- $.ajax({
- url: "U_GetEstDisp.apw?PR=<%=cLCodLogin%>",
- data: 'produto='+encodeURIComponent(produto)+'&quantidade='+qtd,
- type: "POST",
- async: false,
- success:
- function(retorno) {
- if (retorno.indexOf('<META HTTP-EQUIV') >= 0 ) {
- $("html").html(retorno);
- return;
- }
- saldo = parseInt(retorno);
- $("#EST_DISP"+cItem).val(saldo);
- if ( saldo <= 0 || saldo < quantidade) {
- if(retorno < 0){
- retorno = 0
- };
- dialogTab.modal('hide');
- bootbox.alert('Não há saldo disponível em estoque para a quantidade solicitada para o item '+produto+'! <br>O saldo atual é de '+retorno+'.');
-
- if ($('#CJ_XTPORC').val() == "1"){
- $("#CK_QTDVEN"+cItem).val("");
- lret = false;
- retVld = false;
- }
- }
- }
- });
-
- if (lret == true){
- //Habilita os campos para edição
- $("#CK_XPEDCLI"+cItem).removeAttr('disabled');
- $("#CK_XITEMCL"+cItem).removeAttr('disabled');
- $("#CK_DESCONT"+cItem).removeAttr('disabled');
- }
- dialogTab.modal('hide');
-
- return retVld;
- }
-
- /**
- Limpa os valores da linha
- **/
- function LimpaLinha(cItem) {
- $("#CK_QTDVEN"+cItem).val("");
- $("#CK_LOCAL"+cItem).val("");
- $("#iCK_PRCVEN"+cItem).val("");
- $("#CK_PRCVEN"+cItem).val("");
- $("#CK_XPRCIMP"+cItem).val("");
- $("#CK_XVALIPI"+cItem).val("");
- $("#CK_XVALICM"+cItem).val("");
- $("#CK_XICMST"+cItem).val("");
- $("#CK_VALOR"+cItem).val("");
- $("#PER_COM"+cItem).val("");
- $("#VAL_COM"+cItem).val("");
- $("#CK_DESCONT"+cItem).val("");
-
- TotalGeral();
- }
-
- /**
- Verifica se o valor digitado é maior que o valor de tabela
- **/
- function VldValor(cItemAtu) {
- var nVlrTabela = $('#CK_PRCVEN'+cItemAtu).maskMoney('unmasked')[0];
- var nVlrUnit = $('#iCK_PRCVEN'+cItemAtu).maskMoney('unmasked')[0];
- var produto = $("#CK_PRODUTO"+cItemAtu).val();
- var nValMin = 0;
- var nDescont = 0;
- var nDescMax = 0;
- var aDesc;
- var lOK = true;
- var lMostra = false;
- var dialogTab = bootbox.dialog({
- message: '<p class="text-center"><i class="fa fa-spin fa-spinner"></i> Verificando valores... Aguarde...</p>',
- closeButton: false
- });
-
- if ($('#CK_DESCONT'+cItemAtu).maskMoney('unmasked')[0] != 0){
- nDescont = $('#CK_DESCONT'+cItemAtu).maskMoney('unmasked')[0];
- if (nDescont < -10) {
- dialogTab.modal('hide');
- bootbox.alert('O desconto negativo deve ser no máximo -10%!');
- $('#CK_DESCONT'+cItemAtu).val("");
- return false;
- }
-
- }
-
- //Valida o valor máximo --retirado Lucilene 11.08.20
- //if ( lOK && nVlrUnit > nVlrTabela){
- // dialogTab.modal('hide');
- // bootbox.alert("O valor máximo permitido é o valor da tabela!");
- // $("#iCK_PRCVEN"+cItemAtu).val($('#CK_PRCVEN'+cItemAtu).val());
- // $("#iCK_PRCVEN"+cItemAtu).focus();
- // lOK = false;
- //}
-
- //dialogTab.modal('hide');
-
- //Atualiza o valor dos impostos
- if (lOK && nDescont != 0){
- var cCodProd = $("#CK_PRODUTO"+cItemAtu).val();
- var cQuant = $("#CK_QTDVEN"+cItemAtu).val();
- //var dialogImp = bootbox.dialog({
- // message: '<p class="text-center"><i class="fa fa-spin fa-spinner"></i> Atualizando os valores dos impostos... Aguarde...</p>',
- // closeButton: false
- // });
- nVlrUnit = nVlrTabela - (nVlrTabela * (nDescont/100))
- $.ajax({
- url: "U_GetImpostos.apw?PR=<%=cLCodLogin%>",
- data: 'produto='+encodeURIComponent(cCodProd)+'&prcvenda='+nVlrUnit+'&quantidade='+cQuant,
- type: "POST",
- async: false,
- error: function (jqXHR, textStatus, error){
- dialogTab.modal('hide');
- bootbox.alert("Falha ao atualizar o valor dos impostos!");
- console.log(error);
- lOK = false;
- },
- success:
- function(data) {
-
- dialogTab.modal('hide');
- if (data.indexOf('<META HTTP-EQUIV') >= 0 ) {
- $("html").html(data);
- return;
- }
-
- if (data.substr(0, 2) == "OK") {
- aVlr = data.substr(3).split('|#|');
- $.trim($("input[name='CK_XVALICM"+cItemAtu+"']").val(aVlr[2]));
- $.trim($("input[name='CK_XICMST"+cItemAtu+"']").val(aVlr[4]));
- $.trim($("input[name='CK_XVALIPI"+cItemAtu+"']").val(aVlr[3]));
- $.trim($("#iCK_PRCVEN"+cItemAtu).val(mascaraValor(nVlrUnit.toFixed(2))));
- //Input hidden
- $("input[id='ALIQ_IPI"+cItemAtu+"']").val(aVlr[5]);
- $("input[id='ALIQ_ICMS"+cItemAtu+"']").val(aVlr[6]);
- $("input[id='ALIQ_ST"+cItemAtu+"']").val(aVlr[12]);
- $("input[id='CK_TES"+cItemAtu+"']").val(aVlr[8]);
- $("input[id='BASE_IPI"+cItemAtu+"']").val(aVlr[11]);
- $("input[id='BASE_ICMS"+cItemAtu+"']").val(aVlr[9]);
- $("input[id='BASE_ST"+cItemAtu+"']").val(aVlr[10]);
- $("input[id='VAL_ICMS"+cItemAtu+"']").val(aVlr[2]);
- $("input[id='VAL_ST"+cItemAtu+"']").val(aVlr[4]);
- $("input[id='VAL_IPI"+cItemAtu+"']").val(aVlr[3]);
- } else {
- cMsgErro = "Houve falha ao atualizar os impostos. Tente novamente!";
- bootbox.alert(cMsgErro);
- LimpaLinha(cItemAtu);
- lOK = false;
- if (data.substr(0, 4) == "ERRO") {
- cMsgErro = data.substr(5);
- } else {
- // Quando ocorre erro no protheus
- console.log(data);
- }
- }
- }
- });
- }
- dialogTab.modal('hide');
- //Gatilho para total do item
- if(lOK){
- TotalItem(cItemAtu);
- }
- }
-
-
-
- /**
- Função para anexar os documentos ao orçamento
- **/
- function OrcGetAnex() {
- $.ajax({
- url: "U_OrcGetAn.apw?PR=<%=cLCodLogin%>",
- type: "POST",
- data: "fornece="+$("#fornece").val()+"&loja="+$("#loja").val(),
- cache: false,
- success: function(html){
- $("#InfAnexos").html(html);
- new PNotify({
- title: 'Anexar arquivo',
- text: 'Anexado com sucesso',
- type: 'success',
- icon: 'fa fa-file-o',
- cornerclass: 'ui-pnotify-sharp'
- });
- $("#arquivo").remove();
- }
- });
- }
-
-
- /**
- Funcao de validação do tipo de frete
- **/
- function VldFrete() {
- var cFrete;
- var tabpreco = $("#CJ_TABELA").val();
- cFrete = $("#CJ_TPFRETE").val();
- if (cFrete == 'C' || cFrete == 'F'){
- $("#CJ_FRETE").attr("required","");
- $("#CJ_FRETE").attr("aria-required","true");
- $("#CJ_FRETE").removeAttr('disabled');
- //$("#CJ_XTRANSP").removeAttr('disabled');
- $("#CJ_FRETE").focus();
- //$("#CJ_XTRANSP").val("");
-
- //Localiza a transportadora
- /*
- $.ajax({
- url: "U_GetTransp.apw?PR=<%=cLCodLogin%>",
- type: "POST",
- data: 'tabela='+tabpreco,
- async: false,
- success:
- function(transp) {
- if (transp.indexOf('<META HTTP-EQUIV') >= 0 ) {
- $("html").html(transp);
- return;
- }
- if ( transp != "" ) {
- //Preenche o campo da transportadora
- document.getElementById('CJ_XTRANSP').innerText = null;
- $("#CJ_XTRANSP").append(transp);
- } else {
- bootbox.alert('Cliente sem transportadora cadastrada!');
- $("#CJ_TPFRETE").val("S")
- $("#select2-CJ_TPFRETE-container").html("Sem Frete")
- $("#CJ_FRETE").removeAttr("required");
- $("#CJ_FRETE").removeAttr("aria-required");
- $("#CJ_FRETE").attr("disabled","");
- $("#CJ_XTRANSP").attr("disabled","");
- $("#CJ_FRETE").val("0,00");
- $("#CJ_XTRANSP").val("");
- $("#select2-CJ_XTRANSP-container").html("Selecione uma Transportadora");
-
- }
- }
- });
- */
-
- //$("#select2-CJ_XTRANSP-container").html("Selecione uma Transportadora");
- }
- if (cFrete == 'S'){
- $("#CJ_FRETE").removeAttr("required");
- $("#CJ_FRETE").removeAttr("aria-required");
- $("#CJ_FRETE").attr("disabled","");
- //$("#CJ_XTRANSP").attr("disabled","");
- $("#CJ_FRETE").val("0,00");
- //$("#CJ_XTRANSP").val("");
- $("#select2-CJ_XTRANSP-container").html("Selecione uma Transportadora");
- }
-
- TotalGeral();
- }
-
- /**
- Validação do valor mínimo de Frete
- **/
- function freteMinimo(objInput) {
- var valFre;
- var tipoFre;
-
- tipoFre = $("#CJ_TPFRETE").val();
- valFre = $("#CJ_FRETE").maskMoney('unmasked')[0];
-
- $.ajax({
- url: "U_FreteMinimo.apw?PR=<%=cLCodLogin%>",
- data: 'tipoFrete='+tipoFre,
- type: "POST",
- async: false,
- success:
- function(retorno) {
- if (retorno.indexOf('<META HTTP-EQUIV') >= 0 ) {
- $("html").html(retorno);
- return;
- }
- valMin = parseInt(retorno);
- if (tipoFre == 'C'){
- tipo = 'CIF';
- }
- else {
- tipo = 'FOB';
- }
- if (valFre < valMin ) {
- bootbox.alert('O valor mínimo para frete do tipo '+tipo+' é R$'+retorno+'!');
- $("#CJ_FRETE").val(retorno);
- $("#CJ_FRETE").focus();
- $("#TOTAL_FRETE").val($("#CJ_FRETE").val());
- return false;
- }
-
- TotalGeral();
-
- }
- });
- }
-
- /**
- // Função para ver detalhes da linha
- **/
- function detalheOrc(cItem){
- var msg = "";
- var produto = $("#CK_PRODUTO"+cItem);
- var retorno = "";
- var estoque = "";
- var dialogTab = "";
- if(produto.val() == ""){
- bootbox.alert("Selecione o produto para ver os detalhes!");
- return false;
- }
-
- /*
- dialogTab = bootbox.dialog({
- message: '<p class="text-center"><i class="fa fa-spin fa-spinner"></i> Carregando detalhes... Aguarde...</p>',
- closeButton: false
- });
-
- $.ajax({
- url: "U_GetEstGeral.apw?PR=<%=cLCodLogin%>",
- data: 'produto='+encodeURIComponent(produto.val()),
- type: "POST",
- async: false,
- success:
- function(retorno) {
- if (retorno.indexOf('<META HTTP-EQUIV') >= 0 ) {
- $("html").html(retorno);
- return;
- }
- estoque = retorno;
- }
- });
- dialogTab.modal('hide');
- */
- msg = '<div class="row form-group">'
- msg +=' <header class="panel-heading">'
- msg +=' <h2 class="panel-title">Detalhes da linha</h2>'
- msg +=' </header>'
- msg +=' <br>'
- //Descrição do produto
- msg +=' <div class="row form-group">'
- msg +=' <div class="col-lg-1"></div>'
- msg +=' <div class="col-lg-11">'
- msg +=' <label class="control-label">Produto</label>'
- msg +=' <div class="input-group">'
- msg +=' <input class="form-control text-left" style="width: 240%;" value="'+$("#CK_PRODUTO"+cItem).val().split('- ')[1]+'" disabled>'
- //msg +=' <input class="form-control text-left" style="width: 240%;" value="'+$(produto)[0].options[$(produto)[0].selectedIndex].text.split('- ')[1]+'" disabled>'
- msg +=' </div>'
- msg +=' </div>'
- msg +=' </div>'
-
- //% ICMS
- msg +=' <div class="row form-group">'
- msg +=' <div class="col-lg-1"></div>'
- msg +=' <div class="col-lg-3">'
- msg +=' <label class="control-label">Aliquota ICMS</label>'
- msg +=' <div class="input-group">'
- msg +=' <input class="form-control text-right" value="'+$("#ALIQ_ICMS"+cItem).val()+'%" disabled>'
- msg +=' </div>'
- msg +=' </div>'
- //% ICMS ST
- msg +=' <div class="col-lg-3">'
- msg +=' <label class="control-label">Aliquota ICMS ST</label>'
- msg +=' <div class="input-group">'
- msg +=' <input class="form-control text-right" value="'+$("#ALIQ_ST"+cItem).val()+'%" disabled>'
- msg +=' </div>'
- msg +=' </div>'
- msg +=' </div>'
- //IPI
- msg +=' <div class="row form-group">'
- msg +=' <div class="col-lg-1"></div>'
- msg +=' <div class="col-lg-3">'
- msg +=' <label class="control-label">IPI</label>'
- msg +=' <div class="input-group">'
- msg +=' <input class="form-control text-right" value="'+$("#VAL_IPI"+cItem).val()+'" disabled>'
- msg +=' </div>'
- msg +=' </div>'
- //ICMS
- msg +=' <div class="col-lg-3">'
- msg +=' <label class="control-label">ICMS</label>'
- msg +=' <div class="input-group">'
- msg +=' <input class="form-control text-right" value="'+$("#VAL_ICMS"+cItem).val()+'" disabled>'
- msg +=' </div>'
- msg +=' </div>'
- //ICMS ST
- msg +=' <div class="col-lg-3">'
- msg +=' <label class="control-label">ICMS ST</label>'
- msg +=' <div class="input-group">'
- msg +=' <input class="form-control text-right" value="'+$("#VAL_ST"+cItem).val()+'" disabled>'
- msg +=' </div>'
- msg +=' </div>'
- msg +=' </div>'
- msg +='</div>'
-
- if(msg != ""){
- bootbox.dialog({
- title: '',
- message: "<p>"+msg+"</p>",
- backdrop: true,
- buttons: {
- ok: {
- label: "OK"
- }
- }
- });
- }
- }
-
- //Remover linha
- function removeItem(cItem){
- //e.preventDefault();
- //var btnRem = $(this);
- cItem = parseInt(cItem);
-
- bootbox.confirm({
- title: "Exclusão da linha",
- message: "Confirma a exclusão desta linha?",
- buttons: {
- cancel: {
- label: 'Cancelar'
- },
- confirm: {
- label: 'Confirmar'
- }
- },
- callback: function (result) {
- if (result){
- if (cItem < 10 ){cItem = "0"+String(cItem)};
-
- //Desabilita o botão
- //btnRem.attr({ 'disabled': 'disabled' });
-
- $("#CK_ITEM"+cItem).val("x");
- $("#CK_PRODUTO"+cItem).val("");
- $("#CK_QTDVEN"+cItem).val("1");
- $("#CK_LOCAL"+cItem).val("");
- $("#CK_PRUNIT"+cItem).val("0");
- $("#iCK_PRCVEN"+cItem).val("0,00");
- $("#CK_PRCVEN"+cItem).val("0,00");
- $("#CK_XVALICM"+cItem).val("0,00");
- $("#CK_XVALIPI"+cItem).val("0,00");
- $("#CK_XICMST"+cItem).val("0,00");
- $("#CK_VALOR"+cItem).val("0,00");
- $("#linha"+cItem).hide();
-
- //Atualiza o total geral
- TotalGeral();
- }
- }
- });
- }
-
-
- /**
- //Anexar
- **/
- $("#btnInfUpload").click(function() {
- var obAnexo = $("#anexo");
- var obArquivo = obAnexo.clone();
-
- obArquivo.attr("id", "arquivo");
-
- $("#frmInfUpload").append(obArquivo);
- var data;
- var contentType = "application/x-www-form-urlencoded";
- var processData = true;
- if ($('#frmInfUpload').attr('enctype') == 'multipart/form-data') {
- data = new FormData($('#frmInfUpload').get(0));//seleciona classe form-horizontal adicionada na tag form do html
- contentType = false;
- processData = false;
- } else {
- data = $('#frmInfUpload').serialize();
- }
- $.ajax({
- data: data,
- type: $('#frmInfUpload').attr('method'),
- url: $('#frmInfUpload').attr('action'),
- contentType: contentType,
- processData: processData,
- success: function (response) {
- //seu código após sucesso
- if( response == "Ok" ) {
- window.location.reload();
- } else {
- bootbox.alert('Erro ao carregar arquivo');
- }
- },
- error: function (exr, sender) {
- bootbox.alert('Erro ao carregar pagina');
- }
- });
- });
-
- //Adicionar nova linha
- $('#btAddItm').click(function(e) {
- e.preventDefault();
- var newLine = parseFloat($("#PROXIMO").val())+1;
- var nItens = parseFloat($("#PROXIMO").val());
- var linhaAtu = String(newLine);
- var lRet = true;
- var lGridOK = true;
- var btnAdd = $(this);
- var cCodProd;
- var cItmOrc;
-
- /*
- bootbox.confirm({
- message: "Confirma a inclusão de uma nova linha?",
- buttons: {
- confirm: {
- label: 'Sim',
- className: 'btn btn-primary'
- },
- cancel: {
- label: 'Não',
- className: 'btn btn-default'
- }
- },
- callback: function (result) {
- if(result == true){
- */
- if (parseInt(linhaAtu) < 10 ){linhaAtu = "0"+String(linhaAtu)};
-
- //Desabilita o botão
- btnAdd.attr({ 'disabled': 'disabled' });
-
- //Valida o Grid
- if (nItens == 99){
- lRet = false;
-
- $("#orc-informar").html();
- new PNotify({
- title: 'Quantidade máxima',
- text: 'O orçamento atingiu a quantidade máxima de itens. Crie um novo orçamento.',
- type: 'error',
- });
- btnAdd.removeAttr('disabled');
- return false;
- }
-
- if (lRet == true) {
- for (i = 1; i<=nItens; i++) {
- cItem = String(i);
- if (parseInt(i) < 10 ){cItem = "0"+String(i)};
-
- cCodProd = $("#CK_PRODUTO"+cItem).val();
- cItmOrc = $("#CK_ITEM"+cItem).val();
- if(cItmOrc != "x") {
- if ($('#CK_PRODUTO'+cItem).val() == "" || $('#CK_QTDVEN'+cItem).val() == ""){
- lGridOK = false;
- }
- }
- }
-
- if (lGridOK == false){
- lRet = false;
-
- $("#orc-informar").html();
- new PNotify({
- title: 'Campo obrigatório',
- text: 'Verifique o preenchimento dos campos Produto e Quantidade antes de incluir uma nova linha!',
- type: 'error',
- });
- btnAdd.removeAttr('disabled');
-
- //Força fechar a janela
- if (lRet == false){
- bootbox.hideAll();
- }
- return false;
- }
- }
-
- //Cria a linha
- if (lRet == true) {
- var tbl = document.getElementById('datatable-editable'), // table reference
-
- row = tbl.insertRow(tbl.rows.length), // append table row
- i;
-
- // insert table cells to the new row
- for (i = 0; i < tbl.rows[0].cells.length; i++) {
- createCell(row.insertCell(i),i,newLine,tbl.rows[0].cells.length-1);
- //Adiciona os atributos da coluna
- switch (i) {
- //Quantidade
- case 3:
- $('tr:last').find('td:last').attr('style','right');
- break;
- //Preço com impostos
- case 7:
- $('tr:last').find('td:last').attr('hidden','');
- break;
- //Preço
- case 8:
- $('tr:last').find('td:last').attr('hidden','');
- break;
- //IPI
- case 9:
- $('tr:last').find('td:last').attr('hidden','');
- break;
- //ICMS
- case 10:
- $('tr:last').find('td:last').attr('hidden','');
- break;
- //ICMS ST
- case 11:
- $('tr:last').find('td:last').attr('hidden','');
- break;
- //% Desconto
- case 12:
- $('tr:last').find('td:last').attr('hidden','');
- break;
- //% Comissão
- case 13:
- $('tr:last').find('td:last').attr('hidden','');
- break;
- //valor comissão
- case 14:
- $('tr:last').find('td:last').attr('hidden','');
- break;
- //pedido cliente
- case 15:
- $('tr:last').find('td:last').attr('style','right');
- break;
- //item do pedido cliente
- case 16:
- $('tr:last').find('td:last').attr('style','right');
- break;
-
- //TOTAL
- case 17:
- $('tr:last').find('td:last').attr('style','right');
- break;
- }
- }
- // Adiciona um ouvinte de eventos usando a delegação de eventos
- $(document).on('focusout', '[data-row] input', function () {
- // Captura o valor do campo CK_PRODUTO
- var produtoDigitado = this.value;
- // Obtém o numero da linha associado ao campo
- var linhaAtu = $(this).data('row');
- // Chama a função buscarProdutos
- buscarProdutos(produtoDigitado, function (listaProdutos) {
- // Aqui voce pode fazer algo com a lista de produtos, se necessario
- });
- });
- //Adiciona a classe no ultimo td
- $('tr:last').find('td:last').addClass('actions');
-
- //Adiciona id na linha
- $('tr:last').attr('id','linha'+linhaAtu);
- $('tr:last').attr('class','odd');
-
- //Atualiza a quantidade de linhas
- $("#PROXIMO").val(linhaAtu);
-
- //Habilita o botão para adicionar itens
- btnAdd.removeAttr('disabled');
- formate();
- };
- /*
- };
- }
- });
- */
- });
-
- // create DIV element and append to the table cell
- function createCell(cell,col,newLine,tam) {
- var linha = String(newLine);
-
- if (parseInt(linha) < 10 ){linha = "0"+String(linha)};
-
- switch (col) {
- //Item
- case 0:
- campo = document.createElement('input');
- campo.setAttribute('id', 'CK_ITEM'+linha);
- campo.setAttribute('name', 'CK_ITEM'+linha);
- campo.setAttribute('class', 'form-control text-left input-block');
- campo.setAttribute('disabled', 'disable');
- campo.setAttribute('value', linha);
- campo.setAttribute('type', 'text');
- break;
- //Codigo de barras
- case 1:
- campo = document.createElement('input');
- campo.setAttribute('id', 'CK_XCODBAR'+linha);
- campo.setAttribute('name', 'CK_XCODBAR'+linha);
- campo.setAttribute('class', 'form-control text-left input-block');
- campo.setAttribute('value', '');
- campo.setAttribute('type', 'text');
- campo.setAttribute('onblur', 'javascript:GetProdCB("'+linha+'")');
- break;
- //Select do produto
- case 2:
- campo = document.createElement('select');
- campo.setAttribute('class', 'selectpicker');
- campo.setAttribute('data-live-search', 'true');
- campo.setAttribute('data-width','300px');
- campo.setAttribute('id', 'CK_PRODUTO'+linha);
- campo.setAttribute('name', 'CK_PRODUTO'+linha);
- campo.setAttribute('required','')
- campo.setAttribute('aria-required','true')
- campo.setAttribute('value','')
- campo.setAttribute('onchange', 'javascript:gatProduto($(this))');
- $(campo).append($.parseHTML('<option value="">Selecione...</option>'+optProd));
- break;
-
- //Quantidade
- case 3:
- campo = document.createElement('input');
- campo.setAttribute('id', 'CK_QTDVEN'+linha);
- campo.setAttribute('name', 'CK_QTDVEN'+linha);
- campo.setAttribute('class', 'form-control text-right only-numbers');
- campo.setAttribute('disabled', 'disable');
- campo.setAttribute('type', 'text');
- campo.setAttribute('value', '');
- campo.setAttribute('placeholder', '0');
- campo.setAttribute('onblur', 'javascript:VldQtd("'+linha+'")');
- campo.setAttribute('onkeyup', 'javascript:TotalItem("'+linha+'")');
- campo.setAttribute('required', '');
- campo.setAttribute('aria-required', 'true');
- break;
-
- //Local
- case 4:
- campo = document.createElement('input');
- campo.setAttribute('id', 'CK_LOCAL'+linha);
- campo.setAttribute('name', 'CK_LOCAL'+linha);
- campo.setAttribute('class', 'form-control text-right input-block');
- campo.setAttribute('disabled', 'disable');
- campo.setAttribute('value', '');
- campo.setAttribute('type', 'text');
- break;
- //Estoque Disponível
- case 5:
- campo = document.createElement('input');
- campo.setAttribute('id', 'EST_DISP'+linha);
- campo.setAttribute('name', 'EST_DISP'+linha);
- campo.setAttribute('class', 'form-control text-right input-block');
- campo.setAttribute('disabled', 'disable');
- campo.setAttribute('value', '0');
- campo.setAttribute('type', 'text');
- break;
- //Preço de tabela
- case 6:
- campo = document.createElement('input');
- campo.setAttribute('id', 'CK_PRCVEN'+linha);
- campo.setAttribute('name', 'CK_PRCVEN'+linha);
- campo.setAttribute('class', 'form-control text-right input-block');
- campo.setAttribute('disabled', 'disable');
- //campo.setAttribute('type', 'text');
- campo.setAttribute('value', '');
- break;
-
- //Preço unitário com impostos
- case 7:
- campo = document.createElement('input');
- campo.setAttribute('id', 'CK_XPRCIMP'+linha);
- campo.setAttribute('name', 'CK_XPRCIMP'+linha);
- campo.setAttribute('class', 'form-control text-right input-block');
- campo.setAttribute('disabled', 'disable');
- campo.setAttribute('value', '');
- break;
-
- //Preço de venda
- case 8:
- campo = document.createElement('input');
- campo.setAttribute('id', 'iCK_PRCVEN'+linha);
- campo.setAttribute('name', 'iCK_PRCVEN'+linha);
- campo.setAttribute('class', 'form-control text-right myformato'); //money5
- campo.setAttribute('disabled', 'disable');
- campo.setAttribute('type', 'text');
- campo.setAttribute('value', '');
- campo.setAttribute('placeholder', '0,00');
- campo.setAttribute('onblur', 'javascript:VldValor("'+linha+'")');
- campo.setAttribute('onkeyup', 'javascript:TotalItem("'+linha+'")');
- // campo.setAttribute('onKeyPress', 'FormataValor(this,28,event,2,".",",")');
- // campo.setAttribute('onKeyPress', 'return(moeda(this,'+"'.'"+','+"','"+',event))');
- break;
-
- //IPI
- case 9:
- campo = document.createElement('input');
- campo.setAttribute('id', 'CK_XVALIPI'+linha);
- campo.setAttribute('name', 'CK_XVALIPI'+linha);
- campo.setAttribute('class', 'form-control text-right input-block');
- campo.setAttribute('disabled', 'disable');
- campo.setAttribute('value', '');
- campo.setAttribute('type', 'text');
- break;
-
- //ICMS
- case 10:
- campo = document.createElement('input');
- campo.setAttribute('id', 'CK_XVALICM'+linha);
- campo.setAttribute('name', 'CK_XVALICM'+linha);
- campo.setAttribute('class', 'form-control text-right input-block');
- campo.setAttribute('disabled', 'disable');
- campo.setAttribute('value', '');
- campo.setAttribute('type', 'text');
- break;
-
- //ICMS ST
- case 11:
- campo = document.createElement('input');
- campo.setAttribute('id', 'CK_XICMST'+linha);
- campo.setAttribute('name', 'CK_XICMST'+linha);
- campo.setAttribute('class', 'form-control text-right input-block');
- campo.setAttribute('disabled', 'disable');
- campo.setAttribute('value', '');
- campo.setAttribute('type', 'text');
- break;
-
- //% de desconto
- case 12:
- campo = document.createElement('input');
- campo.setAttribute('id', 'CK_DESCONT'+linha);
- campo.setAttribute('name', 'CK_DESCONT'+linha);
- campo.setAttribute('class', 'form-control text-right percentual');
- campo.setAttribute('value', '');
- campo.setAttribute('type', 'text');
- campo.setAttribute('maxlength', '7');
- campo.setAttribute('placeholder', '0,00');
- campo.setAttribute('disabled', 'disable');
- campo.setAttribute('onblur', 'javascript:VldValor("'+linha+'")');
- campo.setAttribute('onkeyup', 'javascript:TotalItem("'+linha+'")');
- break;
-
- //% de comissão
- case 13:
- campo = document.createElement('input');
- campo.setAttribute('id', 'PER_COM'+linha);
- campo.setAttribute('name', 'PERCOM'+linha);
- campo.setAttribute('class', 'form-control text-right input-block');
- campo.setAttribute('disabled', 'disable');
- campo.setAttribute('value', '');
- campo.setAttribute('type', 'text');
- break;
-
- //Valor de comissão
- case 14:
- campo = document.createElement('input');
- campo.setAttribute('id', 'VAL_COM'+linha);
- campo.setAttribute('name', 'VAL_COM'+linha);
- campo.setAttribute('class', 'form-control text-right input-block');
- campo.setAttribute('disabled', 'disable');
- campo.setAttribute('type', 'text');
- campo.setAttribute('value', '');
- break;
-
-
- //Pedido cliente
- case 15:
- campo = document.createElement('input');
- campo.setAttribute('id', 'CK_XPEDCLI'+linha);
- campo.setAttribute('name', 'CK_XPEDCLI'+linha);
- campo.setAttribute('class', 'form-control text-right input-block');
- campo.setAttribute('disabled', 'disable');
- campo.setAttribute('value', '');
- campo.setAttribute('maxlength', '10');
- campo.setAttribute('type', 'text');
- break;
-
- //Item Pedido cliente
- case 16:
- campo = document.createElement('input');
- campo.setAttribute('id', 'CK_XITEMCL'+linha);
- campo.setAttribute('name', 'CK_XITEMCL'+linha);
- campo.setAttribute('class', 'form-control text-right input-block');
- campo.setAttribute('disabled', 'disable');
- campo.setAttribute('value', '');
- campo.setAttribute('maxlength', '4');
- campo.setAttribute('type', 'text');
- break;
-
- //TOTAL
- case 17:
- campo = document.createElement('input');
- campo.setAttribute('id', 'CK_VALOR'+linha);
- campo.setAttribute('name', 'CK_VALOR'+linha);
- campo.setAttribute('class', 'form-control text-right input-block');
- campo.setAttribute('disabled', 'disable');
- campo.setAttribute('type', 'text');
- campo.setAttribute('value', '');
- break;
-
- //Ações
- case 18:
- //Detalhes da linha
- campo = document.createElement('i');
- campo.setAttribute('class', 'fa fa-info fa-lg');
- campo.setAttribute('Title', 'Detalhes da linha');
- campo.setAttribute('onclick', 'detalheOrc('+"'"+linha+"'"+')');
- cell.appendChild(campo);
-
- //Remover linha
- campo = document.createElement('i');
- campo.setAttribute('class', 'fa fa-times-circle fa-lg');
- campo.setAttribute('Title', 'Remover linha');
- campo.setAttribute('onclick', 'removeItem('+"'"+linha+"'"+')');
- break;
-
- //Input Padrão
- default:
- campo = document.createElement('input');
- campo.setAttribute('class', 'form-control input-block');
- campo.setAttribute('disabled', 'disable');
- }
- cell.appendChild(campo); // apenda o campo na celula da tabela
-
-
- //Adiciona as variáveis hidden
- if (col == tam){
- $('.selectpicker').selectpicker('render');
- //$('.selectpicker').selectpicker('refresh');
- campo = document.createElement('input');
- campo.setAttribute('id', 'VAL_DESC'+linha);
- campo.setAttribute('name', 'VAL_DESC'+linha);
- campo.setAttribute('type', 'hidden');
- campo.setAttribute('value', '0');
- cell.appendChild(campo);
-
- campo = document.createElement('input');
- campo.setAttribute('id', 'ALIQ_ICMS'+linha);
- campo.setAttribute('name', 'ALIQ_ICMS'+linha);
- campo.setAttribute('type', 'hidden');
- campo.setAttribute('value', '0');
- cell.appendChild(campo);
- campo = document.createElement('input');
- campo.setAttribute('id', 'ALIQ_IPI'+linha);
- campo.setAttribute('name', 'ALIQ_IPI'+linha);
- campo.setAttribute('type', 'hidden');
- campo.setAttribute('value', '0');
- cell.appendChild(campo);
-
- campo = document.createElement('input');
- campo.setAttribute('id', 'ALIQ_ST'+linha);
- campo.setAttribute('name', 'ALIQ_ST'+linha);
- campo.setAttribute('type', 'hidden');
- campo.setAttribute('value', '0');
- cell.appendChild(campo);
-
- campo = document.createElement('input');
- campo.setAttribute('id', 'VAL_ICMS'+linha);
- campo.setAttribute('name', 'VAL_ICMS'+linha);
- campo.setAttribute('type', 'hidden');
- campo.setAttribute('value', '0');
- cell.appendChild(campo);
- campo = document.createElement('input');
- campo.setAttribute('id', 'VAL_IPI'+linha);
- campo.setAttribute('name', 'VAL_IPI'+linha);
- campo.setAttribute('type', 'hidden');
- campo.setAttribute('value', '0');
- cell.appendChild(campo);
- campo = document.createElement('input');
- campo.setAttribute('id', 'VAL_ST'+linha);
- campo.setAttribute('name', 'VAL_ST'+linha);
- campo.setAttribute('type', 'hidden');
- campo.setAttribute('value', '0');
- cell.appendChild(campo);
- campo = document.createElement('input');
- campo.setAttribute('id', 'BASE_ICMS'+linha);
- campo.setAttribute('name', 'BASE_ICMS'+linha);
- campo.setAttribute('type', 'hidden');
- campo.setAttribute('value', '0');
- cell.appendChild(campo);
-
- campo = document.createElement('input');
- campo.setAttribute('id', 'BASE_ST'+linha);
- campo.setAttribute('name', 'BASE_ST'+linha);
- campo.setAttribute('type', 'hidden');
- campo.setAttribute('value', '0');
- cell.appendChild(campo);
-
- campo = document.createElement('input');
- campo.setAttribute('id', 'BASE_IPI'+linha);
- campo.setAttribute('name', 'BASE_IPI'+linha);
- campo.setAttribute('type', 'hidden');
- campo.setAttribute('value', '0');
- cell.appendChild(campo);
- campo = document.createElement('input');
- campo.setAttribute('id', 'QTD_EMB'+linha);
- campo.setAttribute('name', 'QTD_EMB'+linha);
- campo.setAttribute('type', 'hidden');
- campo.setAttribute('value', '0');
- cell.appendChild(campo);
-
- campo = document.createElement('input');
- campo.setAttribute('id', 'CK_TES'+linha);
- campo.setAttribute('name', 'CK_TES'+linha);
- campo.setAttribute('type', 'hidden');
- campo.setAttribute('value', '0');
- cell.appendChild(campo);
-
- campo = document.createElement('input');
- campo.setAttribute('id', 'QTDMIN'+linha);
- campo.setAttribute('name', 'QTDMIN'+linha);
- campo.setAttribute('type', 'hidden');
- campo.setAttribute('value', '0');
- cell.appendChild(campo);
- campo = document.createElement('input');
- campo.setAttribute('id', 'PROMOCAO'+linha);
- campo.setAttribute('name', 'PROMOCAO'+linha);
- campo.setAttribute('type', 'hidden');
- campo.setAttribute('value', '0');
- cell.appendChild(campo);
- }
- }
-
- //Salvar o orçamento
- $('#btSalvar').click(function() {
- var lRet = true
- var i = 0;
- var nItens = parseFloat($("#PROXIMO").val());
- var lGrid = true;
- var lGrid1 = true;
- var cCodProd;
- var cItmOrc;
- var btnSlv = $(this);
- var cGrupo = "";
- var dialogOrc = bootbox.dialog({
- message: '<p class="text-center"><i class="fa fa-spin fa-spinner"></i> Validando orçamento. Aguarde...</p>',
- closeButton: false
- });
- //Desabilita o botão
- btnSlv.attr({ 'disabled': 'disabled' });
-
- $.ajax({
- url: "U_VerSessao.apw?PR=<%=cLCodLogin%>",
- type: "POST",
- async: false,
- success:
- function(retorno) {
- if (retorno.indexOf('<META HTTP-EQUIV') >= 0 ) {
- $("html").html(retorno);
- return;
- }
- if (retorno == "nok"||retorno == ''||retorno.indexOf("Expires") != -1){
- $("#orc-informar").html();
- bootbox.alert('Não foi possível realizar a operação pois a sessão foi fechada. Faça login novamente.');
- lRet = false;
- btnSlv.removeAttr('disabled');
- dialogOrc.modal('hide');
- }
- }
- });
-
- /**
- Valida os campos obrigatorios
- **/
- //Cliente
- if ($("#CJ_CLIENTE").val() == "") {
- lRet = false;
-
- $("#orc-informar").html();
- new PNotify({
- title: 'Campo obrigatório',
- text: 'Preencha o campo Cliente!',
- type: 'error',
- });
- btnSlv.removeAttr('disabled');
- dialogOrc.modal('hide');
- $("#CJ_CLIENTE").focus();
- }
-
- //Tabela de preço
- if (lRet == true && $("#CJ_TABELA").val() == "") {
- lRet = false;
-
- $("#orc-informar").html();
- new PNotify({
- title: 'Campo obrigatório',
- text: 'Preencha o campo Tabela de Preço!',
- type: 'error',
- });
- btnSlv.removeAttr('disabled');
- dialogOrc.modal('hide');
- $("#CJ_TABELA").focus();
- }
-
- //Data de Entrega
- /*
- if (lRet == true && $("#CK_ENTREG").val() == "") {
- lRet = false;
-
- $("#orc-informar").html();
- new PNotify({
- title: 'Campo obrigatório',
- text: 'Preencha o campo Previsão de Faturamento!',
- type: 'error',
- });
- btnSlv.removeAttr('disabled');
- dialogOrc.modal('hide');
- $("#CK_ENTREGA").focus();
- }
- */
-
- //Condição de pagamento
- if (lRet == true && $("#CJ_CONDPAG").val() == "") {
- lRet = false;
-
- $("#orc-informar").html();
- new PNotify({
- title: 'Campo obrigatório',
- text: 'Preencha o campo Condição de Pagamento!',
- type: 'error',
- });
- btnSlv.removeAttr('disabled');
- dialogOrc.modal('hide');
- $("#CJ_CONDPAG").focus();
- }
-
- //cartão de crédito
- if (lRet == true & $("#CJ_XMODALI").val() == "03") {
- /*
- if ($("#CJ_XPARC").val() == ""|| $("#CJ_XPARC").val() == "0") {
- lRet = false;
-
- $("#orc-informar").html();
- new PNotify({
- title: 'Campo obrigatório',
- text: 'Preencha o campo Parcela!',
- type: 'error',
- });
- btnSlv.removeAttr('disabled');
- dialogOrc.modal('hide');
- $("#CJ_XPARC").focus();
- } else {
- if ($("#CJ_XBAND").val() == ""){
- lRet = false;
-
- $("#orc-informar").html();
- new PNotify({
- title: 'Campo obrigatório',
- text: 'Preencha o campo Bandeira!',
- type: 'error',
- });
- btnSlv.removeAttr('disabled');
- dialogOrc.modal('hide');
- $("#CJ_XBAND").focus();
- }
- }*/
- }
- if (lRet == true && $("#CJ_CONDPAG").val() != "") {
- var totalorc = $("#TOTAL_ORC").val();
- var valMin = 0;
-
- $.ajax({
- url: "U_ValMinParc.apw?PR=<%=cLCodLogin%>",
- data: 'condPgto='+$("#CJ_CONDPAG").val()+'&valor='+$("#TOTAL_ORC").val(),
- type: "POST",
- async: false,
- success:
- function(retorno) {
- valMin = parseFloat(retorno);
- if (valMin > 0) {
- bootbox.alert('Para a condição de pagamento escolhida o valor mínimo permitido por parcela é de R$'+mascaraValor(valMin.toFixed(2))+'.');
- lRet = false;
- btnSlv.removeAttr('disabled');
- dialogOrc.modal('hide');
- }
- }
- });
- }
-
- //Transportadora e frete
- if (lRet == true && ($("#CJ_TPFRETE").val() == "C" || $("#CJ_TPFRETE").val() == "F")) {
- if ($("#CJ_XTRANSP").val() == ""){
- lRet = false;
-
- $("#orc-informar").html();
- new PNotify({
- title: 'Campo obrigatório',
- text: 'Para frete tipo CIF e FOB deve ser informada a Transportadora!',
- type: 'error',
- });
- btnSlv.removeAttr('disabled');
- dialogOrc.modal('hide');
- $("#CJ_XTRANSP").focus();
- }
- }
-
- //Série da nota para Orçamento Firme
- if (lRet == true && $("#CJ_XTPORC").val() == "1" && $("#CJ_XSERIEN").val() == "") {
- lRet = false;
-
- $("#orc-informar").html();
- new PNotify({
- title: 'Campo obrigatório',
- text: 'Preencha o campo Série!',
- type: 'error',
- });
- btnSlv.removeAttr('disabled');
- dialogOrc.modal('hide');
- $("#CJ_XSERIEN").focus();
- }
- //Grid
- if (lRet == true) {
- for (i = 1; i<=nItens; i++) {
- cItem = String(i);
- if (parseInt(i) < 10 ){cItem = "0"+String(i)};
-
- cCodProd = $("#CK_PRODUTO"+cItem).val();
- cItmOrc = $("#CK_ITEM"+cItem).val();
- if(cItmOrc != "x") {
- //Valida o preenchimento dos campos produto e quantidade
- if ($('#CK_PRODUTO'+cItem).val() == "" || $('#CK_QTDVEN'+cItem).val() == ""){
- lGrid = false;
- }
- //Valida o preenchimento do pedido e item
- pedCli = $('#CK_XPEDCLI'+cItem).val();
- itmCli = $('#CK_XITEMCL'+cItem).val();
- if ((pedCli != "" && itmCli == "") || (pedCli == "" && itmCli != "")){
- lGrid1 = false;
- }
-
- //Valida o estoque no orçamento firme
- if( $('#CJ_XTPORC').val() == "1"){
- if(vldEstoque(cItem) == false){
- lRet = false;
- btnSlv.removeAttr('disabled');
- dialogOrc.modal('hide');
- }
- }
- }
- }
-
- if (lGrid == false){
- lRet = false;
-
- $("#orc-informar").html();
- new PNotify({
- title: 'Campo obrigatório',
- text: 'Verifique o preenchimento dos campos Produto e Quantidade!',
- type: 'error',
- });
- btnSlv.removeAttr('disabled');
- dialogOrc.modal('hide');
- }
-
-
- if (lGrid1 == false){
- lRet = false;
-
- $("#orc-informar").html();
- new PNotify({
- title: 'Pedido / Item Cliente',
- text: 'Se informado o item ou o pedido do cliente, os dois campos devem ser preenchidos!',
- type: 'error',
- });
- btnSlv.removeAttr('disabled');
- dialogOrc.modal('hide');
- }
- }
-
-
- //Valida a condição de pagamento
- if (lRet == true){
- dialogOrc.modal('hide');
- //Chama a validação do limite e submete o formulário
- vldOrc(btnSlv);
-
- // $.ajax({
- // url: "U_VldAcresc.apw?PR=<%=cLCodLogin%>",
- // data: 'condicao='+$("#CJ_CONDPAG").val()+'&valor='+$("#TOTAL_ORC").val()+'&modalidade='+$("#CJ_XMODALI").val()+'&grupos='+$('#GRUPOS').val()+
- // '&cliente='+$("#CJ_CLIENTE").val(),
- // type: "POST",
- // async: false,
- // success:
- // function(retorno) {
- // if (retorno.indexOf('<META HTTP-EQUIV') >= 0 ) {
- // $("html").html(retorno);
- // return;
- // }
-
- // aRet = retorno.split('|');
- // cAcresc = aRet[0];
- // nAcresc = parseFloat(aRet[1]);
-
-
- // if (nAcresc > 0 ) {
- // bootbox.confirm({
- // title: "Pedido abaixo do mínimo",
- // message: 'Pedido abaixo do valor mínimo, será aplicado acréscimo de '+cAcresc+'%. Deseja continuar?',
- // buttons: {
- // cancel: {
- // label: 'Não'
- // },
- // confirm: {
- // label: 'Sim'
- // }
- // },
- // callback: function (result) {
- // if(result){
- // //Atualiza a variável
- // $("#ACRESCIMO").val((nAcresc * -1).toString());
-
- // //Chama a validação do limite e submete o formulário
- // vldOrc(btnSlv);
- // }
- // else {
- // btnSlv.removeAttr('disabled');
- // }
- // }
- // });
- // } else {
- // //Chama a validação do limite e submete o formulário
- // vldOrc(btnSlv);
- // }
- // }
- // });
- }
- })
- $('#btExcluir').click(function() {
- var lRet = true
- var i = 0;
- var lGrid = true;
- var cCodProd;
- var btnSlv = $(this);
-
- //Desabilita o botão
- $('#btExcluir').attr({ 'disabled': 'disabled' });
-
- objDados = {
- CJ_CLIENTE: $('#CJ_CLIENTE').val(),
- CJ_NUM: $('#CJ_NUM').val()
- };
-
- $.ajax({
- type: "POST",
- url: "U_ExcOrc.apw?PR=<%=cLCodLogin%>",
- async: false,
- data: objDados
-
- }).fail(function(){
- bootbox.alert({
- title: "Exclusão de Orçamento",
- message: "Não foi possível excluir o orçamento.",
- backdrop: true,
- callback: function (result) {
- btnSlv.removeAttr('disabled');
- }
- });
- }).done(function(strXml) {
- if (strXml.indexOf('<META HTTP-EQUIV') >= 0 ) {
- $("html").html(strXml);
- return;
- }
- bootbox.alert({
- title: "Exclusão de Orçamento",
- message: "O orçamento "+$('#CJ_NUM').val()+" foi excluído com sucesso.",
- backdrop: true,
- callback: function (result) {
- document.location.href = "U_Orcamento.apw?PR=<%=cLCodLogin%>";
- }
- });
- });
- })
-
- //Validação do valor do frete
- function vldOrc(btnSlv){
- vldOrc1(btnSlv);
- /*
- var tipoFre = $('#CJ_TPFRETE').val();
- var total = $("#TOTAL_ITENS").maskMoney('unmasked')[0];
- var valMin = 0;
-
- if (tipoFre == "C") {
- $.ajax({
- url: "U_FreteMinimo.apw?PR=<%=cLCodLogin%>",
- data: 'tipoFrete='+tipoFre,
- type: "POST",
- async: false,
- success:
- function(retorno) {
- if (retorno.indexOf('<META HTTP-EQUIV') >= 0 ) {
- $("html").html(retorno);
- return;
- }
- valMin = parseInt(retorno);
-
- if (total < valMin ) {
- bootbox.alert('O valor mínimo de orçamento para frete do tipo CIF é R$'+retorno+'!');
- btnSlv.removeAttr('disabled');
- return false;
- } else {
- vldOrc1(btnSlv);
- }
-
-
-
- }
- });
- } else {
- vldOrc1(btnSlv);
- }*/
- }
-
- //Se orçamento firme e boleto, valida o limite de crédito disponível
- function vldOrc1(btnSlv){
- if ( ($('#CJ_XTPORC').val() == "1") && ($('#CJ_XMODALI').val() == '01' || $('#CJ_XMODALI').val() == '06') ){
- var cliente = $("#CJ_CLIENTE").val();
- var total = $("#TOTAL_ITENS").maskMoney('unmasked')[0];
- var limDisp = 0;
- lRet = false;
-
- $.ajax({
- url: "U_GetLimCred.apw?PR=<%=cLCodLogin%>",
- data: 'cliente='+cliente+'&valor='+total,
- cache: false,
- type: "POST",
- async: false,
- success:
- function(retorno) {
- if (retorno.indexOf('<META HTTP-EQUIV') >= 0 ) {
- $("html").html(retorno);
- return;
- }
- // Retorno limiteDisponivel|limiteTolerancia
- var aRet = retorno.split('|');
- var limDisp = 0.00;
- var limTol = 0.00;
- // Pega o limite de tolerancia
- if ( aRet.length > 1 ) {
- limTol= parseFloat(aRet[1]);
- }
- // Pega o limite disponivel
- if ( aRet.length > 0 ) {
- limDisp= parseFloat(aRet[0]);
- }
-
- if (total > (limTol+limDisp) ) {
-
- bootbox.alert({
- title: 'Limite de crédito insuficiente',
- message: 'Não é possível salvar o orçamento.<br> Saldo disponível: R$'+mascaraValor(limDisp.toFixed(2))+'.<br>Este cliente só pode realizar compras à vista.', //mascaraValor(limDisp.toFixed(2))
- callback: function () {
- btnSlv.removeAttr('disabled');
- //salvarOrc(btnSlv);
- }
- });
-
-
- } else {
- salvarOrc(btnSlv);
- }
-
- }
- });
- } else {
- salvarOrc(btnSlv);
- }
- }
-
- //Submete formulario
- function salvarOrc(btnSlv){
- var numorc = "";
-
- //if (lRet == true){
- //$("#formOrc").submit();
- var dialogSlv = bootbox.dialog({
- message: '<p class="text-center"><i class="fa fa-spin fa-spinner"></i> Salvando orçamento... Aguarde...</p>',
- closeButton: false
- });
-
- //busca os itens cadastrados
- var ITENS = "";
- var i = 0;
- var nItens = parseFloat($("#PROXIMO").val());
- var cCodProd;
- var cItmOrc;
- var cDescAcresc = "0";
-
- for (i = 1; i<=nItens; i++) {
- cItem = String(i);
- if (parseInt(i) < 10 ){cItem = "0"+String(i)};
-
- cCodProd = $("#CK_PRODUTO"+cItem).val();
- cItmOrc = $("#CK_ITEM"+cItem).val();
- if(cItmOrc != "x") {
- cPrcVen = $('#CK_PRCVEN'+cItem).val();
- nDesc = $('#CK_DESCONT'+cItem).val();
- // let cPrcVen = $('#iCK_PRCVEN'+cItem).val();
- // // Se desconto negativo --> salva o preco de tabela original
- // if ($('#CK_DESCONT'+cItem).val().substr(0,1) == "-") {
- // cPrcVen = $('#CK_PRCVEN'+cItem).val();
- // }
- //Tratativa para salvar o desconto correto.
- if($("#OPCAO").val() == "3"){
- nDesc = 0;
- nVlrVenda = $("#CK_PRCVEN"+cItem).maskMoney('unmasked')[0];
- nVlrOri = $("#CK_PRCVEN"+cItem).maskMoney('unmasked')[0];
- }
- ITENS+= $('#CK_PRODUTO'+cItem).val()+';'+$('#CK_QTDVEN'+cItem).val()+';'+cPrcVen+';'+$('#CK_LOCAL'+cItem).val()+';';
- ITENS+= $('#CK_XVALIPI'+cItem).val()+';'+$('#CK_XVALICM'+cItem).val()+';'+$('#CK_XICMST'+cItem).val()+';'+$('#CK_TES'+cItem).val()+';';
- ITENS+= $('#PER_COM'+cItem).val()+';'+$('#ALIQ_ICMS'+cItem).val()+';'+$('#ALIQ_IPI'+cItem).val()+';'+$('#ALIQ_ST'+cItem).val()+';';
- ITENS+= nDesc+';'+$('#CK_XPEDCLI'+cItem).val()+';'+$('#CK_XITEMCL'+cItem).val()+';';
- ITENS+= $('#CK_XPRCIMP'+cItem).val()+';'+$('#CK_XCODBAR'+cItem).val()+'||'
- }
- }
-
-
- objDados = {
- CJ_CLIENTE: $('#CJ_CLIENTE').val(),
- CJ_TABELA: $('#CJ_TABELA').val(),
- CJ_VEND: $('#CJ_VEND').val(),
- CJ_XTPORC: $('#CJ_XTPORC').val(),
- CJ_TPFRETE: $('#CJ_TPFRETE').val(),
- CJ_FRETE: $('#CJ_FRETE').val(),
- CJ_XTRANSP: $('#CJ_XTRANSP').val(),
-
- CJ_XMODALI: $('#CJ_XMODALI').val(),
- CJ_CONDPAG: $('#CJ_CONDPAG').val(),
- CJ_DESC1: $("#DESCCOND").val(),
- CJ_VALIDA: $('#CJ_VALIDA').val(),
- CJ_XSERIEN: $('#CJ_XSERIEN').val(),
- CJ_XPESO: $('#CJ_XPESO').val(),
- CJ_XVOLUME: $('#CJ_XVOLUME').val(),
- CJ_XESPECI: $('#CJ_XESPECI').val(),
- CK_ENTREG: $('#CK_ENTREG').val(),
-
-
- CJ_XNOTAIN: $('#CJ_XNOTAIN').val(),
- CJ_XMSGNF: $('#CJ_XMSGNF').val(),
- CJ_XPARC: $('#CJ_XPARC').val(),
- CJ_XBAND: $('#CJ_XBAND').val(),
- CJ_NUM: $('#CJ_NUM').val(),
- PROXIMO: $('#PROXIMO').val(),
- OPCAO: $('#OPCAO').val(),
- aItens: ITENS
- };
-
-
- if($("#OPCAO").val() == "3"){
- msg = "O orçamento foi incluído com sucesso.";
- titulo = "Inclusão de Orçamento";
- operacao = "incluir";
- }
- if($("#OPCAO").val() == "4"){
- msg = "O orçamento foi alterado com sucesso.";
- titulo = "Alteração de Orçamento";
- operacao = "alterar";
- }
- if($("#OPCAO").val() == "5"){
- msg = "O orçamento foi excluído com sucesso.";
- titulo = "Exclusão de Orçamento";
- operacao = "excluir";
- }
-
-
- $.ajax({
- type: "POST",
- url: "U_SlvOrc.apw?PR=<%=cLCodLogin%>",
- async: false,
- data: objDados
-
- }).fail(function(){
- bootbox.alert({
- title: titulo,
- message: "Não foi possível "+operacao+" o orçamento.",
- backdrop: true,
- callback: function (result) {
- btnSlv.removeAttr('disabled');
- dialogSlv.modal('hide');
- }
- });
- }).done(function(strXml) {
- if (strXml.indexOf('<META HTTP-EQUIV') >= 0 ) {
- $("html").html(strXml);
- return;
- }
- if (strXml == 'erro'||strXml == ''||strXml.indexOf("Expires") != -1||strXml.indexOf("invalid") != -1){
- if (strXml == ''){
- bootbox.alert({
- title: titulo,
- message: "Aguarde o prazo de 3 minutos para "+operacao+" um novo orçamento.",
- backdrop: true,
- callback: function (result) {
- btnSlv.removeAttr('disabled');
- dialogSlv.modal('hide');
- }
- });
- }else{
- bootbox.alert({
- title: titulo,
- message: "Falha ao "+operacao+" o orçamento.",
- backdrop: true,
- callback: function (result) {
- btnSlv.removeAttr('disabled');
- dialogSlv.modal('hide');
- }
- });
- }
- }
- else {
- if($("#OPCAO").val() == "3"){
- numorc = " Foi gerado o orçamento nº "+strXml+"."
- }
- bootbox.alert({
- title: titulo,
- message: msg+numorc,
- backdrop: true,
- callback: function (result) {
- document.location.href = "U_Orcamento.apw?PR=<%=cLCodLogin%>";
- dialogSlv.modal('hide');
- }
- });
-
- }
- });
-
- //};
-
- }
- </script>
- </body>
- </html>
|