.
This commit is contained in:
parent
eba766e7eb
commit
ee48b19610
569
docs/catalogs/sql/add-payment-terms.sql
Normal file
569
docs/catalogs/sql/add-payment-terms.sql
Normal file
@ -0,0 +1,569 @@
|
||||
SET @company_id = '5e4dc5b3-96b9-4968-9490-14bd032fec5f';
|
||||
|
||||
START TRANSACTION;
|
||||
|
||||
-- =========================================================
|
||||
-- 1. CONTADO
|
||||
-- =========================================================
|
||||
|
||||
SET @term_contado = UUID();
|
||||
|
||||
INSERT INTO
|
||||
payment_terms (
|
||||
id,
|
||||
company_id,
|
||||
name,
|
||||
description,
|
||||
is_active,
|
||||
is_system,
|
||||
created_at,
|
||||
updated_at,
|
||||
deleted_at
|
||||
)
|
||||
VALUES (
|
||||
@term_contado,
|
||||
@company_id,
|
||||
'Contado',
|
||||
'Pago completo el mismo día.',
|
||||
1,
|
||||
0,
|
||||
NOW(),
|
||||
NOW(),
|
||||
NULL
|
||||
);
|
||||
|
||||
INSERT INTO
|
||||
payment_term_due_rules (
|
||||
due_id,
|
||||
payment_term_id,
|
||||
due_days,
|
||||
percentage_value,
|
||||
percentage_scale,
|
||||
created_at,
|
||||
updated_at
|
||||
)
|
||||
VALUES (
|
||||
UUID(),
|
||||
@term_contado,
|
||||
0,
|
||||
10000,
|
||||
2,
|
||||
NOW(),
|
||||
NOW()
|
||||
);
|
||||
|
||||
-- =========================================================
|
||||
-- 2. 15 DÍAS
|
||||
-- =========================================================
|
||||
|
||||
SET @term_15 = UUID();
|
||||
|
||||
INSERT INTO
|
||||
payment_terms (
|
||||
id,
|
||||
company_id,
|
||||
name,
|
||||
description,
|
||||
is_active,
|
||||
is_system,
|
||||
created_at,
|
||||
updated_at,
|
||||
deleted_at
|
||||
)
|
||||
VALUES (
|
||||
@term_15,
|
||||
@company_id,
|
||||
'15 días',
|
||||
'Pago completo a 15 días.',
|
||||
1,
|
||||
0,
|
||||
NOW(),
|
||||
NOW(),
|
||||
NULL
|
||||
);
|
||||
|
||||
INSERT INTO
|
||||
payment_term_due_rules (
|
||||
due_id,
|
||||
payment_term_id,
|
||||
due_days,
|
||||
percentage_value,
|
||||
percentage_scale,
|
||||
created_at,
|
||||
updated_at
|
||||
)
|
||||
VALUES (
|
||||
UUID(),
|
||||
@term_15,
|
||||
15,
|
||||
10000,
|
||||
2,
|
||||
NOW(),
|
||||
NOW()
|
||||
);
|
||||
|
||||
-- =========================================================
|
||||
-- 3. 30 DÍAS
|
||||
-- =========================================================
|
||||
|
||||
SET @term_30 = UUID();
|
||||
|
||||
INSERT INTO
|
||||
payment_terms (
|
||||
id,
|
||||
company_id,
|
||||
name,
|
||||
description,
|
||||
is_active,
|
||||
is_system,
|
||||
created_at,
|
||||
updated_at,
|
||||
deleted_at
|
||||
)
|
||||
VALUES (
|
||||
@term_30,
|
||||
@company_id,
|
||||
'30 días',
|
||||
'Pago completo a 30 días.',
|
||||
1,
|
||||
0,
|
||||
NOW(),
|
||||
NOW(),
|
||||
NULL
|
||||
);
|
||||
|
||||
INSERT INTO
|
||||
payment_term_due_rules (
|
||||
due_id,
|
||||
payment_term_id,
|
||||
due_days,
|
||||
percentage_value,
|
||||
percentage_scale,
|
||||
created_at,
|
||||
updated_at
|
||||
)
|
||||
VALUES (
|
||||
UUID(),
|
||||
@term_30,
|
||||
30,
|
||||
10000,
|
||||
2,
|
||||
NOW(),
|
||||
NOW()
|
||||
);
|
||||
|
||||
-- =========================================================
|
||||
-- 4. 45 DÍAS
|
||||
-- =========================================================
|
||||
|
||||
SET @term_45 = UUID();
|
||||
|
||||
INSERT INTO
|
||||
payment_terms (
|
||||
id,
|
||||
company_id,
|
||||
name,
|
||||
description,
|
||||
is_active,
|
||||
is_system,
|
||||
created_at,
|
||||
updated_at,
|
||||
deleted_at
|
||||
)
|
||||
VALUES (
|
||||
@term_45,
|
||||
@company_id,
|
||||
'45 días',
|
||||
'Pago completo a 45 días.',
|
||||
1,
|
||||
0,
|
||||
NOW(),
|
||||
NOW(),
|
||||
NULL
|
||||
);
|
||||
|
||||
INSERT INTO
|
||||
payment_term_due_rules (
|
||||
due_id,
|
||||
payment_term_id,
|
||||
due_days,
|
||||
percentage_value,
|
||||
percentage_scale,
|
||||
created_at,
|
||||
updated_at
|
||||
)
|
||||
VALUES (
|
||||
UUID(),
|
||||
@term_45,
|
||||
45,
|
||||
10000,
|
||||
2,
|
||||
NOW(),
|
||||
NOW()
|
||||
);
|
||||
|
||||
-- =========================================================
|
||||
-- 5. 60 DÍAS
|
||||
-- =========================================================
|
||||
|
||||
SET @term_60 = UUID();
|
||||
|
||||
INSERT INTO
|
||||
payment_terms (
|
||||
id,
|
||||
company_id,
|
||||
name,
|
||||
description,
|
||||
is_active,
|
||||
is_system,
|
||||
created_at,
|
||||
updated_at,
|
||||
deleted_at
|
||||
)
|
||||
VALUES (
|
||||
@term_60,
|
||||
@company_id,
|
||||
'60 días',
|
||||
'Pago completo a 60 días.',
|
||||
1,
|
||||
0,
|
||||
NOW(),
|
||||
NOW(),
|
||||
NULL
|
||||
);
|
||||
|
||||
INSERT INTO
|
||||
payment_term_due_rules (
|
||||
due_id,
|
||||
payment_term_id,
|
||||
due_days,
|
||||
percentage_value,
|
||||
percentage_scale,
|
||||
created_at,
|
||||
updated_at
|
||||
)
|
||||
VALUES (
|
||||
UUID(),
|
||||
@term_60,
|
||||
60,
|
||||
10000,
|
||||
2,
|
||||
NOW(),
|
||||
NOW()
|
||||
);
|
||||
|
||||
-- =========================================================
|
||||
-- 6. 90 DÍAS
|
||||
-- =========================================================
|
||||
|
||||
SET @term_90 = UUID();
|
||||
|
||||
INSERT INTO
|
||||
payment_terms (
|
||||
id,
|
||||
company_id,
|
||||
name,
|
||||
description,
|
||||
is_active,
|
||||
is_system,
|
||||
created_at,
|
||||
updated_at,
|
||||
deleted_at
|
||||
)
|
||||
VALUES (
|
||||
@term_90,
|
||||
@company_id,
|
||||
'90 días',
|
||||
'Pago completo a 90 días.',
|
||||
1,
|
||||
0,
|
||||
NOW(),
|
||||
NOW(),
|
||||
NULL
|
||||
);
|
||||
|
||||
INSERT INTO
|
||||
payment_term_due_rules (
|
||||
due_id,
|
||||
payment_term_id,
|
||||
due_days,
|
||||
percentage_value,
|
||||
percentage_scale,
|
||||
created_at,
|
||||
updated_at
|
||||
)
|
||||
VALUES (
|
||||
UUID(),
|
||||
@term_90,
|
||||
90,
|
||||
10000,
|
||||
2,
|
||||
NOW(),
|
||||
NOW()
|
||||
);
|
||||
|
||||
-- =========================================================
|
||||
-- 7. 50% CONTADO / 50% A 30 DÍAS
|
||||
-- =========================================================
|
||||
|
||||
SET @term_50_30 = UUID();
|
||||
|
||||
INSERT INTO
|
||||
payment_terms (
|
||||
id,
|
||||
company_id,
|
||||
name,
|
||||
description,
|
||||
is_active,
|
||||
is_system,
|
||||
created_at,
|
||||
updated_at,
|
||||
deleted_at
|
||||
)
|
||||
VALUES (
|
||||
@term_50_30,
|
||||
@company_id,
|
||||
'50% contado / 50% a 30 días',
|
||||
'Pago en dos partes iguales: una al contado y otra a 30 días.',
|
||||
1,
|
||||
0,
|
||||
NOW(),
|
||||
NOW(),
|
||||
NULL
|
||||
);
|
||||
|
||||
INSERT INTO
|
||||
payment_term_due_rules (
|
||||
due_id,
|
||||
payment_term_id,
|
||||
due_days,
|
||||
percentage_value,
|
||||
percentage_scale,
|
||||
created_at,
|
||||
updated_at
|
||||
)
|
||||
VALUES (
|
||||
UUID(),
|
||||
@term_50_30,
|
||||
0,
|
||||
5000,
|
||||
2,
|
||||
NOW(),
|
||||
NOW()
|
||||
),
|
||||
(
|
||||
UUID(),
|
||||
@term_50_30,
|
||||
30,
|
||||
5000,
|
||||
2,
|
||||
NOW(),
|
||||
NOW()
|
||||
);
|
||||
|
||||
-- =========================================================
|
||||
-- 8. 50% A 30 / 50% A 60 DÍAS
|
||||
-- =========================================================
|
||||
|
||||
SET @term_30_60 = UUID();
|
||||
|
||||
INSERT INTO
|
||||
payment_terms (
|
||||
id,
|
||||
company_id,
|
||||
name,
|
||||
description,
|
||||
is_active,
|
||||
is_system,
|
||||
created_at,
|
||||
updated_at,
|
||||
deleted_at
|
||||
)
|
||||
VALUES (
|
||||
@term_30_60,
|
||||
@company_id,
|
||||
'50% a 30 / 50% a 60 días',
|
||||
'Pago en dos vencimientos iguales a 30 y 60 días.',
|
||||
1,
|
||||
0,
|
||||
NOW(),
|
||||
NOW(),
|
||||
NULL
|
||||
);
|
||||
|
||||
INSERT INTO
|
||||
payment_term_due_rules (
|
||||
due_id,
|
||||
payment_term_id,
|
||||
due_days,
|
||||
percentage_value,
|
||||
percentage_scale,
|
||||
created_at,
|
||||
updated_at
|
||||
)
|
||||
VALUES (
|
||||
UUID(),
|
||||
@term_30_60,
|
||||
30,
|
||||
5000,
|
||||
2,
|
||||
NOW(),
|
||||
NOW()
|
||||
),
|
||||
(
|
||||
UUID(),
|
||||
@term_30_60,
|
||||
60,
|
||||
5000,
|
||||
2,
|
||||
NOW(),
|
||||
NOW()
|
||||
);
|
||||
|
||||
-- =========================================================
|
||||
-- 9. 30 / 60 / 90 DÍAS
|
||||
-- 33.33 + 33.33 + 33.34 = 100.00
|
||||
-- =========================================================
|
||||
|
||||
SET @term_30_60_90 = UUID();
|
||||
|
||||
INSERT INTO
|
||||
payment_terms (
|
||||
id,
|
||||
company_id,
|
||||
name,
|
||||
description,
|
||||
is_active,
|
||||
is_system,
|
||||
created_at,
|
||||
updated_at,
|
||||
deleted_at
|
||||
)
|
||||
VALUES (
|
||||
@term_30_60_90,
|
||||
@company_id,
|
||||
'30 / 60 / 90 días',
|
||||
'Pago repartido en tres vencimientos a 30, 60 y 90 días.',
|
||||
1,
|
||||
0,
|
||||
NOW(),
|
||||
NOW(),
|
||||
NULL
|
||||
);
|
||||
|
||||
INSERT INTO
|
||||
payment_term_due_rules (
|
||||
due_id,
|
||||
payment_term_id,
|
||||
due_days,
|
||||
percentage_value,
|
||||
percentage_scale,
|
||||
created_at,
|
||||
updated_at
|
||||
)
|
||||
VALUES (
|
||||
UUID(),
|
||||
@term_30_60_90,
|
||||
30,
|
||||
3333,
|
||||
2,
|
||||
NOW(),
|
||||
NOW()
|
||||
),
|
||||
(
|
||||
UUID(),
|
||||
@term_30_60_90,
|
||||
60,
|
||||
3333,
|
||||
2,
|
||||
NOW(),
|
||||
NOW()
|
||||
),
|
||||
(
|
||||
UUID(),
|
||||
@term_30_60_90,
|
||||
90,
|
||||
3334,
|
||||
2,
|
||||
NOW(),
|
||||
NOW()
|
||||
);
|
||||
|
||||
-- =========================================================
|
||||
-- 10. 25% CONTADO / 25% 30 / 25% 60 / 25% 90
|
||||
-- =========================================================
|
||||
|
||||
SET @term_0_30_60_90 = UUID();
|
||||
|
||||
INSERT INTO
|
||||
payment_terms (
|
||||
id,
|
||||
company_id,
|
||||
name,
|
||||
description,
|
||||
is_active,
|
||||
is_system,
|
||||
created_at,
|
||||
updated_at,
|
||||
deleted_at
|
||||
)
|
||||
VALUES (
|
||||
@term_0_30_60_90,
|
||||
@company_id,
|
||||
'25% contado / 30 / 60 / 90 días',
|
||||
'Pago dividido en cuatro vencimientos iguales.',
|
||||
1,
|
||||
0,
|
||||
NOW(),
|
||||
NOW(),
|
||||
NULL
|
||||
);
|
||||
|
||||
INSERT INTO
|
||||
payment_term_due_rules (
|
||||
due_id,
|
||||
payment_term_id,
|
||||
due_days,
|
||||
percentage_value,
|
||||
percentage_scale,
|
||||
created_at,
|
||||
updated_at
|
||||
)
|
||||
VALUES (
|
||||
UUID(),
|
||||
@term_0_30_60_90,
|
||||
0,
|
||||
2500,
|
||||
2,
|
||||
NOW(),
|
||||
NOW()
|
||||
),
|
||||
(
|
||||
UUID(),
|
||||
@term_0_30_60_90,
|
||||
30,
|
||||
2500,
|
||||
2,
|
||||
NOW(),
|
||||
NOW()
|
||||
),
|
||||
(
|
||||
UUID(),
|
||||
@term_0_30_60_90,
|
||||
60,
|
||||
2500,
|
||||
2,
|
||||
NOW(),
|
||||
NOW()
|
||||
),
|
||||
(
|
||||
UUID(),
|
||||
@term_0_30_60_90,
|
||||
90,
|
||||
2500,
|
||||
2,
|
||||
NOW(),
|
||||
NOW()
|
||||
);
|
||||
|
||||
COMMIT;
|
||||
Loading…
Reference in New Issue
Block a user