This commit is contained in:
Carlos Jimenez Ruiz 2019-02-25 09:35:08 +01:00
commit f6a5fb106f
47 changed files with 1219 additions and 1497 deletions

View File

@ -16,10 +16,6 @@ vn-check {
} }
md-checkbox { md-checkbox {
margin-bottom: 0 margin-bottom: 0.8em
}
md-checkbox .md-label {
margin-bottom: .5em;
} }
} }

View File

@ -174,4 +174,7 @@ vn-table {
float: right; float: right;
margin: 0!important; margin: 0!important;
} }
md-checkbox {
margin: 0;
}
} }

View File

@ -1,4 +1,2 @@
<vn-horizontal class="text-container">
<span class="text" ng-transclude="text" vn-one></span>
</vn-horizontal>
<div class="field"></div> <div class="field"></div>
<span class="text" ng-transclude="text"></span>

View File

@ -1,38 +1,58 @@
import ngModule from '../../module'; import ngModule from '../../module';
import Component from '../../lib/component'; import Component from '../../lib/component';
import {focus} from '../../directives/focus';
import './style.scss'; import './style.scss';
export default class Controller extends Component { export default class Controller extends Component {
constructor($element, $scope, $transclude) { constructor($element, $scope, $transclude, $timeout) {
super($element, $scope); super($element, $scope);
this.$timeout = $timeout;
let element = $element[0]; let element = $element[0];
element.tabIndex = 0; element.tabIndex = 0;
element.addEventListener('focus', () => { element.addEventListener('focus', () => {
if (this.field) return;
$transclude((tClone, tScope) => { $transclude((tClone, tScope) => {
this.field = tClone; this.field = tClone;
this.tScope = tScope; this.tScope = tScope;
this.element.querySelector('.field').appendChild(this.field[0]); this.element.querySelector('.field').appendChild(this.field[0]);
element.tabIndex = -1;
this.timer = $timeout(() => {
this.timer = null;
focus(this.field[0]);
});
}, null, 'field'); }, null, 'field');
element.classList.add('selected'); element.classList.add('selected');
}); });
element.addEventListener('focusout', event => { element.addEventListener('focusout', event => {
this.destroyTimer();
this.lastEvent = event; this.lastEvent = event;
let target = event.relatedTarget; let target = event.relatedTarget;
while (target && target.parentNode != element) while (target && target != element)
target = target.parentNode; target = target.parentNode;
if (!target) { if (!target) {
this.tScope.$destroy(); this.tScope.$destroy();
this.field.remove(); this.field.remove();
this.field = null;
element.classList.remove('selected'); element.classList.remove('selected');
element.tabIndex = 0;
} }
}); });
} }
} destroyTimer() {
if (this.timer) {
this.$timeout.cancel(this.timer);
this.timer = null;
}
}
Controller.$inject = ['$element', '$scope', '$transclude']; $onDestroy() {
this.destroyTimer();
}
}
Controller.$inject = ['$element', '$scope', '$transclude', '$timeout'];
ngModule.component('vnTdEditable', { ngModule.component('vnTdEditable', {
template: require('./index.html'), template: require('./index.html'),

View File

@ -1,16 +1,40 @@
@import "variables";
vn-td-editable { vn-td-editable {
cursor: pointer; cursor: pointer;
& > div.text-container{ outline: none;
width: 100%; position: relative;
}
&.selected { &.selected > .text {
& > .text-container{ visibility: hidden;
display: none; }
& > .field {
display: none;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
box-sizing: border-box;
align-items: center;
padding: .6em;
overflow: visible;
& > field {
flex: 1;
background-color: $color-bg-panel;
padding: .5em;
box-shadow: 0 0 .4em rgba(0, 0, 0, .2);
border-radius: .1em;
min-width: 6em;
& > * {
width: 100%;
max-width: initial;
}
} }
} }
&.selected > .field {
vn-icon { display: flex;
font-size: 1em;
} }
} }

View File

@ -1,5 +1,22 @@
import ngModule from '../module'; import ngModule from '../module';
export function focus(input) {
let selector = 'input, textarea, button, submit';
if (!input.matches(selector))
input = input.querySelector(selector);
if (!input) {
console.warn(`vnFocus: Can't find a focusable element`);
return;
}
input.focus();
if (input.select)
input.select();
}
/** /**
* Sets the focus and selects the text on the input. * Sets the focus and selects the text on the input.
* *
@ -8,24 +25,8 @@ import ngModule from '../module';
export function directive() { export function directive() {
return { return {
restrict: 'A', restrict: 'A',
link: function($scope, $element, $attrs) { link: function($scope, $element) {
$scope.$watch('', function() { $scope.$watch('', () => focus($element[0]));
let input = $element[0];
let selector = 'input, textarea, button, submit';
if (!input.matches(selector))
input = input.querySelector(selector);
if (!input) {
console.warn(`vnFocus: Can't find a focusable element`);
return;
}
input.focus();
if (input.select)
input.select();
});
} }
}; };
} }

View File

@ -2,7 +2,6 @@
<div style="position: absolute; top: 0; left: 0; padding: .3em; z-index: 1"> <div style="position: absolute; top: 0; left: 0; padding: .3em; z-index: 1">
<vn-icon-button <vn-icon-button
icon="menu" icon="menu"
style="font-size: .4em;"
ng-click="$ctrl.showUvc($event)"> ng-click="$ctrl.showUvc($event)">
</vn-icon-button> </vn-icon-button>
<vn-dialog <vn-dialog

View File

@ -1,43 +1,19 @@
@import "./variables"; @import "./variables";
html [border-none], .border-none {
border: 0;
}
/* Solid border */
html [border-solid], .border-solid { html [border-solid], .border-solid {
border: $border-thin solid $border-color; border: $border-thin-light;
} }
html [border-solid-top], .border-solid-top { html [border-solid-top], .border-solid-top {
border-top: $border-thin solid $border-color; border-top: $border-thin-light;
} }
html [border-solid-left], .border-solid-left { html [border-solid-left], .border-solid-left {
border-left: $border-thin solid $border-color; border-left: $border-thin-light;
} }
html [border-solid-right], .border-solid-right { html [border-solid-right], .border-solid-right {
border-right: $border-thin solid $border-color; border-right: $border-thin-light;
} }
html [border-solid-bottom], .border-solid-bottom { html [border-solid-bottom], .border-solid-bottom {
border-bottom: $border-thin solid $border-color; border-bottom: $border-thin-light;
}
/* Dashed border */
html [border-dashed], .border-dashed {
border: $border-thin dashed $border-color;
}
html [border-dashed-top], .border-dashed-top {
border-top: $border-thin dashed $border-color;
}
html [border-dashed-left], .border-dashed-left {
border-left: $border-thin dashed $border-color;
}
html [border-dashed-right], .border-dashed-right {
border-right: $border-thin dashed $border-color;
}
html [border-dashed-bottom], .border-dashed-bottom {
border-bottom: $border-thin dashed $border-color;
} }
/* Border Radius */ /* Border Radius */

View File

@ -12,4 +12,5 @@ import './effects.scss';
import './order-product.scss'; import './order-product.scss';
import './summary.scss'; import './summary.scss';
import './descriptor.scss'; import './descriptor.scss';
import './list.scss';
import './modal-form.scss'; import './modal-form.scss';

View File

@ -0,0 +1,46 @@
@import "./effects";
.vn-list {
max-width: 36em;
margin: 0 auto;
a.vn-list-item {
@extend %clickable;
}
.vn-list-item {
border-bottom: $border-thin-light;
display: block;
text-decoration: none;
color: inherit;
& > vn-horizontal {
padding: $pad-medium;
& > vn-one {
overflow: hidden;
}
& > .buttons {
align-items: center;
vn-icon-button {
opacity: .4;
color: $color-main;
margin-left: .5em;
transition: opacity 250ms ease-out;
padding: 0;
font-size: 2em;
&:hover {
opacity: 1;
}
}
}
}
}
vn-empty-rows {
display: block;
text-align: center;
padding: 1.5em;
box-sizing: border-box;
}
}

View File

@ -5,7 +5,6 @@ html, body {
margin: 0; margin: 0;
padding: 0; padding: 0;
} }
a:focus, a:focus,
input:focus, input:focus,
button:focus { button:focus {
@ -23,8 +22,7 @@ input[type=reset]::-moz-focus-inner {
-ms-user-select: none; -ms-user-select: none;
user-select: none; user-select: none;
} }
a, .link {
a, .link{
color: $color-font-link; color: $color-font-link;
text-decoration: none; text-decoration: none;
} }
@ -35,23 +33,20 @@ a, .link{
text-decoration: underline; text-decoration: underline;
} }
} }
.totalBox { .totalBox {
border: 1px solid #CCC; border: 1px solid #CCC;
text-align: right!important; text-align: right !important;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
padding: 18px; padding: 18px;
margin-bottom: 10px; margin-bottom: 10px;
} }
.form { .form {
height: 100%; height: 100%;
box-sizing: border-box; box-sizing: border-box;
padding: $pad-large; padding: $pad-large;
max-width: 1000px; max-width: 1000px;
} }
html [fixed-bottom-right] { html [fixed-bottom-right] {
position: fixed; position: fixed;
bottom: 2em; bottom: 2em;
@ -60,87 +55,53 @@ html [fixed-bottom-right] {
html [text-center], .text-center { html [text-center], .text-center {
text-align: center; text-align: center;
} }
html [text-right], .text-right{ html [text-right], .text-right {
text-align: right; text-align: right;
} }
html [text-left], .text-left{ html [text-left], .text-left {
text-align: left; text-align: left;
} }
html [vn-right], .vn-right{ html [vn-right], .vn-right {
float: right; float: right;
} }
html [vn-left], .vn-left{ html [vn-left], .vn-left {
float: left; float: left;
} }
html [vn-center], .vn-center{ html [vn-center], .vn-center {
justify-content: center; justify-content: center;
} }
.list > vn-none {
.list > vn-none{
min-width: 60px; min-width: 60px;
} }
.list-element {
.list-element{
padding: 8px 0 0 0; padding: 8px 0 0 0;
border-bottom: 1px solid $color-spacer; border-bottom: 1px solid $color-spacer;
i { i {
color: $color-main; color: $color-main;
} }
} }
.tooltip {
.list-header{
border-bottom: 3px solid $color-spacer;
font-family: vn-font-bold;
text-align: center
}
.list-element{
white-space: nowrap;
}
}
.list-footer{
font-family: vn-font-bold;
border-top: 3px solid $color-spacer;
}
.list-element.warning{
background-color: $color-main-medium;
}
.list-element.success{
background-color: $color-success-medium;
}
.list-element.success:hover{
background-color: $color-success-light;
}
.list-element.warning:hover{
background-color: $color-main-light;
}
.flatpickr-month, .flatpickr-weekdays, span.flatpickr-weekday { .flatpickr-month, .flatpickr-weekdays, span.flatpickr-weekday {
background-color: $color-main; background-color: $color-main;
} }
html [pointer], .pointer{ html [pointer], .pointer{
cursor: pointer; cursor: pointer;
} }
html [noDrop], .noDrop{ html [noDrop], .noDrop{
cursor: no-drop; cursor: no-drop;
} }
html [compact], .compact{ html [compact], .compact{
max-width: 950px; max-width: $width-compact;
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
} }
button { button {
@extend %clickable; @extend %clickable;
} }
vn-button-bar { vn-button-bar {
display: block; display: block;
margin-top: $margin-small; margin-top: $margin-small;
} }
vn-tool-bar { vn-tool-bar {
display: flex; display: flex;
@ -149,51 +110,6 @@ vn-tool-bar {
} }
} }
.vn-list {
max-width: 36em;
margin: 0 auto;
a.vn-list-item {
@extend %clickable;
}
.vn-list-item {
border-bottom: $border-thin solid $color-spacer;
display: block;
text-decoration: none;
color: inherit;
& > vn-horizontal {
padding: $pad-medium;
& > vn-one {
overflow: hidden;
}
& > .buttons {
align-items: center;
vn-icon-button {
opacity: .4;
color: $color-main;
margin-left: .5em;
transition: opacity 250ms ease-out;
padding: 0;
font-size: 2em;
&:hover {
opacity: 1;
}
}
}
}
}
vn-empty-rows {
display: block;
text-align: center;
padding: 1.5em;
box-sizing: border-box;
}
}
/** START - FORM ELEMENTS DISABLED **/ /** START - FORM ELEMENTS DISABLED **/
fieldset[disabled] .mdl-textfield .mdl-textfield__input, fieldset[disabled] .mdl-textfield .mdl-textfield__input,
@ -215,7 +131,6 @@ fieldset[disabled] .mdl-textfield .mdl-textfield__label,
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
} }
.counter { .counter {
@extend %active; @extend %active;
@ -223,7 +138,6 @@ fieldset[disabled] .mdl-textfield .mdl-textfield__label,
font-size: 0.7em font-size: 0.7em
} }
} }
.vn-grid { .vn-grid {
border-collapse: collapse; border-collapse: collapse;
width: 100%; width: 100%;

View File

@ -1,99 +1,89 @@
@import "./variables"; @import "./variables";
@media screen and (max-width: 1920px){
.catalog-list .product {
width: 25%;
}
}
@media screen and (max-width: 1800px){
.catalog-list .product {
width: 33.33%
}
}
@media screen and (max-width: 1600px){
.catalog-list .product {
width: 50%
}
}
@media screen and (max-width: 1280px){
.catalog-list .product {
width: 100%
}
}
.catalog-list { .catalog-list {
justify-content: flex-start;
align-items: flex-start; align-items: flex-start;
flex-wrap: wrap; flex-wrap: wrap;
justify-content: center;
.product { & > .product {
box-sizing: border-box; box-sizing: border-box;
padding: 4px; padding: $pad-small;
width: 26em;
overflow: hidden;
& > vn-one { & > vn-card > div {
border: 1px solid rgba($color-spacer, 0.5); display: flex;
display: block height: 11em;
}
.image { .image {
min-width: 10em; width: 11em;
max-width: 10em; height: 11em;
min-height: 10em;
max-height: 10em;
img { img {
width: 100%; width: 100%;
height: 100% height: 100%
}
}
.description {
box-sizing: border-box;
& > vn-vertical {
height: 100%;
& > h2 {
text-transform: uppercase;
font-family: vn-font;
margin: 0 0 0.5em 0;
font-weight: 100;
line-height: 1em;
font-size: 0.9em;
} }
}
.description {
flex: 1;
display: flex;
flex-direction: column;
box-sizing: border-box;
height: 100%;
width: 100%;
overflow: hidden;
padding: .8em;
& > span { & > h3 {
font-family: vn-font;
margin: 0;
margin-bottom: .3em;
font-weight: normal;
line-height: initial;
font-size: 1.2em;
max-height:2.4em;
overflow: hidden;
}
& > h4 {
color: $color-font-secondary; color: $color-font-secondary;
text-transform: uppercase; text-transform: uppercase;
margin-bottom: 0.5em; margin-bottom: .3em;
font-weight: bold; line-height: initial;
font-size: 0.8em font-size: 1em;
flex: 1;
} }
& > .tags {
padding-bottom: .2em;
height: 3em;
& > vn-label-value { & > vn-label-value {
font-size: 0.8em font-size: .8em
}
} }
} }
} .footer {
display: flex;
align-items: center;
justify-content: space-between;
font-size: .8em;
.price { & > .price {
align-items: center; overflow: hidden;
margin-top: auto; white-space: nowrap;
font-size: 0.8em; text-overflow: ellipsis;
& > vn-one span:first-child { & > span {
color: $color-font-secondary flex: 1;
}
& > vn-one span:first-child, & > vn-one span:last-child { &:first-child,
font-size: 1.2em &:last-child {
} font-size: 1.4em
}
vn-icon[icon="add_circle"] { }
color: $color-main }
& > vn-icon-button {
padding: 0;
}
} }
} }
} }

View File

@ -3,6 +3,12 @@ $menu-width: 16em;
$topbar-height: 4em; $topbar-height: 4em;
$mobile-width: 800px; $mobile-width: 800px;
// Width
$width-small: 36em;
$width-compact: 60em;
$width-large: 80em;
// Padding // Padding
$pad-none: 0; $pad-none: 0;
@ -17,12 +23,6 @@ $margin-small: 8px;
$margin-medium: 16px; $margin-medium: 16px;
$margin-large: 32px; $margin-large: 32px;
// Border
$border-color: #AAA;
$border-thin: .1em;
$border-thick: .15em;
// Light theme // Light theme
$color-header: #3d3d3d; $color-header: #3d3d3d;
@ -97,3 +97,8 @@ $color-notice-light: darken($color-notice, 35%);
$color-alert-medium: darken($color-alert, 20%); $color-alert-medium: darken($color-alert, 20%);
$color-alert-light: darken($color-alert, 35%); $color-alert-light: darken($color-alert, 35%);
/**/ /**/
// Border
$border-thin: .1em solid $color-spacer;
$border-thin-light: .1em solid $color-spacer-light;

View File

@ -42,6 +42,7 @@
<vn-thead> <vn-thead>
<vn-tr> <vn-tr>
<vn-th number>Id</vn-th> <vn-th number>Id</vn-th>
<vn-th number>Ticket</vn-th>
<vn-th>Destination</vn-th> <vn-th>Destination</vn-th>
<vn-th>Landed</vn-th> <vn-th>Landed</vn-th>
<vn-th number>Quantity</vn-th> <vn-th number>Quantity</vn-th>
@ -62,6 +63,13 @@
{{saleClaimed.sale.itemFk | zeroFill:6}} {{saleClaimed.sale.itemFk | zeroFill:6}}
</span> </span>
</vn-td> </vn-td>
<vn-td number>
<span
class="link"
ng-click="$ctrl.showTicketDescriptor($event, saleClaimed.sale.ticketFk)">
{{::saleClaimed.sale.ticketFk}}
</span>
</vn-td>
<vn-td> <vn-td>
<vn-autocomplete <vn-autocomplete
vn-one vn-one
@ -181,3 +189,6 @@
vn-id="descriptor" vn-id="descriptor"
quicklinks="$ctrl.quicklinks"> quicklinks="$ctrl.quicklinks">
</vn-item-descriptor-popover> </vn-item-descriptor-popover>
<vn-ticket-descriptor-popover
vn-id="ticketDescriptor">
</vn-ticket-descriptor-popover>

View File

@ -67,6 +67,14 @@ class Controller {
}); });
} }
showTicketDescriptor(event, ticketFk) {
this.$.ticketDescriptor.ticketFk = ticketFk;
this.$.ticketDescriptor.parent = event.target;
this.$.ticketDescriptor.show();
event.preventDefault();
}
focusLastInput() { focusLastInput() {
let inputs = document.querySelectorAll('#claimDestinationFk'); let inputs = document.querySelectorAll('#claimDestinationFk');
inputs[inputs.length - 1].querySelector('input').focus(); inputs[inputs.length - 1].querySelector('input').focus();

View File

@ -0,0 +1,10 @@
const app = require('vn-loopback/server/server');
describe('item-barcode toItem()', () => {
it('should return the same number if there is a barcode and a item with the same ID', async() => {
let barcode = 3;
let result = await app.models.ItemBarcode.toItem(barcode);
expect(result).toBe(3);
});
});

View File

@ -0,0 +1,28 @@
module.exports = Self => {
Self.remoteMethod('toItem', {
description: 'Returns last entries',
accessType: 'READ',
accepts: [{
arg: 'barcode',
type: 'Number',
required: true,
description: 'barcode'
}],
returns: {
type: 'Number',
root: true
},
http: {
path: `/:barcode/toItem`,
verb: 'GET'
}
});
Self.toItem = async barcode => {
let query = `SELECT vn.barcodeToItem(?)`;
let [item] = await Self.rawSql(query, [barcode]);
if (item)
item = Object.values(item);
return item[0];
};
};

View File

@ -1,4 +1,6 @@
module.exports = Self => { module.exports = Self => {
require('../methods/item-barcode/toItem')(Self);
Self.validatesUniquenessOf('code', { Self.validatesUniquenessOf('code', {
message: `Barcode must be unique` message: `Barcode must be unique`
}); });

View File

@ -95,7 +95,7 @@
<span translate>Regularize stock</span> <span translate>Regularize stock</span>
</h5> </h5>
<vn-textfield <vn-textfield
label="Quantity" label="Type the visible quantity"
model="$ctrl.quantity" model="$ctrl.quantity"
name="user" name="user"
vn-id="userField" vn-id="userField"

View File

@ -1 +1,2 @@
Regularize stock: Regularizar stock Regularize stock: Regularizar stock
Type the visible quantity: Introduce la cantidad visible

View File

@ -4,98 +4,95 @@
filter="$ctrl.filter" filter="$ctrl.filter"
limit="50" limit="50"
data="items" data="items"
on-data-change="$ctrl.onDataChange()" > on-data-change="$ctrl.onDataChange()">
</vn-crud-model> </vn-crud-model>
<div class="main-with-right-menu"> <div class="main-with-right-menu">
<vn-card> <vn-card>
<vn-horizontal class="catalog-header" pad-medium-h> <vn-horizontal class="catalog-header" pad-medium-h>
<vn-one ng-if="model.moreRows">
<span translate>More than</span> {{model.limit}} <span translate>results</span>
</vn-one>
<vn-one> <vn-one>
<vn-horizontal> <div> <!-- ng-if="model.moreRows" -->
<vn-autocomplete vn-id="field" vn-one <span translate>More than</span> {{model.limit}} <span translate>results</span>
data="$ctrl.fieldList" </div>
initial-data="$ctrl.field"
field="$ctrl.field"
translate-fields="['name']"
order="name"
show-field="name"
value-field="field"
label="Order by">
</vn-autocomplete>
<vn-autocomplete vn-one
data="$ctrl.wayList"
initial-data="$ctrl.way"
field="$ctrl.way"
translate-fields="['name']"
show-field="name"
value-field="way"
label="Order">
</vn-autocomplete>
</vn-horizontal>
</vn-one>
</vn-horizontal>
<vn-horizontal class="catalog-list" pad-small>
<section class="product" ng-repeat="item in items">
<vn-one>
<vn-horizontal>
<vn-one class="image">
<img
ng-src="//verdnatura.es/vn-image-data/catalog/200x200/{{::item.image}}"
zoom-image="//verdnatura.es/vn-image-data/catalog/1600x900/{{::item.image}}"
on-error-src/>
</vn-one>
<vn-one pad-small class="description ellipsize">
<vn-vertical>
<h2 class="ellipsize" vn-tooltip="{{::item.name}}">
{{::item.name}}
</h2>
<span class="ellipsize" vn-tooltip="{{::item.subName}}">
{{::item.subName}}
</span>
<vn-label-value
label="{{::item.tag5}}"
value="{{::item.value5}}">
</vn-label-value>
<vn-label-value
label="{{::item.tag6}}"
value="{{::item.value6}}">
</vn-label-value>
<vn-label-value
label="{{::item.tag7}}"
value="{{::item.value7}}">
</vn-label-value>
<vn-label-value
label="{{::item.tag8}}"
value="{{::item.value8}}">
</vn-label-value>
<vn-horizontal class="price">
<vn-one>
<span>{{::item.available}}</span>
<span translate>from</span>
<span>{{::item.price | currency: 'EUR': 2}}</span>
</vn-one>
<vn-auto>
<a href="" vn-tooltip="Add">
<vn-icon-button icon="add_circle" ng-click="$ctrl.preview($event, item)"></vn-icon-button>
</a>
</vn-auto>
</vn-horizontal>
</vn-vertical>
</vn-one>
</vn-horizontal>
</vn-one>
</section>
</vn-horizontal>
<vn-horizontal ng-if="!model.data || model.data.length == 0">
<vn-one pad-small translate style="text-align: center">
No results
</vn-one> </vn-one>
<vn-auto>
<vn-autocomplete vn-id="field" vn-one
data="$ctrl.fieldList"
initial-data="$ctrl.field"
field="$ctrl.field"
translate-fields="['name']"
order="name"
show-field="name"
value-field="field"
label="Order by">
</vn-autocomplete>
<vn-autocomplete vn-one
data="$ctrl.wayList"
initial-data="$ctrl.way"
field="$ctrl.way"
translate-fields="['name']"
show-field="name"
value-field="way"
label="Order">
</vn-autocomplete>
</vn-auto>
</vn-horizontal> </vn-horizontal>
</vn-card> </vn-card>
<vn-card
ng-if="!model.data || model.data.length == 0"
style="text-align: center"
margin-medium-top
pad-medium>
<span translate>No results</span>
</vn-card>
<vn-horizontal class="catalog-list">
<section class="product" ng-repeat="item in items">
<vn-card>
<div class="image">
<img
ng-src="//verdnatura.es/vn-image-data/catalog/200x200/{{::item.image}}"
zoom-image="//verdnatura.es/vn-image-data/catalog/1600x900/{{::item.image}}"
on-error-src/>
</div>
<div class="description">
<h3>
{{::item.name}}
</h3>
<h4 class="ellipsize">
<span translate-attr="::{title: item.subName}">{{::item.subName}}</span>
</h4>
<div class="tags">
<vn-label-value
ng-if="::item.value5"
label="{{::item.tag5}}"
value="{{::item.value5}}">
</vn-label-value>
<vn-label-value
ng-if="::item.value6"
label="{{::item.tag6}}"
value="{{::item.value6}}">
</vn-label-value>
<vn-label-value
ng-if="::item.value7"
label="{{::item.tag7}}"
value="{{::item.value7}}">
</vn-label-value>
</div>
<div class="footer">
<div class="price">
<span>{{::item.available}}</span>
<span translate>from</span>
<span>{{::item.price | currency:'EUR':2}}</span>
</div>
<vn-icon-button
icon="add_circle"
ng-click="$ctrl.preview($event, item)"
vn-tooltip="Add">
</vn-icon-button>
</div>
</div>
</vn-card>
</section>
</vn-horizontal>
<vn-pagination margin-small-v model="model"></vn-pagination> <vn-pagination margin-small-v model="model"></vn-pagination>
</div> </div>
<vn-side-menu side="right"> <vn-side-menu side="right">

View File

@ -1,16 +1,31 @@
@import "variables"; @import "variables";
vn-order-catalog .catalog-header { vn-order-catalog {
border-color: $color-spacer; .catalog-header {
border-bottom: 1px solid rgba($color-spacer, 0.5); border-bottom: $border-thin;
padding: $pad-medium;
align-items: center;
vn-one:first-child { & > vn-one {
padding-top: 2em; display: flex;
flex: 1;
span {
color: $color-font-secondary
}
}
& > vn-auto {
width: 28em;
display: flex;
overflow: hidden;
& > * {
padding-left: $pad-medium;
}
}
} }
vn-one:nth-child(2) { .catalog-list {
padding-top: 0.5em; padding-top: $pad-small;
}
span {
color: $color-font-secondary
} }
} }

View File

@ -6,7 +6,7 @@ vn-catalog-filter > div {
padding-left: $pad-medium; padding-left: $pad-medium;
padding-right: $pad-medium; padding-right: $pad-medium;
border-color: $color-spacer; border-color: $color-spacer;
border-bottom: 1px solid rgba($color-spacer, 0.5); border-bottom: $border-thin;
} }
.item-category { .item-category {
padding: $pad-small; padding: $pad-small;

View File

@ -1,4 +1,6 @@
vn-order-line{ @import "./variables";
vn-order-line {
vn-table { vn-table {
img { img {
border-radius: 50%; border-radius: 50%;
@ -8,7 +10,7 @@ vn-order-line{
} }
.taxes { .taxes {
max-width: 10em; max-width: 10em;
border: .1em solid #CCC; border: $border-thin-light;
text-align: right; text-align: right;
padding: .5em !important; padding: .5em !important;

View File

@ -1,4 +1,4 @@
Order id: Id ticket Order id: Id pedido
Client id: Id cliente Client id: Id cliente
From landed: Desde f. entrega From landed: Desde f. entrega
To landed: Hasta f. entrega To landed: Hasta f. entrega

View File

@ -1,8 +1,10 @@
@import "./variables";
vn-order-summary .summary > div > vn-horizontal > vn-one { vn-order-summary .summary > div > vn-horizontal > vn-one {
min-width: 10em !important; min-width: 10em !important;
&.taxes { &.taxes {
border: .1em solid #CCC; border: $border-thin-light;
text-align: right; text-align: right;
padding: .5em !important; padding: .5em !important;

View File

@ -1,6 +1,8 @@
@import "./variables";
.totalBox { .totalBox {
border: 1px solid #CCC; border: $border-thin-light;
text-align: left; text-align: left;
align-self: flex-end; align-self: flex-end;
} }

View File

@ -8,65 +8,55 @@
auto-load="true"> auto-load="true">
</vn-crud-model> </vn-crud-model>
<vn-vertical> <vn-vertical>
<vn-card pad-large> <vn-card
<vn-vertical> ng-if="!model.data || model.data.length == 0"
<vn-horizontal class="catalog-list" pad-small> style="text-align: center"
<section class="product" ng-repeat="sale in sales"> pad-medium>
<vn-one> <span translate>No results</span>
<vn-horizontal>
<vn-one class="image">
<img
ng-src="//verdnatura.es/vn-image-data/catalog/200x200/{{::sale.item.image}}"
zoom-image="//verdnatura.es/vn-image-data/catalog/1600x900/{{::sale.item.image}}"
on-error-src/>
</vn-one>
<vn-one pad-small class="description ellipsize">
<vn-vertical>
<h2 class="ellipsize link" vn-tooltip="{{::sale.item.name}}"
ng-click="$ctrl.showDescriptor($event, sale.item.id)">
{{::sale.item.name}}
</h2>
<span class="ellipsize" vn-tooltip="{{::sale.item.subName}}">
{{::sale.item.subName}}
</span>
<vn-label-value
label="{{::sale.item.tag5}}"
value="{{::sale.item.value5}}">
</vn-label-value>
<vn-label-value
label="{{::sale.item.tag6}}"
value="{{::sale.item.value6}}">
</vn-label-value>
<vn-label-value
label="{{::sale.item.tag7}}"
value="{{::sale.item.value7}}">
</vn-label-value>
<vn-label-value
label="{{::sale.item.tag8}}"
value="{{::sale.item.value8}}">
</vn-label-value>
<vn-horizontal class="price">
<vn-one>
<span>{{::sale.quantity}}</span>
<span translate>by</span>
<span>{{::sale.price | currency: 'EUR': 2}}</span>
</vn-one>
</vn-horizontal>
</vn-vertical>
</vn-one>
</vn-horizontal>
</vn-one>
</section>
</vn-horizontal>
<vn-horizontal ng-if="model.data.length == 0">
<vn-one pad-small-v translate>
No results
</vn-one>
</vn-horizontal>
</vn-vertical>
<vn-pagination model="model"></vn-pagination>
</vn-card> </vn-card>
<vn-horizontal class="catalog-list">
<section class="product" ng-repeat="sale in sales">
<vn-card>
<div class="image">
<img
ng-src="//verdnatura.es/vn-image-data/catalog/200x200/{{::sale.item.image}}"
zoom-image="//verdnatura.es/vn-image-data/catalog/1600x900/{{::sale.item.image}}"
on-error-src/>
</div>
<div class="description">
<h3>
<span class="link" ng-click="$ctrl.showDescriptor($event, sale.item.id)">
{{::sale.item.name}}
</span>
</h3>
<h4 class="ellipsize">
<span translate-attr="::{title: item.subName}">{{::sale.item.subName}}</span>
</h4>
<div class="tags">
<vn-label-value
label="{{::sale.item.tag5}}"
value="{{::sale.item.value5}}">
</vn-label-value>
<vn-label-value
label="{{::sale.item.tag6}}"
value="{{::sale.item.value6}}">
</vn-label-value>
<vn-label-value
label="{{::sale.item.tag7}}"
value="{{::sale.item.value7}}">
</vn-label-value>
</div>
<div class="footer">
<div class="price">
<span>{{::sale.quantity}}</span>
<span translate>by</span>
<span>{{::sale.price | currency: 'EUR': 2}}</span>
</div>
</div>
</div>
</vn-card>
</section>
</vn-horizontal>
<vn-pagination model="model"></vn-pagination>
</vn-vertical> </vn-vertical>
<vn-item-descriptor-popover vn-id="descriptor"></vn-item-descriptor-popover> <vn-item-descriptor-popover vn-id="descriptor"></vn-item-descriptor-popover>

View File

@ -20,7 +20,7 @@
</vn-thead> </vn-thead>
<vn-tbody> <vn-tbody>
<vn-tr ng-repeat="sale in sales"> <vn-tr ng-repeat="sale in sales">
<vn-td center> <vn-td center shrink>
<vn-check <vn-check
vn-one field="sale.isChecked.isChecked" vn-one field="sale.isChecked.isChecked"
disabled="true"> disabled="true">

View File

@ -75,7 +75,7 @@ vn-ticket-sale {
vn-button[label=Cancel]{ vn-button[label=Cancel]{
display: none; display: none;
} }
vn-card.vn-ticket-create{ vn-card.vn-ticket-create {
padding: 0!important; padding: 0!important;
} }
} }
@ -89,7 +89,7 @@ vn-ticket-sale {
} }
.taxes { .taxes {
max-width: 10em; max-width: 10em;
border: .1em solid #CCC; border: $border-thin-light;
text-align: right; text-align: right;
padding: .5em !important; padding: .5em !important;

View File

@ -1,14 +1,20 @@
vn-ticket-summary .summary > div > vn-horizontal > vn-one { @import "./variables";
min-width: 10em !important;
&.taxes { vn-ticket-summary .summary {
border: .1em solid #CCC; max-width: $width-large;
text-align: right;
padding: .5em !important;
& > p { & > div > vn-horizontal > vn-one {
font-size: 1.2em; min-width: 10em;
margin: .2em;
&.taxes {
border: $border-thin-light;
text-align: right;
padding: .5em;
& > p {
font-size: 1.2em;
margin: .2em;
}
} }
} }
} }

View File

@ -1,4 +0,0 @@
CREATE TABLE `vn`.`localLog` (
`id` INT NOT NULL AUTO_INCREMENT,
`ticketFk` VARCHAR(45) NULL,
PRIMARY KEY (`id`));

View File

@ -1,21 +0,0 @@
DROP TRIGGER IF EXISTS `vn2008`.`TicketsAfterUpdate`;
DELIMITER $$
USE `vn2008`$$
CREATE DEFINER=`root`@`%` TRIGGER `vn2008`.`TicketsAfterUpdate`
AFTER UPDATE ON `Tickets` FOR EACH ROW
BEGIN
IF NEW.Id_Ruta IS NULL AND OLD.Id_Ruta IS NOT NULL THEN
INSERT INTO vn.routeLog(originFk, userFk, `action`, description)
VALUES (OLD.Id_Ruta, account.userGetId(), 'update', CONCAT('Saca el ticket ', OLD.Id_Ticket, ' de la ruta'));
ELSEIF NOT (NEW.Id_Ruta <=> OLD.Id_Ruta) THEN
INSERT INTO vn.routeLog(originFk, userFk, `action`, description)
VALUES (NEW.Id_Ruta, account.userGetId(), 'update', CONCAT('Añade el ticket ', OLD.Id_Ticket, ' a la ruta'));
END IF;
CALL stock.queueAdd ('ticket', NEW.Id_Ticket, OLD.Id_Ticket);
INSERT INTO vn.localLog(ticketFk)
VALUES(NEW.Id_Ticket);
END$$
DELIMITER ;

View File

@ -1,58 +0,0 @@
DROP TRIGGER IF EXISTS `vn2008`.`ClientesBeforeUpdate`;
DELIMITER $$
USE `vn2008`$$
CREATE DEFINER=`root`@`%` TRIGGER `ClientesBeforeUpdate`
BEFORE UPDATE ON `Clientes`
FOR EACH ROW
BEGIN
DECLARE vText VARCHAR(255) DEFAULT NULL;
DECLARE isAlreadyUsedIf BOOLEAN;
SELECT (COUNT(*) > 1) INTO isAlreadyUsedIf
FROM Clientes
WHERE `IF` = TRIM(NEW.`IF`);
IF isAlreadyUsedIf THEN
CALL util.throw ('Error. El NIF/CIF está repetido');
END IF;
-- Comprueba que el formato de los teléfonos es válido
IF !(NEW.telefono <=> OLD.telefono) THEN
CALL pbx.phoneIsValid (NEW.telefono);
END IF;
IF !(NEW.movil <=> OLD.movil) THEN
CALL pbx.phoneIsValid (NEW.movil);
END IF;
IF !(NEW.fax <=> OLD.fax) THEN
CALL pbx.phoneIsValid (NEW.fax);
END IF;
-- Avisar al comercial si ha llegado la documentación sepa/core
IF NEW.sepavnl AND !OLD.sepavnl THEN
SET vText = 'Sepa de VNL';
END IF;
IF NEW.corevnl AND !OLD.corevnl THEN
SET vText = 'Core de VNL';
END IF;
IF vText IS NOT NULL
THEN
INSERT INTO mail(`to`, reply_to, subject, text)
SELECT
CONCAT(IF(ac.id,name, 'jgallego'), '@verdnatura.es'),
'administracion@verdnatura.es',
CONCAT('Cliente ', NEW.Id_Cliente),
CONCAT('Recibida la documentación: ', vText)
FROM Trabajadores t
LEFT JOIN account.user u ON t.user_id = u.id AND active
LEFT JOIN account.account ac ON ac.id = u.id
WHERE t.Id_Trabajador = NEW.Id_Trabajador;
END IF;
END$$
DELIMITER ;

View File

@ -1,17 +0,0 @@
USE `vn`;
CREATE
OR REPLACE ALGORITHM = UNDEFINED
DEFINER = `root`@`%`
SQL SECURITY DEFINER
VIEW `itemType` AS
SELECT
`t`.`tipo_id` AS `id`,
`t`.`Id_Tipo` AS `code`,
`t`.`Tipo` AS `name`,
`t`.`reino_id` AS `categoryFk`,
`t`.`life` AS `life`,
`t`.`Id_Trabajador` AS `workerFk`,
`t`.`warehouseFk` AS `warehouseFk`,
`t`.`isPackaging` AS `isPackaging`
FROM
`vn2008`.`Tipos` `t`;

View File

@ -1,70 +0,0 @@
USE `vn`;
DROP procedure IF EXISTS `ticketGetTax`;
DELIMITER $$
USE `vn`$$
CREATE DEFINER=`root`@`%` PROCEDURE `ticketGetTax`()
READS SQL DATA
BEGIN
/**
* Calcula la base imponible, el IVA y el recargo de equivalencia para
* un conjunto de tickets.
*
* @table tmp.ticket(ticketFk) Identificadores de los tickets a calcular
* @return tmp.ticketTax Impuesto desglosado para cada ticket
* @return tmp.ticketAmount
*/
DROP TEMPORARY TABLE IF EXISTS tmp.addressCompany;
CREATE TEMPORARY TABLE tmp.addressCompany
(INDEX (addressFk, companyFk))
ENGINE = MEMORY
SELECT DISTINCT t.addressFk, t.companyFk
FROM tmp.ticket tmpTicket
JOIN ticket t ON t.id = tmpTicket.ticketFk;
CALL addressTaxArea ();
DROP TEMPORARY TABLE IF EXISTS tmp.ticketTax;
CREATE TEMPORARY TABLE tmp.ticketTax
(INDEX (ticketFk))
ENGINE = MEMORY
SELECT tmpTicket.ticketFk,
bp.pgcFk,
ROUND(SUM(s.quantity * s.price * (100 - s.discount)/100
),2) AS taxableBase,
ROUND(SUM(s.quantity * s.price * (100 - s.discount)/100
) * pgc.rate / 100,2) AS tax,
tc.code
FROM tmp.ticket tmpTicket
JOIN sale s ON s.ticketFk = tmpTicket.ticketFk
JOIN item i ON i.id = s.itemFk
JOIN ticket t ON t.id = tmpTicket.ticketFk
JOIN supplier su ON su.id = t.companyFk
JOIN tmp.addressTaxArea ata
ON ata.addressFk = t.addressFk AND ata.companyFk = t.companyFk
JOIN itemTaxCountry itc
ON itc.itemFk = i.id AND itc.countryFk = su.countryFk
JOIN bookingPlanner bp
ON bp.countryFk = su.countryFk
AND bp.taxAreaFk = ata.areaFk
AND bp.taxClassFk = itc.taxClassFk
JOIN pgc ON pgc.code = bp.pgcFk
JOIN taxClass tc ON tc.id = bp.taxClassFk
GROUP BY tmpTicket.ticketFk, pgc.code
HAVING taxableBase != 0;
DROP TEMPORARY TABLE IF EXISTS tmp.ticketAmount;
CREATE TEMPORARY TABLE tmp.ticketAmount
(INDEX (ticketFk))
ENGINE = MEMORY
SELECT ticketFk, taxableBase, SUM(tax) tax
FROM tmp.ticketTax
GROUP BY ticketFk, code;
DROP TEMPORARY TABLE IF EXISTS tmp.addressCompany;
DROP TEMPORARY TABLE IF EXISTS tmp.addressTaxArea;
END$$
DELIMITER ;

View File

@ -1,154 +0,0 @@
USE `vn`;
DROP procedure IF EXISTS `ticketComponentUpdateSale`;
DELIMITER $$
USE `vn`$$
CREATE DEFINER=`root`@`%` PROCEDURE `ticketComponentUpdateSale`(vOption INT)
BEGIN
/**
* A partir de la tabla tmp.sale, crea los Movimientos_componentes
* y modifica el campo Preu de la tabla Movimientos
*
* @param i_option integer tipo de actualizacion
* @param table tmp.sale tabla memory con el campo Id_Movimiento, warehouse_id
**/
DECLARE vComponentFk INT;
DECLARE vRenewComponents BOOLEAN;
DECLARE vKeepPrices BOOLEAN;
CASE vOption
WHEN 1 THEN
SET vRenewComponents = TRUE;
SET vKeepPrices = FALSE;
WHEN 2 THEN
SET vComponentFk = 17;
SET vRenewComponents = TRUE;
SET vKeepPrices = TRUE;
WHEN 3 THEN
SET vComponentFk = 37;
SET vRenewComponents = TRUE;
SET vKeepPrices = TRUE;
WHEN 4 THEN
SET vComponentFk = 34;
SET vRenewComponents = TRUE;
SET vKeepPrices = TRUE;
WHEN 5 THEN
SET vComponentFk = 35;
SET vRenewComponents = TRUE;
SET vKeepPrices = TRUE;
WHEN 6 THEN
SET vComponentFk = 36;
SET vRenewComponents = TRUE;
SET vKeepPrices = TRUE;
WHEN 7 THEN
REPLACE INTO saleComponent(saleFk, componentFk, value)
SELECT s.id, 28, ROUND(((s.price * (100 - s.discount) / 100) - SUM(IFNULL(sc.value, 0))) * 0.8, 3)
FROM sale s
JOIN tmp.sale tmps ON tmps.saleFk = s.id
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
AND sc.componentFk NOT IN (28, 29)
GROUP BY s.id;
REPLACE INTO saleComponent(saleFk, componentFk, value)
SELECT s.id, 29, ROUND(((s.price * (100 - s.discount) / 100) - SUM(IFNULL(sc.value, 0))) * 0.2, 3)
FROM sale s
JOIN tmp.sale tmps ON tmps.saleFk = s.id
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
AND sc.componentFk NOT IN (28, 29)
GROUP BY s.id;
SET vRenewComponents = FALSE;
SET vKeepPrices = FALSE;
WHEN 8 THEN
DELETE sc.*
FROM tmp.sale tmps JOIN saleComponent sc ON sc.saleFk = tmps.saleFk;
REPLACE INTO saleComponent(saleFk, componentFk, value)
SELECT s.id, 28, ROUND(((s.price * (100 - s.discount) / 100)), 3)
FROM sale s
JOIN tmp.sale tmps ON tmps.saleFk = s.id;
SET vRenewComponents = FALSE;
SET vKeepPrices = FALSE;
WHEN 9 THEN
SET vRenewComponents = TRUE;
SET vKeepPrices = TRUE;
END CASE;
IF vRenewComponents THEN
DELETE sc.*
FROM tmp.sale tmps
JOIN saleComponent sc ON sc.saleFk = tmps.saleFk
JOIN componentRate cr ON cr.id = sc.componentFk
WHERE cr.isRenewable;
REPLACE INTO saleComponent(saleFk, componentFk, value)
SELECT s.id, tc.componentFk, ROUND(tc.cost,3)
FROM sale s
JOIN tmp.sale tmps ON tmps.saleFk = s.id
JOIN tmp.ticketComponent tc ON tc.itemFk = s.itemFk AND tc.warehouseFk = tmps.warehouseFk
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
AND sc.componentFk = tc.componentFk
LEFT JOIN componentRate cr ON cr.id = tc.componentFk
WHERE IF(sc.componentFk IS NULL AND NOT cr.isRenewable, FALSE, TRUE);
END IF;
IF vKeepPrices THEN
REPLACE INTO saleComponent(saleFk, componentFk, value)
SELECT s.id, vComponentFk, ROUND((s.price * (100 - s.discount) / 100) - SUM(sc.value), 3) dif
FROM sale s
JOIN tmp.sale tmps ON tmps.saleFk = s.id
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
WHERE sc.saleFk <> vComponentFk
GROUP BY s.id
HAVING dif <> 0;
ELSE
UPDATE sale s
JOIN item i on i.id = s.itemFk
JOIN itemType it on it.id = i.typeFk
JOIN (SELECT SUM(sc.value) sumValue, sc.saleFk
FROM saleComponent sc
JOIN tmp.sale tmps ON tmps.saleFk = sc.saleFk
GROUP BY sc.saleFk) sc ON sc.saleFk = s.id
SET s.price = sumValue
WHERE it.code != 'PRT';
REPLACE INTO saleComponent(saleFk, componentFk, value)
SELECT s.id, 21, ROUND((s.price * (100 - s.discount) / 100) - sum(value),3) saleValue
FROM sale s
JOIN tmp.sale tmps ON tmps.saleFk = s.id
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
WHERE sc.componentFk != 21
GROUP BY s.id
HAVING ROUND(saleValue, 4) <> 0;
END IF;
UPDATE sale s
JOIN (
SELECT SUM(sc.value) sumValue, sc.saleFk
FROM saleComponent sc
JOIN tmp.sale tmps ON tmps.saleFk = sc.saleFk
JOIN componentRate cr ON cr.id = sc.componentFk
JOIN componentTypeRate ctr on ctr.id = cr.componentTypeRate AND ctr.base
GROUP BY sc.saleFk) sc ON sc.saleFk = s.id
SET s.priceFixed = sumValue, s.isPriceFixed = 1;
DELETE sc.*
FROM saleComponent sc
JOIN tmp.sale tmps ON tmps.saleFk = sc.saleFk
JOIN sale s on s.id = sc.saleFk
JOIN item i ON i.id = s.itemFk
JOIN itemType it ON it.id = i.typeFk
WHERE it.code = 'PRT';
INSERT INTO saleComponent(saleFk, componentFk, value)
SELECT s.id, 15, ROUND(s.price,3)
FROM sale s
JOIN tmp.sale tmps ON tmps.saleFk = s.id
JOIN item i ON i.id = s.itemFK
JOIN itemType it ON it.id = i.typeFk
WHERE it.code = 'PRT' AND s.price > 0;
END$$
DELIMITER ;

View File

@ -1,40 +0,0 @@
DROP TRIGGER IF EXISTS `vn2008`.`CompresAfterInsert`;
DELIMITER $$
USE `vn2008`$$
CREATE DEFINER=`root`@`%` TRIGGER `CompresAfterInsert` AFTER INSERT ON `Compres` FOR EACH ROW BEGIN
DECLARE vWarehouse INT;
DECLARE vWarehouseOut INT;
DECLARE isMerchandise BOOLEAN;
CALL stock.queueAdd ('buy', NEW.Id_Compra, NULL);
SELECT warehouse_id, warehouse_id_out INTO vWarehouse, vWarehouseOut
FROM Entradas E
JOIN travel T ON T.id = E.travel_id
WHERE E.Id_Entrada = NEW.Id_Entrada;
-- Actualiza el volumen unitario
SELECT k.merchandise INTO isMerchandise
FROM vn.itemCategory k
JOIN vn.itemType it ON it.categoryFk = k.id
JOIN vn.item i ON i.typeFk = it.id
WHERE i.id = NEW.Id_Article;
If isMerchandise THEN
REPLACE bi.rotacion(Id_Article, warehouse_id, cm3)
VALUES (NEW.Id_ARticle, vWarehouse, vn2008.cm3_unidad(NEW.Id_Compra));
END IF;
IF (SELECT fuente FROM warehouse where id = vWarehouseOut AND id <> 13) AND
(SELECT has_notify_passport(NEW.Id_Article,NEW.Id_Compra))
THEN
CALL notify_passport(NEW.Id_Article, NEW.Etiquetas, NEW.Packing,NEW.Id_Compra);
CALL insert_producer_plantpassport(NEW.Id_Compra);
END IF;
END$$
DELIMITER ;

View File

@ -1,38 +0,0 @@
DROP TRIGGER IF EXISTS `vn2008`.`CompresAfterUpdate`;
DELIMITER $$
USE `vn2008`$$
CREATE DEFINER=`root`@`%` TRIGGER `CompresAfterUpdate`
AFTER UPDATE ON `Compres` FOR EACH ROW
BEGIN
DECLARE vWarehouse INT;
DECLARE vWarehouseOut INT;
DECLARE isMerchandise BOOLEAN;
CALL stock.queueAdd ('buy', NEW.Id_Compra, OLD.Id_Compra);
SELECT warehouse_id, warehouse_id_out INTO vWarehouse, vWarehouseOut
FROM Entradas E
JOIN travel T ON T.id = E.travel_id
WHERE E.Id_Entrada = NEW.Id_Entrada;
SELECT k.merchandise INTO isMerchandise
FROM vn.itemCategory k
JOIN vn.itemType it ON it.categoryFk = k.id
JOIN vn.item i ON i.typeFk = it.id
WHERE i.id = NEW.Id_Article;
IF isMerchandise AND NOT(NEW.Id_Cubo <=> OLD.Id_Cubo AND NEW.Id_Entrada <=> OLD.Id_Entrada)
THEN
REPLACE bi.rotacion(Id_Article, warehouse_id, cm3)
VALUES (NEW.Id_ARticle, vWarehouse, vn2008.cm3_unidad(NEW.Id_Compra));
END IF;
IF (SELECT fuente FROM warehouse where id = vWarehouseOut AND id <> 13) AND
(SELECT has_notify_passport(NEW.Id_Article,NEW.Id_Compra)) > 0
THEN
CALL notify_passport(NEW.Id_Article, NEW.Etiquetas, NEW.Packing,NEW.Id_Compra);
CALL insert_producer_plantpassport(NEW.Id_Compra);
END IF;
END$$
DELIMITER ;

View File

@ -1,18 +0,0 @@
USE `vn`;
CREATE
OR REPLACE ALGORITHM = UNDEFINED
DEFINER = `root`@`%`
SQL SECURITY DEFINER
VIEW `vn`.`workerDepartment` AS
SELECT
`p`.`id_trabajador` AS `workerFk`,
`d`.`id` AS `departmentFk`
FROM
(((`postgresql`.`person` `p`
JOIN `postgresql`.`profile` `pr` ON ((`pr`.`person_id` = `p`.`person_id`)))
LEFT JOIN (`postgresql`.`business` `b`
LEFT JOIN `postgresql`.`business_labour` `bl` ON ((`b`.`business_id` = `bl`.`business_id`))) ON ((`pr`.`profile_id` = `b`.`client_id`)))
JOIN `vn`.`department` `d` ON ((`d`.`id` = `bl`.`department_id`)))
WHERE
(ISNULL(`b`.`date_end`)
OR (`b`.`date_end` > CURDATE()));

View File

@ -1,108 +0,0 @@
USE `hedera`;
DROP procedure IF EXISTS `orderAddItem`;
DELIMITER $$
USE `hedera`$$
CREATE DEFINER=`root`@`%` PROCEDURE `orderAddItem`(IN `vOrder` INT, IN `vWarehouse` INT, IN `vItem` INT, IN `vAmount` INT)
BEGIN
DECLARE vRow INT;
DECLARE vAdd INT;
DECLARE vAvailable INT;
DECLARE vDone BOOL;
DECLARE vGrouping INT;
DECLARE vRate INT;
DECLARE vShipment DATE;
DECLARE vPrice DECIMAL(10,2);
DECLARE vDate DATE;
DECLARE vAddress INT;
DECLARE vAgencyMode INT;
DECLARE cur CURSOR FOR
SELECT grouping, price, rate
FROM tmp.bionic_price
WHERE warehouse_id = vWarehouse
AND item_id = vItem
ORDER BY grouping DESC;
DECLARE CONTINUE HANDLER FOR NOT FOUND
SET vDone = TRUE;
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
ROLLBACK;
RESIGNAL;
END;
SELECT date_send, address_id, agency_id
INTO vDate, vAddress, vAgencyMode
FROM `order`
WHERE id = vOrder;
CALL vn2008.bionic_from_item(vDate, vAddress, vAgencyMode, vItem);
START TRANSACTION;
SELECT shipped INTO vShipment
FROM tmp.travel_tree
WHERE warehouseFk = vWarehouse;
SELECT available INTO vAvailable
FROM tmp.bionic_lot
WHERE warehouse_id = vWarehouse
AND item_id = vItem;
IF vAmount > IFNULL(vAvailable, 0)
THEN
CALL util.throw ('ORDER_ROW_UNAVAILABLE');
END IF;
OPEN cur;
l: LOOP
SET vDone = FALSE;
FETCH cur INTO vGrouping, vPrice, vRate;
IF vDone THEN
LEAVE l;
END IF;
SET vAdd = vAmount - MOD(vAmount, vGrouping);
SET vAmount = vAmount - vAdd;
IF vAdd = 0 THEN
ITERATE l;
END IF;
INSERT INTO order_row SET
order_id = vOrder,
item_id = vItem,
warehouse_id = vWarehouse,
shipment = vShipment,
rate = vRate,
amount = vAdd,
price = vPrice;
SET vRow = LAST_INSERT_ID();
INSERT INTO order_component (order_row_id, component_id, price)
SELECT vRow, c.component_id, c.cost
FROM tmp.bionic_component c
JOIN bi.tarifa_componentes t
ON t.Id_Componente = c.component_id
AND (t.tarifa_class IS NULL OR t.tarifa_class = vRate)
WHERE c.warehouse_id = vWarehouse
AND c.item_id = vItem;
END LOOP;
CLOSE cur;
IF vAmount > 0
THEN
CALL util.throw ('AMOUNT_NOT_MATCH_GROUPING');
END IF;
COMMIT;
CALL vn2008.bionic_free ();
END$$
DELIMITER ;

View File

@ -1 +0,0 @@
INSERT INTO salix.ACL(id,model, property, accessType, permission, principalType, principalId)VALUES(147,'UserConfigView', '*', '*', 'ALLOW', 'ROLE', 'employee');

View File

@ -1,99 +0,0 @@
USE `vn`;
DROP procedure IF EXISTS `ticketGetTax`;
DELIMITER $$
USE `vn`$$
CREATE DEFINER=`root`@`%` PROCEDURE `ticketGetTax`()
READS SQL DATA
BEGIN
/**
* Calcula la base imponible, el IVA y el recargo de equivalencia para
* un conjunto de tickets.
*
* @table tmp.ticket(ticketFk) Identificadores de los tickets a calcular
* @return tmp.ticketAmount
* @return tmp.ticketTax Impuesto desglosado para cada ticket.
*/
DROP TEMPORARY TABLE IF EXISTS tmp.addressCompany;
CREATE TEMPORARY TABLE tmp.addressCompany
(INDEX (addressFk, companyFk))
ENGINE = MEMORY
SELECT DISTINCT t.addressFk, t.companyFk
FROM tmp.ticket tmpTicket
JOIN ticket t ON t.id = tmpTicket.ticketFk;
CALL addressTaxArea ();
/** Solo se calcula la base imponible (taxableBase) y el impuesto se calculará posteriormente
* No se debería cambiar el sistema por problemas con los decimales
*/
DROP TEMPORARY TABLE IF EXISTS tmp.ticketTax;
CREATE TEMPORARY TABLE tmp.ticketTax
(INDEX (ticketFk))
ENGINE = MEMORY
SELECT tmpTicket.ticketFk,
bp.pgcFk,
SUM(s.quantity * s.price * (100 - s.discount)/100 ) AS taxableBase,
pgc.rate,
tc.code
FROM tmp.ticket tmpTicket
JOIN sale s ON s.ticketFk = tmpTicket.ticketFk
JOIN item i ON i.id = s.itemFk
JOIN ticket t ON t.id = tmpTicket.ticketFk
JOIN supplier su ON su.id = t.companyFk
JOIN tmp.addressTaxArea ata
ON ata.addressFk = t.addressFk AND ata.companyFk = t.companyFk
JOIN itemTaxCountry itc
ON itc.itemFk = i.id AND itc.countryFk = su.countryFk
JOIN bookingPlanner bp
ON bp.countryFk = su.countryFk
AND bp.taxAreaFk = ata.areaFk
AND bp.taxClassFk = itc.taxClassFk
JOIN pgc ON pgc.code = bp.pgcFk
JOIN taxClass tc ON tc.id = bp.taxClassFk
GROUP BY tmpTicket.ticketFk, pgc.code,pgc.rate
HAVING taxableBase != 0;
DROP TEMPORARY TABLE IF EXISTS tmp.ticketServiceTax;
CREATE TEMPORARY TABLE tmp.ticketServiceTax
(INDEX (ticketFk))
ENGINE = MEMORY
SELECT tt.ticketFk,
SUM(ts.quantity * ts.price) AS taxableBase,
pgc.rate,
tc.code
FROM tmp.ticketTax tt
JOIN ticketService ts ON ts.ticketFk = tt.ticketFk
JOIN ticket t ON t.id = tt.ticketFk
JOIN supplier su ON su.id = t.companyFk
JOIN tmp.addressTaxArea ata
ON ata.addressFk = t.addressFk AND ata.companyFk = t.companyFk
JOIN bookingPlanner bp
ON bp.countryFk = su.countryFk
AND bp.taxAreaFk = ata.areaFk
AND bp.taxClassFk = ts.taxClassFk
JOIN pgc ON pgc.code = bp.pgcFk AND pgc.rate = tt.rate
JOIN taxClass tc ON tc.id = bp.taxClassFk
GROUP BY tt.ticketFk, tt.code,tt.rate
HAVING taxableBase != 0;
UPDATE tmp.ticketTax tt
JOIN tmp.ticketServiceTax ts ON tt.ticketFk = ts.ticketFk AND tt.code = ts.code AND tt.rate = ts.rate
SET tt.taxableBase = tt.taxableBase + ts.taxableBase;
DROP TEMPORARY TABLE IF EXISTS tmp.ticketAmount;
CREATE TEMPORARY TABLE tmp.ticketAmount
(INDEX (ticketFk))
ENGINE = MEMORY
SELECT ticketFk, taxableBase, SUM(CAST(taxableBase * rate / 100 AS DECIMAL(10, 2))) tax,code
FROM tmp.ticketTax
GROUP BY ticketFk, code;
DROP TEMPORARY TABLE IF EXISTS tmp.addressCompany;
DROP TEMPORARY TABLE IF EXISTS tmp.addressTaxArea;
END$$
DELIMITER ;

View File

@ -1,34 +0,0 @@
DROP PROCEDURE IF EXISTS vn.ticketGetTaxAdd;
DELIMITER $$
$$
CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`ticketGetTaxAdd`(vTicketFk INT)
BEGIN
/**
* Añade un ticket a la tabla tmp.ticket para calcular
* el IVA y el recargo de equivalencia y devuelve el resultado.
*/
DROP TEMPORARY TABLE IF EXISTS tmp.ticket;
CREATE TEMPORARY TABLE tmp.ticket
ENGINE = MEMORY
SELECT vTicketFk ticketFk;
CALL vn.ticketGetTax();
SELECT
tt.ticketFk,
CAST(tt.taxableBase AS DECIMAL(10, 2)) AS taxableBase,
CAST(tt.rate * tt.taxableBase / 100 AS DECIMAL(10, 2)) AS tax,
pgc.*,
CAST(IF(pe.equFk IS NULL, taxableBase, 0) AS DECIMAL(10, 2)) AS Base,
pgc.rate / 100 as vatPercent
FROM tmp.ticketTax tt
JOIN vn.pgc ON pgc.code = tt.pgcFk
LEFT JOIN vn.pgcEqu pe ON pe.equFk = pgc.code;
DROP TEMPORARY TABLE tmp.ticket;
DROP TEMPORARY TABLE tmp.ticketTax;
DROP TEMPORARY TABLE tmp.ticketAmount;
END$$
DELIMITER ;

File diff suppressed because one or more lines are too long

View File

@ -593,11 +593,11 @@ INSERT INTO `vn`.`saleComponent`(`saleFk`, `componentFk`, `value`)
(5, 29, -18.72), (5, 29, -18.72),
(5, 39, 0.02), (5, 39, 0.02),
(6, 23, 6.5), (6, 23, 6.5),
(7, 15, 0.29), (7, 15, 0.2899),
(7, 28, 5.6), (7, 28, 5.6),
(7, 29, -4.6), (7, 29, -4.6),
(7, 39, 0.01), (7, 39, 0.01),
(8, 15, 0.044), (8, 15, 0.0435),
(8, 21, -0.004), (8, 21, -0.004),
(8, 28, 20.72), (8, 28, 20.72),
(8, 29, -19.72), (8, 29, -19.72),
@ -624,7 +624,7 @@ INSERT INTO `vn`.`saleComponent`(`saleFk`, `componentFk`, `value`)
(12, 29, -19.72), (12, 29, -19.72),
(12, 37, 2), (12, 37, 2),
(12, 39, 0.01), (12, 39, 0.01),
(13, 15, 0.29), (13, 15, 0.2899),
(13, 28, 5.6), (13, 28, 5.6),
(13, 29, -4.6), (13, 29, -4.6),
(13, 39, 0.01), (13, 39, 0.01),
@ -927,7 +927,7 @@ INSERT INTO `hedera`.`orderRowComponent`(`rowFk`, `componentFk`, `price`)
(5, 29, -18.72), (5, 29, -18.72),
(5, 39, 0.02), (5, 39, 0.02),
(6, 23, 6.5), (6, 23, 6.5),
(7, 15, 0.29), (7, 15, 0.2899),
(7, 28, 5.6), (7, 28, 5.6),
(7, 29, -4.6), (7, 29, -4.6),
(7, 39, 0.01), (7, 39, 0.01),

File diff suppressed because it is too large Load Diff