
--
-- Table structure for table `sec_apps`
--

CREATE TABLE `sec_apps` (
  `app_name` varchar(128) NOT NULL,
  `app_type` varchar(255) DEFAULT NULL,
  `description` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`app_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;

--
-- Dumping data for table `sec_apps`
--

INSERT INTO `sec_apps` VALUES ('AjusteRbro','contr',''),('cobranza_ctacte','contr',''),('compras_alicuota','blank',''),('compras_cbte','blank',''),('consulta_precio','contr',''),('control_2','contr',''),('control_cobranza_ctacte','contr',''),('control_libro_iva','contr',''),('control_reg_info','contr',''),('det_ctacte_observacion','contr',NULL),('FECAESolicitar','blank',''),('form_articulos','form',''),('form_cab_ctacte','form',''),('form_cab_ctacte_pago','form',''),('form_certificados_ws','form',''),('form_clientes','form',''),('form_clientes_fcre','form',''),('form_clientes_web','form',''),('form_compras','form',''),('form_comprobantes_asociados','form',''),('form_cupon_tarjeta','form',''),('form_facturas','form',''),('form_facturas_old','form',''),('form_factura_detalle','form',''),('form_factura_detalle_old','form',''),('form_fac_cupon_tarjeta','form',''),('form_hoja_sticker','form',''),('form_marcas','form',''),('form_puntos_ventas','form',''),('form_remitos','form',''),('form_remitos_facturados','form',''),('form_remitos_new','',NULL),('form_remito_detalle','form',''),('form_remito_detalle_facturado','form',''),('form_rubros','form',''),('form_subrubros','form',''),('form_tarjetas_bancarias','form',''),('grid_articlos','cons',''),('grid_clientes','cons',''),('grid_compras','cons',''),('grid_cta_cte_pago','cons',''),('grid_facturas','cons',''),('grid_facturas_vtas','cons',''),('grid_fac_cons','cons',''),('grid_hoja_sticker','cons',''),('grid_marcas','cons',''),('grid_remitos','cons',''),('grid_remitos_facturados','cons',''),('grid_remitos_vtas','cons',''),('grid_rem_cons','cons',''),('grid_rubros','cons',''),('grid_subrubros','cons',''),('grid_v_cab_ctacte','cons',''),('grid_v_detctacte','cons',''),('grid_v_detctacte_pago','cons',''),('pdfreport_cta_cte','reportpdf',''),('pdfreport_facturas','reportpdf',''),('pdfreport_hoja_sticker','reportpdf',''),('pdfreport_hoja_sticker_1','reportpdf',''),('pdfreport_hoja_sticker_col_2','reportpdf',''),('pdfreport_hoja_sticker_col_3','reportpdf',''),('pdfreport_hoja_sticker_col_4','reportpdf',''),('pdfreport_libro_compras','reportpdf',NULL),('pdfreport_libro_ventas','reportpdf',NULL),('pdfreport_presupuesto','reportpdf',NULL),('pdfreport_recibos','reportpdf',''),('pdfreport_remitos','reportpdf',''),('remito_detalle','contr',''),('remito_detalle_fcelect','contr',''),('secu_change_pswd','contr','Change Password'),('secu_form_add_users','form','Add Users'),('secu_form_edit_users','form','Edit Users'),('secu_form_sec_apps','form','Add apps'),('secu_form_sec_groups','form','Show Groups'),('secu_form_sec_groups_apps','form','Groups/Apps'),('secu_grid_sec_apps','cons','Show apps'),('secu_grid_sec_groups','cons','Show Groups'),('secu_grid_sec_users','cons','Show users'),('secu_logged','contr','Logged application'),('secu_Login','contr','Login - Initial Application'),('secu_menu','',NULL),('secu_menu_old','menu','Menu'),('secu_retrieve_pswd','contr','Retrieve Password'),('secu_search_sec_groups','filter','Search Groups'),('secu_sync_apps','contr','Resync Applications'),('sec_change_pswd','contr','Security Application'),('sec_form_add_users','form','Security Application'),('sec_form_edit_users','form','Security Application'),('sec_form_sec_apps','form','Security Application'),('sec_form_sec_groups','form','Security Application'),('sec_form_sec_groups_apps','form','Security Application'),('sec_grid_sec_apps','cons','Security Application'),('sec_grid_sec_groups','cons','Security Application'),('sec_grid_sec_users','cons','Security Application'),('sec_Login','contr','Security Application'),('sec_menu','menu','Security Application'),('sec_retrieve_pswd','contr','Security Application'),('sec_search_sec_groups','filter','Security Application'),('sec_sync_apps','contr','Security Application'),('ventas_cbte','blank',''),('venta_alicuota','blank','');

--
-- Table structure for table `sec_groups`
--

CREATE TABLE `sec_groups` (
  `group_id` int NOT NULL AUTO_INCREMENT,
  `description` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`group_id`),
  UNIQUE KEY `description` (`description`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb3;

--
-- Dumping data for table `sec_groups`
--

INSERT INTO `sec_groups` VALUES (1,'Administrador'),(3,'contable'),(2,'medical');

--
-- Table structure for table `sec_groups_apps`
--

CREATE TABLE `sec_groups_apps` (
  `group_id` int NOT NULL,
  `app_name` varchar(128) NOT NULL,
  `priv_access` varchar(1) DEFAULT NULL,
  `priv_insert` varchar(1) DEFAULT NULL,
  `priv_delete` varchar(1) DEFAULT NULL,
  `priv_update` varchar(1) DEFAULT NULL,
  `priv_export` varchar(1) DEFAULT NULL,
  `priv_print` varchar(1) DEFAULT NULL,
  PRIMARY KEY (`group_id`,`app_name`),
  KEY `sec_groups_apps_ibfk_2` (`app_name`),
  CONSTRAINT `sec_groups_apps_ibfk_1` FOREIGN KEY (`group_id`) REFERENCES `sec_groups` (`group_id`) ON DELETE CASCADE,
  CONSTRAINT `sec_groups_apps_ibfk_2` FOREIGN KEY (`app_name`) REFERENCES `sec_apps` (`app_name`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;

--
-- Dumping data for table `sec_groups_apps`
--

INSERT INTO `sec_groups_apps` VALUES (1,'AjusteRbro','Y','N','N','N','N','N'),(1,'cobranza_ctacte','Y','','','','',''),(1,'compras_alicuota','Y','','','','',''),(1,'compras_cbte','Y','','','','',''),(1,'consulta_precio','Y','','','','',''),(1,'control_2','Y','','','','',''),(1,'control_cobranza_ctacte','Y','','','','',''),(1,'control_libro_iva','Y','','','','',''),(1,'control_reg_info','Y','','','','',''),(1,'det_ctacte_observacion','Y','','','','',''),(1,'FECAESolicitar','Y','','','','',''),(1,'form_articulos','Y','Y','','Y','Y','Y'),(1,'form_cab_ctacte','Y','Y','','Y','Y','Y'),(1,'form_cab_ctacte_pago','Y','Y','','Y','Y','Y'),(1,'form_certificados_ws','Y','Y','','Y','Y','Y'),(1,'form_clientes','Y','Y','','Y','',''),(1,'form_clientes_fcre','Y','Y','','Y','Y','Y'),(1,'form_clientes_web','Y','Y','','Y','Y','Y'),(1,'form_compras','Y','Y','','Y','Y','Y'),(1,'form_comprobantes_asociados','','','','','',''),(1,'form_cupon_tarjeta','','','','','',''),(1,'form_facturas','Y','Y','','Y','Y','Y'),(1,'form_facturas_old','','','','','',''),(1,'form_factura_detalle','Y','Y','','Y','Y','Y'),(1,'form_factura_detalle_old','','','','','',''),(1,'form_fac_cupon_tarjeta','','','','','',''),(1,'form_hoja_sticker','','','','','',''),(1,'form_marcas','Y','Y','','Y','Y','Y'),(1,'form_puntos_ventas','Y','Y','','Y','Y','Y'),(1,'form_remitos','Y','Y','','Y','Y','Y'),(1,'form_remitos_facturados','Y','','','','',''),(1,'form_remitos_new','','','','','',''),(1,'form_remito_detalle','Y','Y','Y','Y','Y','Y'),(1,'form_remito_detalle_facturado','Y','Y','Y','Y','Y','Y'),(1,'form_rubros','Y','Y','Y','Y','Y','Y'),(1,'form_subrubros','Y','Y','Y','Y','Y','Y'),(1,'form_tarjetas_bancarias','Y','Y','Y','Y','Y','Y'),(1,'grid_articlos','Y','','','','Y','Y'),(1,'grid_clientes','Y','','','','Y','Y'),(1,'grid_compras','Y','','','','Y','Y'),(1,'grid_cta_cte_pago','Y','','','','Y','Y'),(1,'grid_facturas','Y','','','','Y','Y'),(1,'grid_facturas_vtas','Y','','','','Y','Y'),(1,'grid_fac_cons','Y','','','','Y','Y'),(1,'grid_hoja_sticker','','','','','',''),(1,'grid_marcas','Y','','','','Y','Y'),(1,'grid_remitos','Y','','','','Y','Y'),(1,'grid_remitos_facturados','Y','','','','Y','Y'),(1,'grid_remitos_vtas','Y','','','','Y','Y'),(1,'grid_rem_cons','Y','','','','Y','Y'),(1,'grid_rubros','Y','','','','Y','Y'),(1,'grid_subrubros','Y','','','','Y','Y'),(1,'grid_v_cab_ctacte','Y','','','','Y','Y'),(1,'grid_v_detctacte','Y','','','','Y','Y'),(1,'grid_v_detctacte_pago','Y','','','','Y','Y'),(1,'pdfreport_cta_cte','','','','','',''),(1,'pdfreport_facturas','Y','','','','',''),(1,'pdfreport_hoja_sticker','','','','','',''),(1,'pdfreport_hoja_sticker_1','','','','','',''),(1,'pdfreport_hoja_sticker_col_2','','','','','',''),(1,'pdfreport_hoja_sticker_col_3','','','','','',''),(1,'pdfreport_hoja_sticker_col_4','','N','N','N','N','N'),(1,'pdfreport_libro_compras','Y','','','','',''),(1,'pdfreport_libro_ventas','Y','','','','',''),(1,'pdfreport_presupuesto','Y','','','','',''),(1,'pdfreport_recibos','','','','','',''),(1,'pdfreport_remitos','Y','','','','',''),(1,'remito_detalle','','','','','',''),(1,'remito_detalle_fcelect','','','','','',''),(1,'secu_change_pswd','','','','','',''),(1,'secu_form_add_users','','','','','',''),(1,'secu_form_edit_users','','','','','',''),(1,'secu_form_sec_apps','','','','','',''),(1,'secu_form_sec_groups','','','','','',''),(1,'secu_form_sec_groups_apps','','','','','',''),(1,'secu_grid_sec_apps','','','','','',''),(1,'secu_grid_sec_groups','','','','','Y','Y'),(1,'secu_grid_sec_users','','','','','',''),(1,'secu_logged','','','','','',''),(1,'secu_Login','','N','N','N','N','N'),(1,'secu_menu','','','','','',''),(1,'secu_menu_old','','','','','',''),(1,'secu_retrieve_pswd','','','','','',''),(1,'secu_search_sec_groups','','','','','',''),(1,'secu_sync_apps','','','','','',''),(1,'sec_change_pswd','Y','','','','',''),(1,'sec_form_add_users','Y','Y','','Y','Y','Y'),(1,'sec_form_edit_users','Y','Y','','Y','Y','Y'),(1,'sec_form_sec_apps','Y','Y','','Y','Y','Y'),(1,'sec_form_sec_groups','Y','Y','','Y','Y','Y'),(1,'sec_form_sec_groups_apps','Y','Y','','Y','Y','Y'),(1,'sec_grid_sec_apps','Y','','','','Y','Y'),(1,'sec_grid_sec_groups','Y','','','','Y','Y'),(1,'sec_grid_sec_users','Y','','','','Y','Y'),(1,'sec_Login','Y','N','N','N','N','N'),(1,'sec_menu','Y','N','N','N','N','N'),(1,'sec_retrieve_pswd','Y','N','N','N','N','N'),(1,'sec_search_sec_groups','Y','N','N','N','N','N'),(1,'sec_sync_apps','Y','N','N','N','N','N'),(1,'ventas_cbte','Y','','','','',''),(1,'venta_alicuota','Y','','','','',''),(2,'AjusteRbro','Y','','','','',''),(2,'cobranza_ctacte','Y','','','','',''),(2,'compras_alicuota','Y','','','','',''),(2,'compras_cbte','Y','','','','',''),(2,'consulta_precio','Y','','','','',''),(2,'control_2','Y','','','','',''),(2,'control_cobranza_ctacte','Y','','','','',''),(2,'control_libro_iva','Y','','','','',''),(2,'control_reg_info','Y','','','','',''),(2,'det_ctacte_observacion',NULL,NULL,NULL,NULL,NULL,NULL),(2,'FECAESolicitar','Y','','','','',''),(2,'form_articulos','Y','Y','','Y','Y','Y'),(2,'form_cab_ctacte','Y','Y','','Y','Y','Y'),(2,'form_cab_ctacte_pago','Y','Y','','Y','Y','Y'),(2,'form_certificados_ws','Y','Y','','Y','Y','Y'),(2,'form_clientes','Y','Y','','Y','Y','Y'),(2,'form_clientes_fcre','Y','Y','','Y','Y','Y'),(2,'form_clientes_web','','','','','',''),(2,'form_compras','Y','Y','','Y','Y','Y'),(2,'form_comprobantes_asociados','Y','Y','Y','Y','Y','Y'),(2,'form_cupon_tarjeta','','','','','',''),(2,'form_facturas','Y','Y','','Y','Y','Y'),(2,'form_facturas_old','','','','','',''),(2,'form_factura_detalle','Y','Y','Y','Y','Y','Y'),(2,'form_factura_detalle_old','','','','','',''),(2,'form_fac_cupon_tarjeta','','','','','',''),(2,'form_hoja_sticker','','','','','',''),(2,'form_marcas','Y','Y','','Y','Y','Y'),(2,'form_puntos_ventas','Y','Y','','Y','Y','Y'),(2,'form_remitos','Y','Y','','Y','Y','Y'),(2,'form_remitos_facturados','Y','Y','','Y','Y','Y'),(2,'form_remitos_new','','','','','',''),(2,'form_remito_detalle','Y','Y','Y','Y','Y','Y'),(2,'form_remito_detalle_facturado','Y','Y','','Y','Y','Y'),(2,'form_rubros','Y','Y','','Y','Y','Y'),(2,'form_subrubros','Y','Y','','Y','Y','Y'),(2,'form_tarjetas_bancarias','','','','','',''),(2,'grid_articlos','Y','','','','Y','Y'),(2,'grid_clientes','Y','','','','Y','Y'),(2,'grid_compras','Y','','','','Y','Y'),(2,'grid_cta_cte_pago','Y','','','','Y','Y'),(2,'grid_facturas','Y','','','','Y','Y'),(2,'grid_facturas_vtas','Y','','','','Y','Y'),(2,'grid_fac_cons','Y','','','','Y','Y'),(2,'grid_hoja_sticker','','','','','',''),(2,'grid_marcas','Y','','','','Y','Y'),(2,'grid_remitos','Y','','','','Y','Y'),(2,'grid_remitos_facturados','Y','','','','Y','Y'),(2,'grid_remitos_vtas','Y','','','','Y','Y'),(2,'grid_rem_cons','Y','','','','Y','Y'),(2,'grid_rubros','Y','','','','Y','Y'),(2,'grid_subrubros','Y','','','','Y','Y'),(2,'grid_v_cab_ctacte','Y','','','','Y','Y'),(2,'grid_v_detctacte','Y','','','','Y','Y'),(2,'grid_v_detctacte_pago','Y','','','','Y','Y'),(2,'pdfreport_cta_cte','Y','','','','',''),(2,'pdfreport_facturas','Y','','','','',''),(2,'pdfreport_hoja_sticker','','','','','',''),(2,'pdfreport_hoja_sticker_1','','','','','',''),(2,'pdfreport_hoja_sticker_col_2','','','','','',''),(2,'pdfreport_hoja_sticker_col_3','','','','','',''),(2,'pdfreport_hoja_sticker_col_4','','','','','',''),(2,'pdfreport_libro_compras',NULL,NULL,NULL,NULL,NULL,NULL),(2,'pdfreport_libro_ventas',NULL,NULL,NULL,NULL,NULL,NULL),(2,'pdfreport_presupuesto','Y','','','','',''),(2,'pdfreport_recibos','','','','','',''),(2,'pdfreport_remitos','Y','','','','',''),(2,'remito_detalle','','','','','',''),(2,'remito_detalle_fcelect','Y','','','','',''),(2,'secu_change_pswd','','','','','',''),(2,'secu_form_add_users','','','','','',''),(2,'secu_form_edit_users','','','','','',''),(2,'secu_form_sec_apps','','','','','',''),(2,'secu_form_sec_groups','','','','','',''),(2,'secu_form_sec_groups_apps','','','','','',''),(2,'secu_grid_sec_apps','','','','','',''),(2,'secu_grid_sec_groups','','','','','',''),(2,'secu_grid_sec_users','','','','','',''),(2,'secu_logged','','','','','',''),(2,'secu_Login',NULL,NULL,NULL,NULL,NULL,NULL),(2,'secu_menu',NULL,NULL,NULL,NULL,NULL,NULL),(2,'secu_menu_old',NULL,NULL,NULL,NULL,NULL,NULL),(2,'secu_retrieve_pswd',NULL,NULL,NULL,NULL,NULL,NULL),(2,'secu_search_sec_groups',NULL,NULL,NULL,NULL,NULL,NULL),(2,'secu_sync_apps',NULL,NULL,NULL,NULL,NULL,NULL),(2,'sec_change_pswd',NULL,NULL,NULL,NULL,NULL,NULL),(2,'sec_form_add_users',NULL,NULL,NULL,NULL,NULL,NULL),(2,'sec_form_edit_users',NULL,NULL,NULL,NULL,NULL,NULL),(2,'sec_form_sec_apps',NULL,NULL,NULL,NULL,NULL,NULL),(2,'sec_form_sec_groups',NULL,NULL,NULL,NULL,NULL,NULL),(2,'sec_form_sec_groups_apps',NULL,NULL,NULL,NULL,NULL,NULL),(2,'sec_grid_sec_apps',NULL,NULL,NULL,NULL,NULL,NULL),(2,'sec_grid_sec_groups',NULL,NULL,NULL,NULL,NULL,NULL),(2,'sec_grid_sec_users',NULL,NULL,NULL,NULL,NULL,NULL),(2,'sec_Login','Y','','','','',''),(2,'sec_menu','Y','','','','',''),(2,'sec_retrieve_pswd',NULL,NULL,NULL,NULL,NULL,NULL),(2,'sec_search_sec_groups',NULL,NULL,NULL,NULL,NULL,NULL),(2,'sec_sync_apps',NULL,NULL,NULL,NULL,NULL,NULL),(2,'ventas_cbte','Y','','','','',''),(2,'venta_alicuota','Y','','','','',''),(3,'AjusteRbro','Y','','','','',''),(3,'cobranza_ctacte','Y','','','','',''),(3,'compras_alicuota','Y','','','','',''),(3,'compras_cbte','Y','','','','',''),(3,'consulta_precio','Y','','','','',''),(3,'control_2','Y','','','','',''),(3,'control_cobranza_ctacte','Y','','','','',''),(3,'control_libro_iva','Y','','','','',''),(3,'control_reg_info','Y','','','','',''),(3,'det_ctacte_observacion','Y','','','','',''),(3,'FECAESolicitar','Y','','','','',''),(3,'form_articulos','Y','Y','','Y','Y','Y'),(3,'form_cab_ctacte','Y','Y','','Y','Y','Y'),(3,'form_cab_ctacte_pago','Y','Y','','Y','Y','Y'),(3,'form_certificados_ws','Y','Y','','Y','Y','Y'),(3,'form_clientes','Y','Y','','Y','Y','Y'),(3,'form_clientes_fcre','Y','Y','','Y','Y','Y'),(3,'form_clientes_web','Y','Y','','Y','Y','Y'),(3,'form_compras','Y','Y','Y','Y','Y','Y'),(3,'form_comprobantes_asociados',NULL,NULL,NULL,NULL,NULL,NULL),(3,'form_cupon_tarjeta',NULL,NULL,NULL,NULL,NULL,NULL),(3,'form_facturas',NULL,NULL,NULL,NULL,NULL,NULL),(3,'form_facturas_old',NULL,NULL,NULL,NULL,NULL,NULL),(3,'form_factura_detalle','Y','Y','Y','Y','Y','Y'),(3,'form_factura_detalle_old',NULL,NULL,NULL,NULL,NULL,NULL),(3,'form_fac_cupon_tarjeta',NULL,NULL,NULL,NULL,NULL,NULL),(3,'form_hoja_sticker',NULL,NULL,NULL,NULL,NULL,NULL),(3,'form_marcas','Y','Y','','Y','Y','Y'),(3,'form_puntos_ventas','Y','Y','','Y','Y','Y'),(3,'form_remitos','Y','Y','','Y','Y','Y'),(3,'form_remitos_facturados','Y','','','','Y','Y'),(3,'form_remitos_new',NULL,NULL,NULL,NULL,NULL,NULL),(3,'form_remito_detalle','Y','Y','Y','Y','Y','Y'),(3,'form_remito_detalle_facturado','Y','','','','Y','Y'),(3,'form_rubros','Y','Y','Y','','Y','Y'),(3,'form_subrubros','Y','Y','Y','','Y','Y'),(3,'form_tarjetas_bancarias',NULL,NULL,NULL,NULL,NULL,NULL),(3,'grid_articlos','Y','','','','Y','Y'),(3,'grid_clientes','Y','','','','Y','Y'),(3,'grid_compras','Y','','','','Y','Y'),(3,'grid_cta_cte_pago','Y','','','','Y','Y'),(3,'grid_facturas','Y','','','','Y','Y'),(3,'grid_facturas_vtas','Y','','','','Y','Y'),(3,'grid_fac_cons','Y','','','','Y','Y'),(3,'grid_hoja_sticker',NULL,NULL,NULL,NULL,NULL,NULL),(3,'grid_marcas','Y','','','','Y','Y'),(3,'grid_remitos','Y','','','','Y','Y'),(3,'grid_remitos_facturados','Y','','','','Y','Y'),(3,'grid_remitos_vtas','Y','','','','Y','Y'),(3,'grid_rem_cons','Y','','','','Y','Y'),(3,'grid_rubros','Y','','','','Y','Y'),(3,'grid_subrubros','Y','','','','Y','Y'),(3,'grid_v_cab_ctacte','Y','','','','Y','Y'),(3,'grid_v_detctacte','Y','','','','Y','Y'),(3,'grid_v_detctacte_pago','Y','','','','Y','Y'),(3,'pdfreport_cta_cte','Y','','','','',''),(3,'pdfreport_facturas','Y','','','','',''),(3,'pdfreport_hoja_sticker',NULL,NULL,NULL,NULL,NULL,NULL),(3,'pdfreport_hoja_sticker_1',NULL,NULL,NULL,NULL,NULL,NULL),(3,'pdfreport_hoja_sticker_col_2',NULL,NULL,NULL,NULL,NULL,NULL),(3,'pdfreport_hoja_sticker_col_3',NULL,NULL,NULL,NULL,NULL,NULL),(3,'pdfreport_hoja_sticker_col_4',NULL,NULL,NULL,NULL,NULL,NULL),(3,'pdfreport_libro_compras','Y','','','','',''),(3,'pdfreport_libro_ventas','Y','','','','',''),(3,'pdfreport_presupuesto',NULL,NULL,NULL,NULL,NULL,NULL),(3,'pdfreport_recibos',NULL,NULL,NULL,NULL,NULL,NULL),(3,'pdfreport_remitos','Y','','','','',''),(3,'remito_detalle','','','','','',''),(3,'remito_detalle_fcelect',NULL,NULL,NULL,NULL,NULL,NULL),(3,'secu_change_pswd',NULL,NULL,NULL,NULL,NULL,NULL),(3,'secu_form_add_users',NULL,NULL,NULL,NULL,NULL,NULL),(3,'secu_form_edit_users',NULL,NULL,NULL,NULL,NULL,NULL),(3,'secu_form_sec_apps',NULL,NULL,NULL,NULL,NULL,NULL),(3,'secu_form_sec_groups',NULL,NULL,NULL,NULL,NULL,NULL),(3,'secu_form_sec_groups_apps',NULL,NULL,NULL,NULL,NULL,NULL),(3,'secu_grid_sec_apps',NULL,NULL,NULL,NULL,NULL,NULL),(3,'secu_grid_sec_groups',NULL,NULL,NULL,NULL,NULL,NULL),(3,'secu_grid_sec_users',NULL,NULL,NULL,NULL,NULL,NULL),(3,'secu_logged',NULL,NULL,NULL,NULL,NULL,NULL),(3,'secu_Login',NULL,NULL,NULL,NULL,NULL,NULL),(3,'secu_menu',NULL,NULL,NULL,NULL,NULL,NULL),(3,'secu_menu_old',NULL,NULL,NULL,NULL,NULL,NULL),(3,'secu_retrieve_pswd',NULL,NULL,NULL,NULL,NULL,NULL),(3,'secu_search_sec_groups',NULL,NULL,NULL,NULL,NULL,NULL),(3,'secu_sync_apps',NULL,NULL,NULL,NULL,NULL,NULL),(3,'sec_change_pswd','Y','','','','',''),(3,'sec_form_add_users',NULL,NULL,NULL,NULL,NULL,NULL),(3,'sec_form_edit_users',NULL,NULL,NULL,NULL,NULL,NULL),(3,'sec_form_sec_apps',NULL,NULL,NULL,NULL,NULL,NULL),(3,'sec_form_sec_groups',NULL,NULL,NULL,NULL,NULL,NULL),(3,'sec_form_sec_groups_apps',NULL,NULL,NULL,NULL,NULL,NULL),(3,'sec_grid_sec_apps',NULL,NULL,NULL,NULL,NULL,NULL),(3,'sec_grid_sec_groups',NULL,NULL,NULL,NULL,NULL,NULL),(3,'sec_grid_sec_users',NULL,NULL,NULL,NULL,NULL,NULL),(3,'sec_Login','Y','','','','',''),(3,'sec_menu','Y','','','','',''),(3,'sec_retrieve_pswd',NULL,NULL,NULL,NULL,NULL,NULL),(3,'sec_search_sec_groups',NULL,NULL,NULL,NULL,NULL,NULL),(3,'sec_sync_apps',NULL,NULL,NULL,NULL,NULL,NULL),(3,'ventas_cbte','Y','','','','',''),(3,'venta_alicuota','Y','','','','','');

--
-- Table structure for table `sec_logged`
--

CREATE TABLE `sec_logged` (
  `login` varchar(255) NOT NULL,
  `date_login` varchar(128) DEFAULT NULL,
  `sc_session` varchar(32) DEFAULT NULL,
  `ip` varchar(32) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Dumping data for table `sec_logged`
--

INSERT INTO `sec_logged` VALUES ('medical25','1536086402.85','_SC_FAIL_SC_','136.2.16.181'),('medical25','1536086780.34','_SC_FAIL_SC_','136.2.16.181'),(' tuky','1580397049.68','_SC_FAIL_SC_','179.62.254.229'),('MEDICAL25','1568815687.96','_SC_FAIL_SC_','190.51.57.227'),('lorenapizzeraz','1557268119.88','_SC_FAIL_SC_','186.22.235.151'),('lorenapizzeraz','1557270620.58','_SC_FAIL_SC_','186.22.235.151'),('tuki','1560170569.95','_SC_FAIL_SC_','190.51.23.232'),('tuki','1557248341.85','_SC_FAIL_SC_','179.62.254.229'),('A','1582813915.46','_SC_FAIL_SC_','190.51.39.181'),('elsaa','1556971012.85','_SC_FAIL_SC_','190.51.34.86'),('  elsa','1550757532.42','_SC_FAIL_SC_','190.51.55.175'),('prueba','1558045684.93','8nu2ncime1pc2hq7532foi5q73','190.190.219.177'),('tuki','1557439526.1','_SC_FAIL_SC_','186.22.235.151'),(' tuky','1580397040.15','_SC_FAIL_SC_','179.62.254.229'),('elas','1558724823.03','_SC_FAIL_SC_','190.51.39.114'),('blocked','1556892026.8','_SC_BLOCKED_SC_','190.51.40.186'),('tuki','1579786320.6','_SC_FAIL_SC_','179.62.254.229'),('0ED5CA3','1571141561.65','_SC_FAIL_SC_','190.51.3.56'),('tuki','1562799954.1','_SC_FAIL_SC_','200.115.205.109'),('franco','1584057323.14','_SC_FAIL_SC_','190.51.21.133'),('tuki','1557423821.81','_SC_FAIL_SC_','186.141.136.253'),('tuki','1557423836.55','_SC_FAIL_SC_','186.141.136.253'),('tuky','1593444678.43','0i0s53lgt9v6nes6c4ia2bkrr2','179.62.252.249'),('MEDCAL','1571142579.42','_SC_FAIL_SC_','190.51.3.56'),('facundo','1585224514.22','_SC_FAIL_SC_','190.51.54.19'),('facundo','1585224522.85','_SC_FAIL_SC_','190.51.54.19'),('medicalmedical','1575674139.43','_SC_FAIL_SC_','190.51.39.80'),('lorenapizzedaz','1584046045.87','qlq3kl7anmkohh09gqgg3nadl7','190.227.30.204'),('natali','1589336995.58','_SC_FAIL_SC_','179.62.254.116'),('elsa7','1585748051.21','_SC_FAIL_SC_','190.51.1.205'),('elsa','1593520734.19','fli5qnvoggmbdh6uup4gc5f1a5','190.175.159.24'),('factu','1589812051.12','_SC_FAIL_SC_','190.51.26.35'),('agustin','1593262226.93','cs86ns595dkh2at1v7p512k2e0','190.175.155.176'),('natali','1588375264.62','_SC_FAIL_SC_','190.51.37.97'),('acu','1592257944','_SC_FAIL_SC_','201.250.187.65'),('admin','1596722272.434','_SC_FAIL_SC_','127.0.0.1'),('natalio','1596746462.4136','f2tps6ssnnlvg68mo327hrvh63','127.0.0.1'),('admin','1593553609.68','1h5ndvdj1f9bbo7k1u99okast0','190.175.152.201'),('medical','1599435235.8373','5209aon62mstfa0vpn9uq7qfr4','127.0.0.1');

--
-- Table structure for table `sec_users`
--

CREATE TABLE `sec_users` (
  `login` varchar(255) NOT NULL,
  `pswd` varchar(32) NOT NULL,
  `name` varchar(64) DEFAULT NULL,
  `email` varchar(64) DEFAULT NULL,
  `active` varchar(1) DEFAULT NULL,
  `activation_code` varchar(32) DEFAULT NULL,
  `priv_admin` varchar(1) DEFAULT NULL,
  `cliweb` int DEFAULT NULL,
  `mod_ctacte` varchar(1) DEFAULT NULL,
  PRIMARY KEY (`login`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;

--
-- Dumping data for table `sec_users`
--

INSERT INTO `sec_users` VALUES ('admin','21232f297a57a5a743894a0e4a801fc3','Admin','admin@admin.com','Y',NULL,'Y',2,'S'),('agus','fdf169558242ee051cca1479770ebac3','Nieto Agustin','agus@agus.com','Y','','',2,'S'),('elsa','783833680e6da5cf6cd7481a44d8fa4c','Carrozo','elsa@elsa.com','Y','','',2,'S'),('facu','f8e0920f29985ad1a2724161e86faa65','facu@facu.com','facu@facu.com','Y','','',2,'S'),('sergio','3bffa4ebdf4874e506c2b12405796aa5','Fillol Sergio','sergio@sergio.com','Y','','',2,'S'),('tuky','7cbf2eb36da70ab42c518efc3a720f7d','Tuky Lopes','tuky@tuky.com','Y','','',2,'');

--
-- Table structure for table `sec_users_apps`
--

CREATE TABLE `sec_users_apps` (
  `login` varchar(255) NOT NULL,
  `app_name` varchar(128) NOT NULL,
  `priv_access` varchar(1) DEFAULT NULL,
  `priv_insert` varchar(1) DEFAULT NULL,
  `priv_delete` varchar(1) DEFAULT NULL,
  `priv_update` varchar(1) DEFAULT NULL,
  `priv_export` varchar(1) DEFAULT NULL,
  `priv_print` varchar(1) DEFAULT NULL,
  PRIMARY KEY (`login`,`app_name`),
  KEY `sec_users_apps_ibfk_2` (`app_name`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Dumping data for table `sec_users_apps`
--

INSERT INTO `sec_users_apps` VALUES ('admin','FECAESolicitar','Y','N','N','N','N','N'),('admin','form_anulacion','Y','Y','Y','Y','Y','Y'),('admin','form_comprobantes_asociados','Y','Y','Y','Y','Y','Y'),('admin','form_factura_detalle','Y','Y','Y','Y','Y','Y'),('admin','form_facturas','Y','Y','Y','Y','Y','Y'),('admin','form_puntos_ventas','Y','Y','Y','Y','Y','Y'),('admin','grid_facturas','Y','N','N','N','Y','Y'),('admin','pdfreport_facturas','Y','N','N','N','N','N'),('admin','app_change_pswd','Y','N','N','N','N','N'),('admin','app_form_add_users','Y','Y','Y','Y','Y','Y'),('admin','app_form_edit_users','Y','Y','Y','Y','Y','Y'),('admin','app_form_sec_apps','Y','Y','Y','Y','Y','Y'),('admin','app_form_sec_users_apps','Y','Y','Y','Y','Y','Y'),('admin','app_grid_sec_apps','Y','N','N','N','Y','Y'),('admin','app_grid_sec_users','Y','N','N','N','Y','Y'),('admin','app_grid_sec_users_apps','Y','N','N','N','Y','Y'),('admin','app_search_sec_users','Y','N','N','N','N','N'),('admin','app_Login','Y','N','N','N','N','N'),('admin','app_menu','Y','N','N','N','N','N'),('admin','app_logged','Y','N','N','N','N','N'),('admin','app_logged_users','Y','N','N','N','Y','Y'),('admin','app_retrieve_pswd','Y','N','N','N','N','N'),('admin','app_sync_apps','Y','N','N','N','N','N');

--
-- Table structure for table `sec_users_groups`
--

CREATE TABLE `sec_users_groups` (
  `login` varchar(255) NOT NULL,
  `group_id` int NOT NULL,
  PRIMARY KEY (`login`,`group_id`),
  KEY `sec_users_groups_ibfk_2` (`group_id`),
  CONSTRAINT `sec_users_groups_ibfk_1` FOREIGN KEY (`login`) REFERENCES `sec_users` (`login`) ON DELETE CASCADE,
  CONSTRAINT `sec_users_groups_ibfk_2` FOREIGN KEY (`group_id`) REFERENCES `sec_groups` (`group_id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;

--
-- Dumping data for table `sec_users_groups`
--

INSERT INTO `sec_users_groups` VALUES ('admin',1),('agus',2),('elsa',2),('facu',2),('sergio',2),('tuky',3);

--
-- Table structure for table `stock`
--

CREATE TABLE `stock` (
  `art_id` varchar(6) NOT NULL,
  `cantidad` int NOT NULL,
  `cliweb` int NOT NULL,
  `rbro_id` int NOT NULL,
  `sbro_id` int NOT NULL,
  `marca_id` int NOT NULL,
  PRIMARY KEY (`art_id`,`cliweb`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `stock`
--


--
-- Table structure for table `subrubros`
--

CREATE TABLE `subrubros` (
  `id` int NOT NULL,
  `rbro_id` int NOT NULL,
  `descripcion` varchar(60) NOT NULL,
  `cliweb` int NOT NULL,
  PRIMARY KEY (`id`,`rbro_id`,`cliweb`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `subrubros`
--

INSERT INTO `subrubros` VALUES (0,0,'GEL',2),(1,0,'LIQUIDOS',2),(1,21,'GENERICO',2),(1,27,'GENERICO',2),(1,33,'GENERICO',2),(1,34,'GENERICO',2),(1,35,'GENERICO',2),(1,37,'GENERICO',2),(1,39,'GENERICO',2),(1,40,'GENERICO',2),(1,45,'GENERICO',2),(1,48,'GENERICO',2),(1,50,'GENERICO',2),(1,52,'GENERICO',2),(1,53,'GENERICO',2),(1,54,'GENERICO',2),(1,55,'GENERICO',2),(1,61,'GENERICO',2),(1,62,'GENERICO',2),(1,64,'GENERICO',2),(1,66,'GENERICO',2),(1,67,'GENERICO',2),(1,68,'GENERICO',2),(1,69,'GENERICO',2),(1,70,'GENERICO',2),(1,71,'GENERICO',2),(1,72,'GENERICO',2),(1,73,'GENERICO',2),(1,74,'GENERICO',2),(1,76,'GENERICO',2),(1,77,'GENERICO',2),(1,78,'GENERICO',2),(1,79,'GENERICO',2),(1,80,'GENERICO',2),(2,0,'IODADO',2),(2,33,'GENERICO',2),(2,34,'GENERICO',2),(2,35,'GENERICO',2),(2,37,'GENERICO',2),(2,40,'GENERICO',2),(2,48,'GENERICO',2),(2,52,'GENERICO',2),(2,54,'GENERICO',2),(2,55,'GENERICO',2),(2,61,'GENERICO',2),(2,64,'GENERICO',2),(2,71,'GENERICO',2),(2,72,'GENERICO',2),(2,73,'GENERICO',2),(2,74,'GENERICO',2),(2,76,'GENERICO',2),(3,0,'ISOPROPILICO',2),(3,33,'GENERICO',2),(3,34,'GENERICO',2),(3,35,'GENERICO',2),(3,54,'GENERICO',2),(3,55,'GENERICO',2),(3,61,'GENERICO',2),(3,71,'GENERICO',2),(3,73,'GENERICO',2),(3,74,'GENERICO',2),(4,0,'96% VOL',2),(4,33,'GENERICO',2),(4,61,'GENERICO',2),(4,71,'GENERICO',2),(4,73,'GENERICO',2),(4,74,'GENERICO',2),(5,0,'70% VOL',2),(5,33,'GENERICO',2),(5,61,'GENERICO',2),(5,71,'GENERICO',2),(5,73,'GENERICO',2),(6,1,'ELASTICA CON BALLENAS',2),(6,61,'GENERICO',2),(6,71,'GENERICO',2),(7,0,'ELASTICAS SIN BALLENES',2),(7,61,'GENERICO',2),(8,1,'NEOPRENE CON BALLENA',2),(8,61,'GENERICO',2),(9,2,'ELASTICAS',2),(9,61,'GENERICO',2),(10,2,'NEOPRENE CON ABROJOS',2),(10,61,'GENERICO',2),(11,2,'NEOPRENE ABIERTAS',2),(11,61,'GENERICO',2),(12,2,'NEOPRENE BOOMERANG SIN DEDO',2),(12,61,'GENERICO',2),(13,2,'NEOPRENE BOOMERANG CON DEDO',2),(13,61,'GENERICO',2),(14,0,'NEOPRENE BOOMERANG INMOV. DE DEDOS',2),(15,1,'ELASTICA SIN BALLENA',2),(16,1,'NEOPRENE SIN BALLENA',2),(17,1,'TUBOLARES',2),(18,3,'ELASTICAS',2),(19,3,'NEOPRENE ',2),(20,0,'ACORDONADA',2),(20,3,'GENERICO',2),(21,3,'GENERICO',2),(21,4,'ELASTICA',2),(22,3,'GENERICO',2),(22,4,'NEOPRENE',2),(23,3,'GENERICO',2),(23,4,'CINCHA ROTULEANA',2),(24,5,'ELASTICA',2),(25,5,'NEOPRENE',2),(26,6,'NEOPRENE',2),(27,6,'GENERICO',2),(27,7,'NEOPRENE',2),(28,7,'BRIN',2),(29,7,'CADERA',2),(30,7,'ANTIRONQUIDO',2),(31,7,'GENERICO',2),(31,8,'NEOPRENE',2),(32,9,'ELASTICA ',2),(33,9,'COBAN',2),(34,9,'DEPORTIVA',2),(35,9,'KINETAPING',2),(36,9,'CABRIC',2),(37,9,'ELASTICIDAD CORTA',2),(38,9,'YESO',2),(39,9,'OVATA',2),(40,10,'NEOPRENE',2),(41,11,'TERMICAS',2),(42,12,'MUÑECA',2),(43,12,'MUÑECA Y PULGAR',2),(44,12,'DEDOS',2),(45,12,'RODILLA',2),(46,12,'TOBILLO',2),(47,12,'FERULAS DE STARC',2),(48,12,'FERULA DIGITAL',2),(49,13,'UNIVERSAL',2),(50,13,'ELASTICA',2),(51,13,'NEOPRENE',2),(52,13,'GENERICO',2),(52,14,'TERAPEUTICA',2),(53,14,'GENERICO',2),(53,15,'COLLAR CERVICAL',2),(54,14,'GENERICO',2),(54,15,'FILADELFIA',2),(55,15,'RESCATE',2),(56,15,'GENERICO',2),(56,16,'TOALLAS',2),(57,16,'ORTOPEDICAS',2),(58,16,'SILICONAS',2),(59,17,'DEDALES',2),(60,17,'TUBO',2),(61,17,'TABA',2),(62,17,'PLANO',2),(63,17,'DOBLE T',2),(64,17,'DEDO MARTILLO',2),(65,17,'PROTECTOR DE JUANETE',2),(66,17,'PROTECTOR DUO',2),(67,17,'TALONERA',2),(68,17,'ALMOHADILLA PLANTAR',2),(69,17,'PARCHES',2),(70,18,'FRIO CALOR',2),(71,18,'ECOGRAFO',2),(72,18,'CRIOGENO',2),(73,18,'TERMICO',2),(74,19,'DORSO LUMBAR',2),(75,19,'SACRO LUMBAR',2),(76,19,'ESPALDERA',2),(77,20,'CON FAJA',2),(78,20,'BIETNAM',2),(79,20,'VALPOU',2),(80,20,'GENERICO',2),(80,22,'ANATOMICOS',2),(81,22,'INGUINAL',2),(82,23,'PARCHES',2),(83,24,'DELFIN',2),(84,24,'MANUALES',2),(85,25,'ULTRASONICOS',2),(86,25,'A PISTON',2),(87,25,'PROFESIONAL',2),(88,26,'MECANICA',2),(89,26,'DIGITAL',2),(90,28,'SERVICAL',2),(91,28,'RETANGULAR',2),(92,28,'CINTURA',2),(93,28,'SMALL',2),(94,28,'LARGE',2),(95,29,'ANEROIDES',2),(96,29,'DIGITAL',2),(97,29,'DE PIE',2),(98,29,'DE PARED',2),(99,29,'DE MESA',2),(100,30,'SIMPLE',2),(101,30,'DOBLE',2),(102,30,'RAPAPPORT',2),(103,30,'PEDIATRICO',2),(104,30,'LITTMAN',2),(105,30,'GENERICO',2),(105,31,'DIGITAL',2),(106,31,'MERCURIO',2),(107,31,'HELADERA',2),(108,31,'PINCHA CARNE',2),(109,31,'LABORATORIO',2),(110,32,'METATARSAL',2),(111,32,'ELASTICAS',2),(112,32,'GENERICO',2),(112,44,'DE TENISTA / GOLFISTA',2),(113,32,'GENERICO',2),(113,44,'GENERICO',2),(114,32,'GENERICO',2),(114,44,'GENERICO',2),(115,32,'GENERICO',2),(115,44,'GENERICO',2),(116,32,'GENERICO',2),(116,46,'AUDITIVOS',2),(117,47,'AUDITIVO',2),(118,47,'GENERICO',2),(118,49,'FITNESS',2),(119,49,'LATEX',2),(120,49,'NITRILO',2),(121,49,'VINILO',2),(122,49,'ESTERILES',2),(123,16,'ESTADINA',2),(124,16,'GENERICO',2),(125,56,'EPIDERMICO',2),(126,57,'ANTIDESLIZANTE',2),(127,63,'CON PROLONGADOR',2),(128,61,'NELATON',2),(129,61,'LATEX',2),(130,61,'SILICONA',2),(131,31,'CLINICOS',2),(132,157,'2 VIAS LATEX',2),(133,157,'2 VIAS SILICONA',2),(134,157,'3 VIAS LATEX',2),(135,157,'3 VIAS SILICONA',2),(136,157,'2 VIAS RUSCH',2),(137,131,'1ML',2),(138,131,'3ML',2),(139,131,'5ML',2),(140,131,'10ML',2),(141,131,'20ML',2),(142,131,'60ML',2),(143,131,'THOMEY',2),(144,131,'BONEAU',2),(145,131,'VIDRIO',2),(146,160,'13/3',2),(147,160,'13/4',2),(148,160,'16/5',2),(149,160,'25/8',2),(150,160,'40/8',2),(151,160,'40/12',2),(152,160,'50/8',2),(153,160,'30/12',2),(154,160,'25/7',2),(155,161,'45X30',2),(156,161,'50X30',2),(157,161,'25X57',2),(158,161,'60X30',2),(159,161,'MONITOREO FETAL',2),(160,161,'90X30',2),(161,160,'80X20',2),(162,162,'C/B N° 3.5',2),(163,162,'C/B N° 4',2),(164,162,'C/B N° 4.5',2),(165,162,'C/B N° 5',2),(166,162,'C/B N° 5.5',2),(167,162,'C/B N° 6',2),(168,162,'C/B N° 6.5',2),(169,162,'C/B N° 7',2),(170,162,'C/B N° 7.5',2),(171,162,'C/B N° 8',2),(172,162,'C/B N° 8.5',2),(173,162,'C/B N° 9',2),(174,162,'C/B N° 9.5',2),(175,162,'C/B N° 10',2),(176,162,'SIN BALON DEL 2.5 AL 10',2),(177,184,'6X7',2),(178,184,'10X12',2),(179,184,'10X25',2),(180,185,'EXTRA THIN 10X10',2),(181,186,'5700/',2),(182,187,'5900',2),(183,191,'N° 20',2),(184,191,'N° 30',2),(185,191,'N° 40',2),(186,191,'N° 50',2),(187,191,'N° 60',2),(188,191,'N° 70',2),(189,191,'N° 80',2),(190,191,'N° 90',2),(191,191,'N° 100',2),(192,192,'14.5X3.5',2);

--
-- Table structure for table `tarjeta_credito`
--

CREATE TABLE `tarjeta_credito` (
  `id` int NOT NULL AUTO_INCREMENT,
  `banco` varchar(40) NOT NULL,
  `nro_tarj` varchar(19) NOT NULL,
  `fec_vto` date NOT NULL,
  `importe` decimal(9,2) NOT NULL,
  `dni` varchar(20) DEFAULT NULL,
  `idfactura` int NOT NULL,
  `idcaja` int NOT NULL,
  `fecha_pago` date NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tarjeta_credito`
--


--
-- Table structure for table `transferencias`
--

CREATE TABLE `transferencias` (
  `id` int NOT NULL AUTO_INCREMENT,
  `fecha` date NOT NULL,
  `sucursal` varchar(30) NOT NULL,
  `banco` varchar(30) NOT NULL,
  `importe` decimal(14,2) NOT NULL,
  `observacion` varchar(200) DEFAULT NULL,
  `idfactura` int NOT NULL,
  `idcaja` int NOT NULL,
  `fecha_pago` date NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `transferencias`
--


--
-- Temporary view structure for view `v_articulos`
--

/*!50001 DROP VIEW IF EXISTS `v_articulos`*/;
/*!50001 CREATE VIEW `v_articulos` AS SELECT 
 1 AS `id`,
 1 AS `marca_id`,
 1 AS `desc_mar`,
 1 AS `rbro_id`,
 1 AS `desc_rbro`,
 1 AS `srbro_id`,
 1 AS `desc_corta`,
 1 AS `desc_art`,
 1 AS `cliweb`,
 1 AS `codigo_barra`,
 1 AS `precio_compra`,
 1 AS `precio_venta`,
 1 AS `precio_tarjeta`,
 1 AS `precio_ctacte`*/;

--
-- Temporary view structure for view `v_cab_ctacte`
--

/*!50001 DROP VIEW IF EXISTS `v_cab_ctacte`*/;
/*!50001 CREATE VIEW `v_cab_ctacte` AS SELECT 
 1 AS `id_cli`,
 1 AS `apeynom`,
 1 AS `direccion`,
 1 AS `cta_cte`,
 1 AS `cuit`,
 1 AS `telefono`,
 1 AS `email`,
 1 AS `celular`,
 1 AS `cliweb`,
 1 AS `tiene_ctacte`,
 1 AS `tp_doc`,
 1 AS `id_ctacte`,
 1 AS `total_deuda`,
 1 AS `cweb`,
 1 AS `tipo_cuenta`*/;

--
-- Temporary view structure for view `v_cond_iva`
--

/*!50001 DROP VIEW IF EXISTS `v_cond_iva`*/;
/*!50001 CREATE VIEW `v_cond_iva` AS SELECT 
 1 AS `id`,
 1 AS `descripcion`,
 1 AS `cuit`,
 1 AS `cliweb`,
 1 AS `usr_conexion`,
 1 AS `punto_venta`*/;

--
-- Temporary view structure for view `v_cta_cte`
--

/*!50001 DROP VIEW IF EXISTS `v_cta_cte`*/;
/*!50001 CREATE VIEW `v_cta_cte` AS SELECT 
 1 AS `id`,
 1 AS `apeynom`,
 1 AS `cta_cte`,
 1 AS `idfacturas`,
 1 AS `numero_factura`,
 1 AS `fecha_factura`,
 1 AS `cuit_comprador`,
 1 AS `importe_total`,
 1 AS `cliweb`*/;

--
-- Temporary view structure for view `v_det_cta_cte`
--

/*!50001 DROP VIEW IF EXISTS `v_det_cta_cte`*/;
/*!50001 CREATE VIEW `v_det_cta_cte` AS SELECT 
 1 AS `ctacte_id`,
 1 AS `id_fc`,
 1 AS `fecha_deuda`,
 1 AS `fecha_vto`,
 1 AS `debe`,
 1 AS `haber`,
 1 AS `saldo`,
 1 AS `fecha_pago`,
 1 AS `n_item`,
 1 AS `tipo_mov`,
 1 AS `numero_factura`,
 1 AS `cliweb`*/;

--
-- Temporary view structure for view `v_deta_fc`
--

/*!50001 DROP VIEW IF EXISTS `v_deta_fc`*/;
/*!50001 CREATE VIEW `v_deta_fc` AS SELECT 
 1 AS `descripcion`,
 1 AS `cantidad`,
 1 AS `precio_unitario`,
 1 AS `subtotal`,
 1 AS `iva`,
 1 AS `total`,
 1 AS `idfactura`,
 1 AS `art_id`*/;

--
-- Temporary view structure for view `v_detctacte_pago`
--

/*!50001 DROP VIEW IF EXISTS `v_detctacte_pago`*/;
/*!50001 CREATE VIEW `v_detctacte_pago` AS SELECT 
 1 AS `cuit_vendedor`,
 1 AS `id_ctacte`,
 1 AS `id_fc`,
 1 AS `descripcion`,
 1 AS `fecha_deuda`,
 1 AS `fecha_vto`,
 1 AS `debe`,
 1 AS `haber`,
 1 AS `saldo`,
 1 AS `fecha_pago`,
 1 AS `n_item`,
 1 AS `tipo_mov`,
 1 AS `numero_factura`,
 1 AS `cliweb`*/;

--
-- Temporary view structure for view `v_facturas`
--

/*!50001 DROP VIEW IF EXISTS `v_facturas`*/;
/*!50001 CREATE VIEW `v_facturas` AS SELECT 
 1 AS `idfacturas`,
 1 AS `numero_factura`,
 1 AS `tipo_comprobante`,
 1 AS `fecha_factura`,
 1 AS `descripcion`,
 1 AS `importe_total`*/;

--
-- Temporary view structure for view `v_padron_articulos`
--

/*!50001 DROP VIEW IF EXISTS `v_padron_articulos`*/;
/*!50001 CREATE VIEW `v_padron_articulos` AS SELECT 
 1 AS `id`,
 1 AS `marca_id`,
 1 AS `marc_desc`,
 1 AS `rbro_id`,
 1 AS `rbro_desc`,
 1 AS `descripcion`,
 1 AS `desc_corta`,
 1 AS `fecha_baja`,
 1 AS `motivo`,
 1 AS `cliweb`,
 1 AS `codigo_barra`,
 1 AS `codigo_barra_generado`,
 1 AS `cantidad_minima`,
 1 AS `cantidad_maxima`,
 1 AS `precio_venta`,
 1 AS `precio_compra`,
 1 AS `precio_tarjeta`,
 1 AS `precio_ctacte`,
 1 AS `srbro_id`*/;

--
-- Dumping routines for database 'lypcom_medical'
--
/*!50003 DROP FUNCTION IF EXISTS `f_alin_importe` */;
DELIMITER ;;
CREATE DEFINER=`dba_user`@`%` FUNCTION `f_alin_importe`(pn_importe decimal(14,2)) RETURNS decimal(14,2)
    NO SQL
BEGIN
select CONCAT(REPEAT( ' ', 14 - LENGTH( pn_importe )), pn_importe )
  INTO @valor;
	RETURN @valor;
END ;;
DELIMITER ;
/*!50003 DROP FUNCTION IF EXISTS `validar_cuit` */;
DELIMITER ;;
CREATE DEFINER=`dba_user`@`%` FUNCTION `validar_cuit`(
CUIT BIGINT
) RETURNS varchar(18) CHARSET latin1
    DETERMINISTIC
BEGIN

DECLARE RES, DIG, NUM BIGINT;
DECLARE i INT;


IF LENGTH(CUIT) != 11 OR SUBSTR(CUIT, 1, 2) = '00' THEN
RETURN 0;
END IF;

SET RES = 0;
SET i = 1;
WHILE i < 11 DO
SET NUM = (SUBSTR(CUIT, I, 1));

IF (i = 1 OR i = 7) THEN
SET RES = RES + NUM * 5;
ELSEIF (I = 2 OR I = 8) THEN
SET RES = RES + NUM * 4;
ELSEIF (I = 3 OR I = 9) THEN
SET RES = RES + NUM * 3;
ELSEIF (I = 4 OR I = 10) THEN
SET RES = RES + NUM * 2;
ELSEIF (I = 5) THEN
SET RES = RES + NUM * 7;
ELSEIF (I = 6) THEN
SET RES = RES + NUM * 6;
END IF;
SET i = i+1;
END WHILE;


SET DIG = 11 - MOD(RES,11);
IF DIG = 11 THEN
SET DIG = 0;
END IF;

IF DIG = (SUBSTR(CUIT,11,1)) THEN
RETURN 1;
ELSE
RETURN 0;
END IF;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `p_actualiza_cabecera_fac` */;
DELIMITER ;;
CREATE DEFINER=`dba_user`@`%` PROCEDURE `p_actualiza_cabecera_fac`(IN pn_idfactura INT,IN pn_porc_iva DECIMAL(14,2),IN pn_tp_comprobante INT,IN pn_cliweb INT)
BEGIN
DECLARE n_total            DECIMAL(14,2) DEFAULT 0;
DECLARE n_total_iibb       DECIMAL(14,2) DEFAULT 0;
DECLARE n_total_iva        DECIMAL(14,2) DEFAULT 0;
DECLARE n_total_no_gravado DECIMAL(14,2) DEFAULT 0;
DECLARE n_total_gravado    DECIMAL(14,2) DEFAULT 0;
DECLARE n_total_iva21      DECIMAL(14,2) DEFAULT 0;
DECLARE n_total_iva105     DECIMAL(14,2) DEFAULT 0;
DECLARE n_total_iva27      DECIMAL(14,2) DEFAULT 0;
DECLARE n_total_cab        DECIMAL(14,2) DEFAULT 0;
DECLARE n_ctacte           INTEGER                ;
DECLARE d_fecha            DATE                   ;
DECLARE n_nro_fac          INTEGER                ;
DECLARE n_modo_pago        INTEGER                ;

     SELECT ifnull(sum(round(iva,2)),0),ifnull(sum(round(iibb,2)),0),ifnull(sum(round(subtotal,2)),0)
	 INTO   n_total_iva, n_total_iibb, n_total
     FROM lypcom_medical.factura_detalle
     WHERE idfactura = pn_idfactura;

     CASE pn_porc_iva
		WHEN  -1 THEN
		   SET n_total_no_gravado = n_total_no_gravado + n_total;
		WHEN 0 THEN
		   IF pn_tp_comprobante in(6,7,8,9) THEN
			  SET n_total_gravado = round(n_total_gravado +  n_total/1.21,2);
			  SET n_total_iva21   = round(n_total_iva21 +   (n_total/1.21)*0.21,2);  
		   ELSEIF pn_tp_comprobante in(11,12,13,14) THEN	
			  SET n_total_gravado = round(n_total_gravado +  n_total,2);
		   END IF;	
		WHEN 0.105 THEN
			SET n_total_iva105  = n_total_iva105 +  n_total_iva;
			SET n_total_gravado = n_total_gravado +  n_total;
		WHEN 0.210 THEN
			SET n_total_iva21   = n_total_iva21 +  n_total_iva;
			SET n_total_gravado = n_total_gravado +  n_total;	
		WHEN 0.270 THEN
		    SET n_total_iva27 = n_total_iva27 +  n_total_iva;
			SET n_total_gravado = n_total_gravado +  n_total;
	 END CASE;
	 SET n_total_cab = n_total_no_gravado + n_total_gravado + n_total_iva105 + n_total_iva21 + n_total_iva27;
	 
	 UPDATE facturas
	 set    importe_no_gravado = n_total_no_gravado,
	        importe_gravado    = n_total_gravado,
            importe_total      = n_total_cab,
	        importe_iva105     = n_total_iva105,
	        importe_iva21      = n_total_iva21,
	        importe_iva27      = n_total_iva27,
	        importe_iva        = n_total_iva21
	 WHERE   idfacturas = pn_idfactura
	 AND     cliweb     = pn_cliweb;		
	 
	 SELECT id_ctacte,fecha_factura,numero_factura, modo_pago
	 INTO   n_ctacte, d_fecha, n_nro_fac,n_modo_pago
     FROM facturas
     WHERE idfacturas = pn_idfactura;
	 
	 IF n_modo_pago = 4 THEN 
        call p_factura_ctacte(n_ctacte,pn_tp_comprobante,pn_idfactura,d_fecha,n_total_cab,n_nro_fac,pn_cliweb);
     END IF;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `p_actualiza_cabecera_re` */;
DELIMITER ;;
CREATE DEFINER=`dba_user`@`%` PROCEDURE `p_actualiza_cabecera_re`(IN pn_idfactura INT,IN pn_porc_iva DECIMAL(14,2),IN pn_tp_comprobante INT,IN pn_cliweb INT)
BEGIN
DECLARE n_total            DECIMAL(14,2) DEFAULT 0;
DECLARE n_total_iibb       DECIMAL(14,2) DEFAULT 0;
DECLARE n_total_iva        DECIMAL(14,2) DEFAULT 0;
DECLARE n_total_no_gravado DECIMAL(14,2) DEFAULT 0;
DECLARE n_total_gravado    DECIMAL(14,2) DEFAULT 0;
DECLARE n_total_iva21      DECIMAL(14,2) DEFAULT 0;
DECLARE n_total_iva105     DECIMAL(14,2) DEFAULT 0;
DECLARE n_total_iva27      DECIMAL(14,2) DEFAULT 0;
DECLARE n_total_cab        DECIMAL(14,2) DEFAULT 0;
DECLARE n_ctacte           INTEGER                ;
DECLARE d_fecha            DATE                   ;
DECLARE n_nro_fac          INTEGER                ;
DECLARE n_modo_pago        INTEGER                ;

     SELECT ifnull(sum(round(iva,2)),0),ifnull(sum(round(iibb,2)),0),ifnull(sum(round(subtotal,2)),0)
	 INTO   n_total_iva, n_total_iibb, n_total
     FROM lypcom_medical.factura_detalle
     WHERE idfactura = pn_idfactura;

     CASE pn_porc_iva
		WHEN  -1 THEN
		   SET n_total_no_gravado = n_total_no_gravado + n_total;
		WHEN 0 THEN
		   IF pn_tp_comprobante = 21 THEN
			  SET n_total_gravado = round(n_total_gravado +  n_total/1.21,2);
			  SET n_total_iva21   = round(n_total_iva21 +   (n_total/1.21)*0.21,2);  
		   ELSEIF pn_tp_comprobante = 22 THEN	
			  SET n_total_gravado = round(n_total_gravado +  n_total,2);
		   ELSEIF pn_tp_comprobante = 24 THEN
			  SET n_total_gravado = round(n_total_gravado +  n_total,2);
		   END IF;	
		WHEN 0.105 THEN
			SET n_total_iva105  = n_total_iva105 +  n_total_iva;
			SET n_total_gravado = n_total_gravado +  n_total;
		WHEN 0.210 THEN
			SET n_total_iva21   = n_total_iva21 +  n_total_iva;
			SET n_total_gravado = n_total_gravado +  n_total;	
		WHEN 0.270 THEN
		    SET n_total_iva27 = n_total_iva27 +  n_total_iva;
			SET n_total_gravado = n_total_gravado +  n_total;
	 END CASE;
	 SET n_total_cab = n_total_no_gravado + n_total_gravado + n_total_iva105 + n_total_iva21 + n_total_iva27;
	 
	 UPDATE facturas
	 set    importe_no_gravado = n_total_no_gravado,
	        importe_gravado    = n_total_gravado,
            importe_total      = n_total_cab,
	        importe_iva105     = n_total_iva105,
	        importe_iva21      = n_total_iva21,
	        importe_iva27      = n_total_iva27,
	        importe_iva        = n_total_iva21
	 WHERE   idfacturas = pn_idfactura
	 AND     cliweb     = pn_cliweb;		
	 
	 SELECT id_ctacte,fecha_factura,numero_factura, modo_pago
	 INTO   n_ctacte, d_fecha, n_nro_fac,n_modo_pago
     FROM facturas
     WHERE idfacturas = pn_idfactura;
	 
	 IF n_modo_pago = 4 THEN 
        call p_remito_ctacte(n_ctacte,pn_tp_comprobante,pn_idfactura,d_fecha,n_total_cab,n_nro_fac,pn_cliweb);
     END IF;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `p_act_cabecera` */;
DELIMITER ;;
CREATE DEFINER=`dba_user`@`%` PROCEDURE `p_act_cabecera`(IN `pn_idfactura` INT, IN `pn_cliweb` INT,IN pn_tipo_fact INT)
BEGIN
DECLARE n_total               DECIMAL(14,2)          ;
    DECLARE n_grabado             DECIMAL(14,2)          ;
    DECLARE n_iva                 DECIMAL(14,2)          ;
  select importe_total,(importe_gravado/1.21),(importe_total - (importe_gravado/1.21)) 
  	INTO   n_total, n_grabado, n_iva
      from facturas 
      where idfacturas = pn_idfactura
  	and   cliweb     = pn_cliweb;
  IF pn_tipo_fact  in(1,6,20,21,22) THEN  	
    UPDATE facturas
  	SET    importe_total   = n_total,
  	       importe_gravado = n_grabado,
  		   importe_iva21   = n_iva,
  		   importe_iva     = n_iva
  	WHERE  idfacturas = pn_idfactura
  	AND    cliweb     = pn_cliweb;
  ELSE
    UPDATE facturas
  	SET    importe_total   = n_total,
  	       importe_gravado = n_total,
  		     importe_iva21   = 0,
  		     importe_iva     = 0
  	WHERE  idfacturas = pn_idfactura
  	AND    cliweb     = pn_cliweb;
  END IF;  
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `p_anularemito_ctacte` */;
DELIMITER ;;
CREATE DEFINER=`dba_user`@`%` PROCEDURE `p_anularemito_ctacte`(IN `pn_idfactura` INT, IN `pn_total` DECIMAL(14,2), IN `pn_cliweb` INT)
BEGIN
DECLARE n_ctacte      INT                    ;

	 SELECT distinct id_ctacte
	 INTO   n_ctacte
	 FROM   det_cta_cte
	 where id_fc = pn_idfactura
	 AND    cliweb = pn_cliweb;
	 
     UPDATE cta_cte
	 SET    total_deuda = total_deuda - pn_total
	 WHERE  id = n_ctacte
	 AND    cliweb = pn_cliweb;
	 
	 DELETE FROM det_cta_cte
	 where id_fc = pn_idfactura
	 AND    cliweb = pn_cliweb; 
   
   DELETE FROM factura_detalle
   WHERE  idfactura = pn_idfactura;
   
   DELETE FROM facturas
   WHERE  idfacturas = pn_idfactura
   AND    cliweb     = pn_cliweb;     
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `p_borraremito_ctacte` */;
DELIMITER ;;
CREATE DEFINER=`dba_user`@`%` PROCEDURE `p_borraremito_ctacte`(IN `pn_idfactura` INT, IN `pn_total` DECIMAL(14,2), IN `pn_cliweb` INT)
BEGIN
DECLARE n_ctacte      INT                    ;

	 SELECT distinct id_ctacte
	 INTO   n_ctacte
	 FROM   det_cta_cte
	 where id_fc = pn_idfactura
	 AND    cliweb = pn_cliweb;
	 
     UPDATE cta_cte
	 SET    total_deuda = total_deuda - pn_total
	 WHERE  id = n_ctacte
	 AND    cliweb = pn_cliweb;
	 
	 DELETE FROM det_cta_cte
	 where id_fc = pn_idfactura
	 AND    cliweb = pn_cliweb;  
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `p_factura_ctacte` */;
DELIMITER ;;
CREATE DEFINER=`dba_user`@`%` PROCEDURE `p_factura_ctacte`(IN pn_ctacte INT, IN pn_tp_comprobante INT, IN pn_idfactura INT, IN pd_fecha DATE,
                                                   IN pn_total DECIMAL(14,2), IN pn_nrofac INT, IN pn_cliweb INT)
BEGIN
DECLARE n_valor          INTEGER                ;
DECLARE n_item           INTEGER                ;
DECLARE n_saldo          DECIMAL(14,2) DEFAULT 0;
DECLARE d_fec_fc         DATE                   ;
DECLARE d_fec_vto        DATE                   ;
DECLARE n_total          DECIMAL(14,2) DEFAULT 0;
DECLARE tp_comprobante   Varchar(2);
         set d_fec_fc = DATE_FORMAT(pd_fecha,'%Y-%m-%d');
		 SELECT count(*)
		 into   n_valor
		 FROM   det_cta_cte
		 WHERE  id_ctacte = pn_ctacte
		 AND    id_fc     = pn_idfactura
		 AND    cliweb    = pn_cliweb;
		 
		 IF n_valor > 0 THEN
            UPDATE det_cta_cte
			SET    debe =  pn_total,
			       saldo =  pn_total
			WHERE  id_ctacte = pn_ctacte
			AND    id_fc     = pn_idfactura;	            
		 ELSE	 
       IF pn_tp_comprobante not in(21,22,24) THEN
          SET tp_comprobante = 'FC';
       ELSE
          SET tp_comprobante = 'RE';
       END IF;   
			 select DATE_ADD(d_fec_fc, INTERVAL 1 MONTH) into d_fec_vto;
			 INSERT INTO det_cta_cte(
									 id_ctacte  ,
									 n_item     ,
									 id_fc      ,
									 fecha_deuda,
									 fecha_vto  ,
									 debe       ,
									 saldo      ,
									 tipo_mov   ,
									 numero_factura,
									 cliweb   )
								 VALUES(
										pn_ctacte,
										1       ,
										pn_idfactura,
										d_fec_fc,
										d_fec_vto,
										pn_total,
										pn_total,
										tp_comprobante,
										pn_nrofac,
										pn_cliweb
									   );	     
		  END IF;	
		  
		  SELECT sum(saldo)
		  INTO   n_total
		  FROM   det_cta_cte
		  where  id_ctacte = pn_ctacte;
		  
		  UPDATE cta_cte
		  SET    total_deuda = n_total
		  WHERE  id = pn_ctacte
		  AND    cliweb = pn_cliweb;		  

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `p_fc_nc` */;
DELIMITER ;;
CREATE DEFINER=`dba_user`@`%` PROCEDURE `p_fc_nc`(IN pn_idnc INT,IN pn_idfc INT)
    NO SQL
BEGIN
    DECLARE n_tipo_compr          INT                    ;
    DECLARE n_ctacte              INT                    ;
    DECLARE n_total_fc            DECIMAL(14,2)          ;
    DECLARE n_nrofc               INT DEFAULT 0          ;
	DECLARE d_fecfc               DATE                   ;
	DECLARE n_modo                INT                    ;
	DECLARE v_descripcion         VARCHAR(200)           ;
	DECLARE n_nronc               INT                    ;
	
	SELECT numero_factura,
	       date_format(fecha_factura,'%Y-%m-%d' ),
           tipo_comprobante,
           importe_total ,
           id_ctacte,
           modo_pago 
    INTO   n_nronc,
           d_fecfc,
           n_tipo_compr,
           n_total_fc  ,
           n_ctacte,
           n_modo		   
    FROM   facturas 
	WHERE  idfacturas = pn_idnc;
    
    IF n_modo = 4 THEN
	
	   SELECT numero_factura
	   INTO   n_nrofc
     FROM   facturas
	   WHERE  idfacturas = pn_idfc;
	   
	   SELECT CONCAT('NC Nro.:',n_nronc,' realizada sobre la FC. Nro.: ',n_nrofc) INTO v_descripcion;
	   
	   UPDATE det_cta_cte
	   set saldo = 0
	   where id_fc = pn_idfc;
	   
	   INSERT INTO det_cta_cte(id_ctacte,
                               id_fc    ,
                               fecha_deuda,
                               haber,
                               saldo,
                               fecha_pago,
                               n_item,
                               tipo_mov,
                               numero_factura,
                               cliweb,
                               descripcion)
					    VALUES(n_ctacte,
                               pn_idnc ,
                               d_fecfc ,
                               n_total_fc *-1,
                               0,
                               d_fecfc,
							                 2,
                               'NC',
                               n_nronc,
                               2,
                               v_descripcion);
    UPDATE cta_cte
    SET    total_deuda = total_deuda - n_total_fc
    where  id = n_ctacte
	AND    cliweb = 2;	
	END IF;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `p_hoja_sticker` */;
DELIMITER ;;
CREATE DEFINER=`dba_user`@`%` PROCEDURE `p_hoja_sticker`(IN pv_codbar VARCHAR(60),IN pv_descripcion VARCHAR(60),IN pn_fila INT,IN pn_columna INT,
                                                IN pn_cantidad INT)
BEGIN
DECLARE n_valor   INT           ;
DECLARE n_fila    INT DEFAULT  0; 
DECLARE n_hoja    INT DEFAULT  0;    
	SELECT max(fila),max(hoja)
	INTO   n_valor,n_hoja
	FROM   hoja_sticker
	where  fila = pn_fila;
IF n_valor > 0 THEN	  
   IF n_valor = pn_fila THEN
      IF pn_columna = 1 THEN
		 IF pn_cantidad = 1 THEN
			 UPDATE hoja_sticker 
	         SET    columna_1 = pv_codbar,
	                descri_1  = pv_descripcion
		     WHERE  fila = pn_fila
			 AND    hoja = n_hoja;			
		 ELSEIF pn_cantidad = 2 THEN
			 UPDATE hoja_sticker 
	         SET    columna_1 = pv_codbar,
	                descri_1  = pv_descripcion,
					columna_2 = pv_codbar,
					descri_2  = pv_descripcion
		     WHERE  fila = pn_fila
			 AND    hoja = n_hoja;
		 ELSEIF pn_cantidad = 3 THEN
			 UPDATE hoja_sticker 
	         SET    columna_1 = pv_codbar,
	                descri_1  = pv_descripcion,
					columna_2 = pv_codbar,
					descri_2  = pv_descripcion,
					columna_3 = pv_codbar,
					descri_3  = pv_descripcion
		     WHERE  fila = pn_fila
			 AND    hoja = n_hoja;
		 ELSEIF pn_cantidad = 4 THEN
			 UPDATE hoja_sticker 
	         SET    columna_1 = pv_codbar,
	                descri_1  = pv_descripcion,
					columna_2 = pv_codbar,
					descri_2  = pv_descripcion,
					columna_3 = pv_codbar,
					descri_3  = pv_descripcion,
					columna_4 = pv_codbar,
					descri_4  = pv_descripcion
		     WHERE  fila = pn_fila
			 AND    hoja = n_hoja;	 
		 END IF; 
	  ELSEIF pn_columna = 2 THEN
		 IF pn_cantidad = 1 THEN
			 UPDATE hoja_sticker 
	         SET    columna_2 = pv_codbar,
	                descri_2  = pv_descripcion
		     WHERE  fila = pn_fila
			 AND    hoja = n_hoja;	
		 ELSEIF pn_cantidad = 2 THEN
			 UPDATE hoja_sticker 
	         SET    columna_2 = pv_codbar,
	                descri_2  = pv_descripcion,
					columna_3 = pv_codbar,
					descri_3  = pv_descripcion
		     WHERE  fila = pn_fila
			 AND    hoja = n_hoja;
		 ELSEIF pn_cantidad = 3 THEN	
             UPDATE hoja_sticker 
	         SET    columna_2 = pv_codbar,
	                descri_2  = pv_descripcion,
					columna_3 = pv_codbar,
					descri_3  = pv_descripcion,
					columna_4 = pv_codbar,
					descri_4  = pv_descripcion
		     WHERE  fila = pn_fila
			 AND    hoja = n_hoja;		 
		 END IF;	 
	  ELSEIF pn_columna = 3 THEN
		 IF pn_cantidad = 1 THEN
			 UPDATE hoja_sticker 
	         SET    columna_3 = pv_codbar,
	                descri_3  = pv_descripcion
		     WHERE  fila = pn_fila
			 AND    hoja = n_hoja;	
		 ELSEIF pn_cantidad = 2 THEN
			 UPDATE hoja_sticker 
	         SET    columna_3 = pv_codbar,
	                descri_3  = pv_descripcion,
					columna_4 = pv_codbar,
					descri_4  = pv_descripcion
		     WHERE  fila = pn_fila
			 AND    hoja = n_hoja;			 
		 END IF;	
	  ELSEIF pn_columna = 4 THEN
			 UPDATE hoja_sticker 
	         SET    columna_4 = pv_codbar,
	                descri_4  = pv_descripcion
		     WHERE  fila = pn_fila
			 AND    hoja = n_hoja;	
	  END IF;
   ELSE
      IF pn_columna = 1 THEN
		 IF pn_cantidad = 1 THEN
		    INSERT INTO hoja_sticker(hoja, fila,columna_1,descri_1,cantidad)
                         VALUES(n_hoja,pn_fila,pv_codbar,pv_descripcion,pn_cantidad);	   
		 ELSEIF pn_cantidad = 2 THEN
		     INSERT INTO hoja_sticker(hoja, n_fila,columna_1,descri_1,columna_2,descri_2,cantidad)
                         VALUES(n_hoja,pn_fila,pv_codbar,pv_descripcion,pv_codbar,pv_descripcion,pn_cantidad);
		 ELSEIF pn_cantidad = 3 THEN
		     INSERT INTO hoja_sticker(hoja, fila,columna_1,descri_1,columna_2,descri_2,columna_3,descri_3,cantidad)
                         VALUES(n_hoja,pn_fila,pv_codbar,pv_descripcion,pv_codbar,pv_descripcion,pv_codbar,pv_descripcion,pn_cantidad);
		 ELSEIF pn_cantidad = 4 THEN
		     INSERT INTO hoja_sticker(hoja, fila,columna_1,descri_1,columna_2,descri_2,columna_3,descri_3,columna_4,descri_4,cantidad)
                         VALUES(n_hoja,pn_fila,pv_codbar,pv_descripcion,pv_codbar,pv_descripcion,pv_codbar,pv_descripcion,
						        pv_codbar,pv_descripcion,pn_cantidad);	
		 END IF; 
	  ELSEIF pn_columna = 2 THEN
		 IF pn_cantidad = 1 THEN
		    INSERT INTO hoja_sticker(hoja, fila,columna_2,descri_2,cantidad)
                         VALUES(n_hoja,pn_fila,pv_codbar,pv_descripcion,pn_cantidad);
		 ELSEIF pn_cantidad = 2 THEN
		     INSERT INTO hoja_sticker(hoja, fila,columna_2,descri_2,columna_3,descri_3,cantidad)
                         VALUES(n_hoja,pn_fila,pv_codbar,pv_descripcion,pv_codbar,pv_descripcion,pn_cantidad);
		 ELSEIF pn_cantidad = 3 THEN	
		     INSERT INTO hoja_sticker(hoja, fila,columna_2,descri_2,columna_3,descri_3,columna_4,descri_4,cantidad)
                         VALUES(n_hoja,pn_fila,pv_codbar,pv_descripcion,pv_codbar,pv_descripcion,pv_codbar,pv_descripcion,pn_cantidad);	
		 END IF;	 
	  ELSEIF pn_columna = 3 THEN
		 IF pn_cantidad = 1 THEN
		    INSERT INTO hoja_sticker(hoja, fila,columna_3,descri_3,cantidad)
                         VALUES(n_hoja,pn_fila,pv_codbar,pv_descripcion,pn_cantidad); 
		 ELSEIF pn_cantidad = 2 THEN
		    INSERT INTO hoja_sticker(hoja, fila,columna_3,descri_3,columna_4,descri_4,cantidad)
                         VALUES(n_hoja,pn_fila,pv_codbar,pv_descripcion,pv_codbar,pv_descripcion,pn_cantidad);
		 END IF;	
	  ELSEIF pn_columna = 4 THEN
	     INSERT INTO hoja_sticker(hoja, fila,columna_4,descri_4,cantidad)
                         VALUES(n_hoja,pn_fila,pv_codbar,pv_descripcion,pn_cantidad);
	  END IF;
       
   END IF;	
ELSE
   IF pn_columna = 1 THEN
		 IF pn_cantidad = 1 THEN
		    INSERT INTO hoja_sticker(hoja, fila,columna_1,descri_1,cantidad)
                         VALUES(n_hoja,pn_fila,pv_codbar,pv_descripcion,pn_cantidad);	   
		 ELSEIF pn_cantidad = 2 THEN
		     INSERT INTO hoja_sticker(hoja, n_fila,columna_1,descri_1,columna_2,descri_2,cantidad)
                         VALUES(n_hoja,pn_fila,pv_codbar,pv_descripcion,pv_codbar,pv_descripcion,pn_cantidad);
		 ELSEIF pn_cantidad = 3 THEN
		     INSERT INTO hoja_sticker(hoja, fila,columna_1,descri_1,columna_2,descri_2,columna_3,descri_3,cantidad)
                         VALUES(n_hoja,pn_fila,pv_codbar,pv_descripcion,pv_codbar,pv_descripcion,pv_codbar,pv_descripcion,pn_cantidad);
		 ELSEIF pn_cantidad = 4 THEN
		     INSERT INTO hoja_sticker(hoja, fila,columna_1,descri_1,columna_2,descri_2,columna_3,descri_3,columna_4,descri_4,cantidad)
                         VALUES(n_hoja,pn_fila,pv_codbar,pv_descripcion,pv_codbar,pv_descripcion,pv_codbar,pv_descripcion,
						        pv_codbar,pv_descripcion,pn_cantidad);	
		 END IF; 
   ELSEIF pn_columna = 2 THEN
		 IF pn_cantidad = 1 THEN
		    INSERT INTO hoja_sticker(hoja, fila,columna_2,descri_2,cantidad)
                         VALUES(n_hoja,pn_fila,pv_codbar,pv_descripcion,pn_cantidad);
		 ELSEIF pn_cantidad = 2 THEN
		     INSERT INTO hoja_sticker(hoja, fila,columna_2,descri_2,columna_3,descri_3,cantidad)
                         VALUES(n_hoja,pn_fila,pv_codbar,pv_descripcion,pv_codbar,pv_descripcion,pn_cantidad);
		 ELSEIF pn_cantidad = 3 THEN	
		     INSERT INTO hoja_sticker(hoja, fila,columna_2,descri_2,columna_3,descri_3,columna_4,descri_4,cantidad)
                         VALUES(n_hoja,pn_fila,pv_codbar,pv_descripcion,pv_codbar,pv_descripcion,pv_codbar,pv_descripcion,pn_cantidad);	
		 END IF;	 
   ELSEIF pn_columna = 3 THEN
		 IF pn_cantidad = 1 THEN
		    INSERT INTO hoja_sticker(hoja, fila,columna_3,descri_3,cantidad)
                         VALUES(n_hoja,pn_fila,pv_codbar,pv_descripcion,pn_cantidad); 
		 ELSEIF pn_cantidad = 2 THEN
		    INSERT INTO hoja_sticker(hoja, fila,columna_3,descri_3,columna_4,descri_4,cantidad)
                         VALUES(n_hoja,pn_fila,pv_codbar,pv_descripcion,pv_codbar,pv_descripcion,pn_cantidad);
		 END IF;	
   ELSEIF pn_columna = 4 THEN
	     INSERT INTO hoja_sticker(hoja, fila,columna_4,descri_4,cantidad)
                         VALUES(n_hoja,pn_fila,pv_codbar,pv_descripcion,pn_cantidad);
   END IF;   
END IF;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `p_remito_ctacte` */;
DELIMITER ;;
CREATE DEFINER=`dba_user`@`%` PROCEDURE `p_remito_ctacte`(IN pn_ctacte INT, IN pn_tp_comprobante INT, IN pn_idfactura INT, IN pd_fecha DATE,
                                                  IN pn_total DECIMAL(14,2), IN pn_nrofac INT, IN pn_cliweb INT)
BEGIN
DECLARE n_valor          INTEGER                ;
DECLARE n_item           INTEGER                ;
DECLARE n_saldo          DECIMAL(14,2) DEFAULT 0;
DECLARE d_fec_fc         DATE                   ;
DECLARE d_fec_vto        DATE                   ;
DECLARE n_total          DECIMAL(14,2) DEFAULT 0;

         set d_fec_fc = DATE_FORMAT(pd_fecha,'%Y-%m-%d');
		 SELECT count(*)
		 into   n_valor
		 FROM   det_cta_cte
		 WHERE  id_ctacte = pn_ctacte
		 AND    id_fc     = pn_idfactura
		 AND    cliweb    = pn_cliweb;
		 
		 IF n_valor > 0 THEN
            UPDATE det_cta_cte
			SET    debe =  pn_total,
			       saldo =  pn_total
			WHERE  id_ctacte = pn_ctacte
			AND    id_fc     = pn_idfactura;	            
		 ELSE	 
			 select DATE_ADD(d_fec_fc, INTERVAL 1 MONTH) into d_fec_vto;
			 INSERT INTO det_cta_cte(
									 id_ctacte  ,
									 n_item     ,
									 id_fc      ,
									 fecha_deuda,
									 fecha_vto  ,
									 debe       ,
									 saldo      ,
									 tipo_mov   ,
									 numero_factura,
									 cliweb   )
								 VALUES(
										pn_ctacte,
										1       ,
										pn_idfactura,
										d_fec_fc,
										d_fec_vto,
										pn_total,
										pn_total,
										'RE',
										pn_nrofac,
										pn_cliweb
									   );	     
		  END IF;	
		  
		  SELECT sum(saldo)
		  INTO   n_total
		  FROM   det_cta_cte
		  where  id_ctacte = pn_ctacte;
		  
		  UPDATE cta_cte
		  SET    total_deuda = n_total
		  WHERE  id = pn_ctacte
		  AND    cliweb = pn_cliweb;		  
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `p_rem_fac` */;
DELIMITER ;;
CREATE DEFINER=`dba_user`@`%` PROCEDURE `p_rem_fac`(IN `pn_idfactura` INT, IN `pn_cliweb` INT, IN `pn_tpcomp` INT, IN `pn_ptovta` INT, IN `pn_nro_fc` INT, IN `pv_cuit_comp` VARCHAR(45))
BEGIN
DECLARE n_tipo_compr          INT                    ;
    DECLARE n_factura             INT                    ;
    DECLARE n_ctacte              INT                    ;
    DECLARE n_total_cta           DECIMAL(14,2)          ;
    DECLARE d_fec_fc              DATE                   ;
    DECLARE d_fec_vto             DATE                   ;
    if pn_tpcomp = 20 THEN 
       set  n_tipo_compr = 1;
    ELSEIF pn_tpcomp = 21 THEN
       set  n_tipo_compr = 6;
    ELSEIF pn_tpcomp = 22 THEN -- Factura C
    set n_tipo_compr = 11;
    end if;
    INSERT INTO facturas
(punto_venta,concepto,fecha_factura,cuit_vendedor,tipo_comprobante,tipo_doc_comprador,cuit_comprador,importe_total,importe_no_gravado,importe_gravado,importe_exento,importe_iva105,importe_iva21,importe_iva27,importe_iva,porcentaje_iibb,importe_iibb,cond_iva_vendedor,cond_iva_comprador,fecha_serv_desde,fecha_serv_hasta,fecha_vto_pago,nombre_cliente,domicilio_cliente,cliweb,modo_pago,
 id_ctacte)
 select 
 punto_venta,concepto,DATE_FORMAT(CURRENT_DATE(),'%Y%m%d'),cuit_vendedor,n_tipo_compr,tipo_doc_comprador,cuit_comprador,importe_total,importe_no_gravado,importe_gravado,importe_exento,importe_iva105,importe_iva21,importe_iva27,importe_iva,porcentaje_iibb,importe_iibb,cond_iva_vendedor,cond_iva_comprador,fecha_serv_desde,fecha_serv_hasta,fecha_vto_pago,nombre_cliente,domicilio_cliente,cliweb,modo_pago,
 id_ctacte 
 from facturas 
 where idfacturas = pn_idfactura;
 
 SELECT max(idfacturas)
 INTO   n_factura
 FROM facturas
 WHERE punto_venta = pn_ptovta 
 and tipo_comprobante = n_tipo_compr;

 INSERT INTO factura_detalle 
(idfactura_detalle,descripcion,cantidad,precio_unitario,subtotal,porcentaje_iva,iva,porcentaje_iibb,iibb,total,idfactura,ctacte)
 SELECT idfactura_detalle,descripcion,cantidad,precio_unitario,subtotal,porcentaje_iva,iva,porcentaje_iibb,iibb,total,n_factura,ctacte
 FROM factura_detalle
 where idfactura = pn_idfactura;    
 
 UPDATE facturas
 SET    estado = 'F',
        id_factura_padre = n_factura
 WHERE  idfacturas       = pn_idfactura;
 
 SELECT cta_cte
 INTO   n_ctacte
 FROM    clientes
 WHERE   cliweb = pn_cliweb
 AND     cuit = pv_cuit_comp;
 
  set d_fec_fc = DATE_FORMAT(current_date(),'%Y-%m-%d');
  
 select DATE_ADD(d_fec_fc, INTERVAL 1 MONTH) into d_fec_vto; 
 
  UPDATE det_cta_cte
 SET    id_fc = n_factura,
        numero_factura = 0,
        tipo_mov = 'FC',
        fecha_deuda = d_fec_fc,
        fecha_vto   = d_fec_vto
 WHERE  id_ctacte = n_ctacte
 AND    cliweb    = pn_cliweb
 AND    id_fc     = pn_idfactura;
END ;;
DELIMITER ;

--
-- Final view structure for view `v_articulos`
--

/*!50001 DROP VIEW IF EXISTS `v_articulos`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`dba_user`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `v_articulos` AS select `art`.`id` AS `id`,`art`.`marca_id` AS `marca_id`,`mar`.`descripcion` AS `desc_mar`,`art`.`rbro_id` AS `rbro_id`,`rbro`.`descripcion` AS `desc_rbro`,`art`.`srbro_id` AS `srbro_id`,`srbro`.`descripcion` AS `desc_corta`,`art`.`descripcion` AS `desc_art`,`art`.`cliweb` AS `cliweb`,`art`.`codigo_barra` AS `codigo_barra`,`art`.`precio_compra` AS `precio_compra`,`art`.`precio_venta` AS `precio_venta`,`art`.`precio_tarjeta` AS `precio_tarjeta`,`art`.`precio_ctacte` AS `precio_ctacte` from (((`articulos` `art` join `marcas` `mar` on(((`art`.`marca_id` = `mar`.`id`) and (`art`.`cliweb` = `mar`.`cliweb`)))) join `rubros` `rbro` on(((`art`.`rbro_id` = `rbro`.`id`) and (`art`.`cliweb` = `rbro`.`cliweb`)))) left join `subrubros` `srbro` on(((`art`.`srbro_id` = `srbro`.`id`) and (`art`.`cliweb` = `srbro`.`cliweb`)))) */;

--
-- Final view structure for view `v_cab_ctacte`
--

/*!50001 DROP VIEW IF EXISTS `v_cab_ctacte`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`dba_user`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `v_cab_ctacte` AS select `cli`.`id` AS `id_cli`,`cli`.`apeynom` AS `apeynom`,`cli`.`direccion` AS `direccion`,`cli`.`cta_cte` AS `cta_cte`,`cli`.`cuit` AS `cuit`,`cli`.`telefono` AS `telefono`,`cli`.`email` AS `email`,`cli`.`celular` AS `celular`,`cli`.`cliweb` AS `cliweb`,`cli`.`tiene_ctacte` AS `tiene_ctacte`,`cli`.`tp_doc` AS `tp_doc`,`ctacte`.`id` AS `id_ctacte`,`ctacte`.`total_deuda` AS `total_deuda`,`ctacte`.`cliweb` AS `cweb`,`ctacte`.`tipo_cuenta` AS `tipo_cuenta` from (`cta_cte` `ctacte` join `clientes` `cli` on(((`ctacte`.`id` = `cli`.`cta_cte`) and (`ctacte`.`cliweb` = `cli`.`cliweb`)))) */;

--
-- Final view structure for view `v_cond_iva`
--

/*!50001 DROP VIEW IF EXISTS `v_cond_iva`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`dba_user`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `v_cond_iva` AS select `condicones_iva`.`id` AS `id`,`condicones_iva`.`descripcion` AS `descripcion`,`puntos_ventas`.`cuit` AS `cuit`,`puntos_ventas`.`cliweb` AS `cliweb`,`puntos_ventas`.`usr_conexion` AS `usr_conexion`,`puntos_ventas`.`punto_venta` AS `punto_venta` from (`condicones_iva` join `puntos_ventas` on((`condicones_iva`.`id` = `puntos_ventas`.`cond_iva`))) */;

--
-- Final view structure for view `v_cta_cte`
--

/*!50001 DROP VIEW IF EXISTS `v_cta_cte`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`dba_user`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `v_cta_cte` AS select `clientes`.`id` AS `id`,`clientes`.`apeynom` AS `apeynom`,`clientes`.`cta_cte` AS `cta_cte`,`facturas`.`idfacturas` AS `idfacturas`,`facturas`.`numero_factura` AS `numero_factura`,`facturas`.`fecha_factura` AS `fecha_factura`,`facturas`.`cuit_comprador` AS `cuit_comprador`,`facturas`.`importe_total` AS `importe_total`,`facturas`.`cliweb` AS `cliweb` from (`clientes` join `facturas` on((`clientes`.`cuit` = `facturas`.`cuit_comprador`))) where ((`facturas`.`modo_pago` = 4) and (`clientes`.`tiene_ctacte` = 'S')) */;

--
-- Final view structure for view `v_det_cta_cte`
--

/*!50001 DROP VIEW IF EXISTS `v_det_cta_cte`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`dba_user`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `v_det_cta_cte` AS select `ctacte`.`id` AS `ctacte_id`,`detctatcte`.`id_fc` AS `id_fc`,`detctatcte`.`fecha_deuda` AS `fecha_deuda`,`detctatcte`.`fecha_vto` AS `fecha_vto`,`detctatcte`.`debe` AS `debe`,`detctatcte`.`haber` AS `haber`,`detctatcte`.`saldo` AS `saldo`,`detctatcte`.`fecha_pago` AS `fecha_pago`,`detctatcte`.`n_item` AS `n_item`,`detctatcte`.`tipo_mov` AS `tipo_mov`,`detctatcte`.`numero_factura` AS `numero_factura`,`ctacte`.`cliweb` AS `cliweb` from (`cta_cte` `ctacte` join `det_cta_cte` `detctatcte` on((`ctacte`.`id` = `detctatcte`.`id_ctacte`))) */;

--
-- Final view structure for view `v_deta_fc`
--

/*!50001 DROP VIEW IF EXISTS `v_deta_fc`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`dba_user`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `v_deta_fc` AS select `factura_detalle`.`descripcion` AS `descripcion`,`factura_detalle`.`cantidad` AS `cantidad`,`factura_detalle`.`precio_unitario` AS `precio_unitario`,`factura_detalle`.`subtotal` AS `subtotal`,`factura_detalle`.`iva` AS `iva`,`factura_detalle`.`total` AS `total`,`factura_detalle`.`idfactura` AS `idfactura`,`factura_detalle`.`art_id` AS `art_id` from `factura_detalle` */;

--
-- Final view structure for view `v_detctacte_pago`
--

/*!50001 DROP VIEW IF EXISTS `v_detctacte_pago`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`dba_user`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `v_detctacte_pago` AS select `fac`.`cuit_vendedor` AS `cuit_vendedor`,`detctatcte`.`id_ctacte` AS `id_ctacte`,`detctatcte`.`id_fc` AS `id_fc`,`detctatcte`.`descripcion` AS `descripcion`,`detctatcte`.`fecha_deuda` AS `fecha_deuda`,`detctatcte`.`fecha_vto` AS `fecha_vto`,`detctatcte`.`debe` AS `debe`,`detctatcte`.`haber` AS `haber`,`detctatcte`.`saldo` AS `saldo`,`detctatcte`.`fecha_pago` AS `fecha_pago`,`detctatcte`.`n_item` AS `n_item`,`detctatcte`.`tipo_mov` AS `tipo_mov`,`detctatcte`.`numero_factura` AS `numero_factura`,`detctatcte`.`cliweb` AS `cliweb` from (`facturas` `fac` join `det_cta_cte` `detctatcte` on((`fac`.`idfacturas` = `detctatcte`.`id_fc`))) */;

--
-- Final view structure for view `v_facturas`
--

/*!50001 DROP VIEW IF EXISTS `v_facturas`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`dba_user`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `v_facturas` AS select `facturas`.`idfacturas` AS `idfacturas`,`facturas`.`numero_factura` AS `numero_factura`,`facturas`.`tipo_comprobante` AS `tipo_comprobante`,`facturas`.`fecha_factura` AS `fecha_factura`,`factura_detalle`.`descripcion` AS `descripcion`,`facturas`.`importe_total` AS `importe_total` from (`facturas` join `factura_detalle`) where (`facturas`.`idfacturas` = `factura_detalle`.`idfactura`) */;

--
-- Final view structure for view `v_padron_articulos`
--

/*!50001 DROP VIEW IF EXISTS `v_padron_articulos`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`dba_user`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `v_padron_articulos` AS select `articulos`.`id` AS `id`,`articulos`.`marca_id` AS `marca_id`,`marcas`.`descripcion` AS `marc_desc`,`articulos`.`rbro_id` AS `rbro_id`,`rubros`.`descripcion` AS `rbro_desc`,`articulos`.`descripcion` AS `descripcion`,`articulos`.`desc_corta` AS `desc_corta`,`articulos`.`fecha_baja` AS `fecha_baja`,`articulos`.`motivo` AS `motivo`,`articulos`.`cliweb` AS `cliweb`,`articulos`.`codigo_barra` AS `codigo_barra`,`articulos`.`codigo_barra_generado` AS `codigo_barra_generado`,`articulos`.`cantidad_minima` AS `cantidad_minima`,`articulos`.`cantidad_maxima` AS `cantidad_maxima`,`articulos`.`precio_venta` AS `precio_venta`,`articulos`.`precio_compra` AS `precio_compra`,`articulos`.`precio_tarjeta` AS `precio_tarjeta`,`articulos`.`precio_ctacte` AS `precio_ctacte`,`articulos`.`srbro_id` AS `srbro_id` from ((`articulos` join `marcas` on((`articulos`.`marca_id` = `marcas`.`id`))) join `rubros` on((`articulos`.`rbro_id` = `rubros`.`id`))) */;


