Skip to content

Commit

Permalink
Add tax section
Browse files Browse the repository at this point in the history
  • Loading branch information
nosolored committed Jan 15, 2019
1 parent 985510b commit c48d7e7
Show file tree
Hide file tree
Showing 17 changed files with 543 additions and 34 deletions.
3 changes: 2 additions & 1 deletion main/inc/lib/CoursesAndSessionsCatalog.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ public static function browseSessions($date = null, $limit = [])
{
$em = Database::getManager();
$urlId = api_get_current_access_url_id();
$date = Database::escape_string($date);

$sql = "SELECT s.id FROM session s ";
$sql .= "
INNER JOIN access_url_rel_session ars
Expand All @@ -490,6 +490,7 @@ public static function browseSessions($date = null, $limit = [])
";

if (!is_null($date)) {
$date = Database::escape_string($date);
$sql .= "
AND (
('$date' BETWEEN DATE(s.access_start_date) AND DATE(s.access_end_date))
Expand Down
39 changes: 39 additions & 0 deletions plugin/buycourses/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@
\Doctrine\DBAL\Types\Type::INTEGER,
['unsigned' => true]
);
$itemTable->addColumn(
'tax_perc',
\Doctrine\DBAL\Types\Type::INTEGER,
['unsigned' => true, 'notnull' => false]
);
$itemTable->setPrimaryKey(['id']);
$itemTable->addForeignKeyConstraint(
$currencyTable,
Expand Down Expand Up @@ -195,6 +200,21 @@
\Doctrine\DBAL\Types\Type::DECIMAL,
['scale' => 2]
);
$saleTable->addColumn(
'price_without_tax',
\Doctrine\DBAL\Types\Type::DECIMAL,
['scale' => 2, 'notnull' => false]
);
$saleTable->addColumn(
'tax_perc',
\Doctrine\DBAL\Types\Type::INTEGER,
['unsigned' => true, 'notnull' => false]
);
$saleTable->addColumn(
'tax_amount',
\Doctrine\DBAL\Types\Type::DECIMAL,
['scale' => 2, 'notnull' => false]
);
$saleTable->addColumn(
'currency_id',
\Doctrine\DBAL\Types\Type::INTEGER,
Expand Down Expand Up @@ -250,6 +270,21 @@
\Doctrine\DBAL\Types\Type::DECIMAL,
['scale' => 2]
);
$servicesNodeTable->addColumn(
'price_without_tax',
\Doctrine\DBAL\Types\Type::DECIMAL,
['scale' => 2, 'notnull' => false]
);
$servicesNodeTable->addColumn(
'tax_perc',
\Doctrine\DBAL\Types\Type::INTEGER,
['unsigned' => true, 'notnull' => false]
);
$servicesNodeTable->addColumn(
'tax_amount',
\Doctrine\DBAL\Types\Type::DECIMAL,
['scale' => 2, 'notnull' => false]
);
$servicesNodeTable->addColumn('node_type', \Doctrine\DBAL\Types\Type::INTEGER);
$servicesNodeTable->addColumn('node_id', \Doctrine\DBAL\Types\Type::INTEGER);
$servicesNodeTable->addColumn('buyer_id', \Doctrine\DBAL\Types\Type::INTEGER);
Expand Down Expand Up @@ -291,6 +326,10 @@
['autoincrement' => true, 'unsigned' => true]
);
$globalTable->addColumn('terms_and_conditions', \Doctrine\DBAL\Types\Type::TEXT);
$globalTable->addColumn('global_tax_perc', \Doctrine\DBAL\Types\Type::INTEGER);
$globalTable->addColumn('tax_applies_to', \Doctrine\DBAL\Types\Type::INTEGER);
$globalTable->addColumn('tax_name', \Doctrine\DBAL\Types\Type::STRING);

$globalTable->setPrimaryKey(['id']);

$queries = $pluginSchema->toSql($platform);
Expand Down
2 changes: 2 additions & 0 deletions plugin/buycourses/lang/english.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
$strings['commissions_enable'] = "Enable Commissions";
$strings['transfer_enable'] = "Enable bank transfer";
$strings['unregistered_users_enable'] = "Allow anonymous users";
$strings['invoicing_enable'] = "Enable Invoicing";
$strings['tax_enable'] = "Enable Taxation";
$strings['Free'] = "FREE";
$strings['PaypalPayoutCommissions'] = "Paypal Payout Commissions";
$strings['MyPayouts'] = "My payments";
Expand Down
16 changes: 15 additions & 1 deletion plugin/buycourses/lang/spanish.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
$strings['commissions_enable'] = "Habilitar Comisiones";
$strings['transfer_enable'] = "Habilitar transferencia";
$strings['unregistered_users_enable'] = "Permitir usuarios sin registro en la plataforma";
$strings['invoicing_enable'] = "Habilitar Facturación";
$strings['tax_enable'] = "Habilitar Impuestos";
$strings['Free'] = "GRATIS";

$strings['PaypalPayoutCommissions'] = "Pagar comisiones por Paypal";
$strings['MyPayouts'] = "Mis Pagos";
$strings['Commission'] = "Comisión";
Expand Down Expand Up @@ -173,3 +174,16 @@
$strings['YourCoursesNeedAtLeastOneLearningPath'] = 'Los cursos en los que estás registrado necesitan tener al menos una lección que contenga un item de cerficado final';
$strings['NoPaymentOptionAvailable'] = 'No existen opciones de pago. Por favor reporte este problema al administrador.';
$strings['XIsOnlyPaymentMethodAvailable'] = '%s es el único método de pago disponible para esta compra.';
$strings['GlobalTaxPerc'] = "Porcentaje del impuesto global";
$strings['GlobalTaxPercDescription'] = "Porcentaje por defecto que se usará, excepto si existe un impuesto específico en el curso, sesión o servicio.";
$strings['TaxPerc'] = "Porcentaje del impuesto";
$strings['TaxPercDescription'] = "Si se deja vacío se usará valor global por defecto.";
$strings['ByDefault'] = "por defecto (valor global)";
$strings['OnlyCourses'] = "Solo Cursos";
$strings['OnlySessions'] = "Solo Sesiones";
$strings['OnlyServices'] = "Solo Servicios";
$strings['TaxAppliesTo'] = "Impuestos aplicados a";
$strings['AllCoursesSessionsAndServices'] = "Todos (Cursos, sesiones y servicios)";
$strings['TaxNameCustom'] = "Nombre del impuesto";
$strings['TaxNameExamples'] = "VAT, IVA, IGV, TVA, IV ...";
$strings['ErrorUpdateFieldDB'] = "Error al actualizar los campos de la base de datos";
9 changes: 9 additions & 0 deletions plugin/buycourses/resources/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@
letter-spacing: -0.020em;
}

.buy-info .price-details-tax, .service-buy .price-details-tax {
font-size: 18px;
line-height: 24px;
font-weight: bold;
padding-bottom: 0px;
padding-top: 10px;
letter-spacing: -0.020em;
}

.buy-info .buy-item .title {
margin-top: 5px;
font-weight: bold;
Expand Down
Loading

0 comments on commit c48d7e7

Please sign in to comment.