Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions cypress/integration/advance_statement.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
context('AdvanceStatement', () => {
before(() => {
cy.visit('http://localhost:8000/login#login');
});

it('Create a new advance statement', () => {
cy.get('#login_email').type('Administrator', { delay: 200});
cy.get('#login_password').type('Admin.123', { delay: 200});
cy.get('.btn-login').click();
cy.get('[href="#modules/Account status"]').click({ force: true});
cy.get('[href="#List/Advance Statement"]').click({ force: true});
cy.get('[data-label="Nuevo"]').click({ force: true});
cy.get('input[data-fieldname="patient_statement"]').last().click({multiple: true, force: true});
cy.get('input[data-fieldname="patient_statement"]').last().type('New');
cy.get('input[data-fieldname="date_create"]').first().click();
cy.wait(4000);
cy.get('input[data-fieldname="date_create"]').last().type('09-03-2020');
cy.get('input[data-fieldname="amount"]').first().click({force: true});
cy.wait(4000);
cy.get('input[data-fieldname="amount"]').last().type('1000', { delay: 200});
// cy.contains('Guardar').click({ force: true });
});
});
2 changes: 1 addition & 1 deletion cypress/integration/honorarium_payment.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ context('HonorariumPayment', () => {
cy.get('#login_email').type('Administrator', { delay: 200});
cy.get('#login_password').type('Admin.123', { delay: 200});
cy.get('.btn-login').click();
cy.contains('Estado de cuenta').click();
cy.get('[href="#modules/Account status"]').click({ force: true});
cy.get('[href="#List/Honorarium Payment"]').click({ force: true});
cy.get('[data-label="Nuevo"]').click({ force: true});
cy.get('input[data-fieldname="honorarium"]').last().click({multiple: true, force: true});
Expand Down
26 changes: 26 additions & 0 deletions cypress/integration/inventory_requisition.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
context('InventoryRequisition', () => {
before(() => {
cy.visit('http://localhost:8000/login#login');
});

it('Create a new inventory requisition', () => {
cy.get('#login_email').type('Administrator', { delay: 200});
cy.get('#login_password').type('Admin.123', { delay: 200});
cy.get('.btn-login').click();
cy.get('[href="#modules/Account status"]').click({ force: true});
cy.get('[href="#List/Inventory Requisition"]').click({ force: true});
cy.get('[data-label="Nuevo"]').click({ force: true});
cy.get('input[data-fieldname="patient_statement"]').last().click({multiple: true, force: true});
cy.get('input[data-fieldname="patient_statement"]').last().type('New');
cy.get('input[data-fieldname="date_create"]').first().click();
cy.wait(4000);
cy.get('input[data-fieldname="date_create"]').last().type('09-03-2020');
cy.get('[data-fieldname="products"]').click({multiple: true, force: true});
cy.get('[data-fieldname="item"]').click({multiple: true, force: true});
cy.wait(4000);
cy.contains('P0001').click({force: true})
cy.get('[data-fieldname="quantity"]').first().click();
cy.get('[data-fieldname="quantity"]').last().type('5');
cy.contains('Guardar').click({ force: true });
});
});
8 changes: 4 additions & 4 deletions cypress/integration/medical.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ context('Medical', () => {
cy.get('#login_email').type('Administrator', { delay: 200});
cy.get('#login_password').type('Admin.123', { delay: 200});
cy.get('.btn-login').click();
cy.contains('Estado de cuenta').click();
cy.get('[href="#modules/Account status"]').click({ force: true});
cy.wait(4000);
cy.get('[href="#List/Medical"]').click({ force: true,});
cy.get('a[href="#List/Medical"]').click({ force: true});
cy.wait(4000);
cy.get('[data-label="Nuevo"]').click({ force: true});
cy.wait(4000);
Expand All @@ -21,8 +21,8 @@ context('Medical', () => {
cy.get('[data-fieldname="identification_card"]').children().type('0501-1992-01768', { delay: 200});
cy.get('[data-fieldname="rtn"]').click({multiple: true} );
cy.get('[data-fieldname="rtn"]').children().type('0456-00H00', { delay: 200});
cy.get('[data-fieldname="rank"]').click({multiple: true} );
cy.get('[data-fieldname="rank"]').children().type('Pediatra', { delay: 200});
cy.get('[data-fieldname="specialty"]').click({multiple: true} );
cy.get('[data-fieldname="specialty"]').children().type('Pediatra', { delay: 200});
cy.get('[data-fieldname="phone"]').click({multiple: true} );
cy.get('[data-fieldname="phone"]').children().type('98492849', { delay: 200});
cy.get('[data-fieldname="email"]').click({multiple: true} );
Expand Down
6 changes: 3 additions & 3 deletions cypress/integration/medical_category.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ context('MedicalCategory', () => {
cy.get('#login_email').type('Administrator');
cy.get('#login_password').type('Admin.123');
cy.get('.btn-login').click();
cy.contains('Estado de cuenta').click();
cy.get('[href="#modules/Account status"]').click({ force: true});
cy.get('[href="#List/Medical Category"]').click({ force: true });
cy.get('[data-label="Nuevo"]').click({ force: true });
cy.get('[data-fieldname="rank"]').click({multiple: true} );
cy.get('[data-fieldname="rank"]').children().type('Cirujano');
cy.get('[data-fieldname="specialty"]').click({multiple: true} );
cy.get('[data-fieldname="specialty"]').children().type('Cirujano');
cy.contains('Guardar').click({ force: true });
});
});
2 changes: 1 addition & 1 deletion cypress/integration/medical_honorarium.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ context('MedicalHononoarium', () => {
cy.get('#login_email').type('Administrator');
cy.get('#login_password').type('Admin.123');
cy.get('.btn-login').click();
cy.contains('Estado de cuenta').click();
cy.get('[href="#modules/Account status"]').click({ force: true});
cy.get('[href="#List/Medical Honorarium"]').click({ force: true });
cy.get('[data-label="Nuevo"]').click({ force: true});
cy.get('[data-fieldname="medical"]').click({multiple: true});
Expand Down
23 changes: 23 additions & 0 deletions cypress/integration/patient_statement.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
context('PatientStatement', () => {
before(() => {
cy.visit('http://localhost:8000/login#login');
});

it('Create a new patient statement', () => {
cy.get('#login_email').type('Administrator', { delay: 200});
cy.get('#login_password').type('Admin.123', { delay: 200});
cy.get('.btn-login').click();
cy.get('[href="#modules/Account status"]').click({ force: true});
cy.get('[href="#List/Patient statement"]').click({ force: true});
cy.get('[data-label="Nuevo"]').click({ force: true});
cy.get('input[data-fieldname="__newname"]').last().click({multiple: true, force: true});
cy.get('input[data-fieldname="__newname"]').last().type('New Patient');
cy.get('input[data-fieldname="date"]').first().click();
cy.wait(4000);
cy.get('input[data-fieldname="date"]').last().type('09-03-2020');
cy.get('input[data-fieldname="client"]').first().click({force: true});
cy.wait(4000);
cy.get('input[data-fieldname="client"]').last().type('German Roberto Guardiola', { delay: 200});
cy.contains('Guardar').click({ force: true });
});
});
26 changes: 26 additions & 0 deletions cypress/integration/return_of_inventory_requisition.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
context('ReturnOfInvetoryRequisition', () => {
before(() => {
cy.visit('http://localhost:8000/login#login');
});

it('Create a new return of inventory requisition', () => {
cy.get('#login_email').type('Administrator', { delay: 200});
cy.get('#login_password').type('Admin.123', { delay: 200});
cy.get('.btn-login').click();
cy.get('[href="#modules/Account status"]').click({ force: true});
cy.get('[href="#List/Return of inventory requisition"]').click({ force: true});
cy.get('[data-label="Nuevo"]').click({ force: true});
cy.get('input[data-fieldname="patient_statement"]').last().click({multiple: true, force: true});
cy.get('input[data-fieldname="patient_statement"]').last().type('New');
cy.get('input[data-fieldname="date_create"]').first().click();
cy.wait(4000);
cy.get('input[data-fieldname="date_create"]').last().type('09-03-2020');
cy.get('[data-fieldname="products"]').click({multiple: true, force: true});
cy.get('[data-fieldname="item"]').click({multiple: true, force: true});
cy.wait(4000);
cy.contains('P0001').click({force: true})
cy.get('[data-fieldname="quantity"]').first().click();
cy.get('[data-fieldname="quantity"]').last().type('5');
cy.contains('Guardar').click({ force: true });
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ frappe.ui.form.on('Advance Statement', {
onload: function(frm) {
cur_frm.fields_dict['patient_statement'].get_query = function(doc, cdt, cdn) {
return {
filters:{'outstanding_balance': [">",0]}
filters:{'state': ["=","Open"]}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,19 @@ def validate(self):
self.calculate_honorarium()

def calculate_honorarium(self):
doc = frappe.get_doc("Medical Honorarium", self.honorarium)
if(self.total == self.honorarium_amount):
doc = frappe.get_doc("Medical Honorarium", self.honorarium)
if(self.total_remaining == 0):
doc.status = "Paid Out"
doc.total_payment += self.total
doc.total_remaining -= self.total
doc.save()
else:
if(self.total < self.honorarium_amount):
doc = frappe.get_doc("Medical Honorarium", self.honorarium)
if(self.total_remaining > 0):
doc.status = "Open"
doc.total_payment += self.total
doc.total_remaining -= self.total
doc.save()
# else:
# frappe.throw(_("The amount cannot be greater than the total honorarium"))
doc.save()

self.data_table()

Expand Down
15 changes: 14 additions & 1 deletion leaf_develop/account_status/doctype/medical/medical.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
"identification_card",
"rtn",
"specialty",
"especialties_section",
"specialties",
"contact_section",
"phone",
"email",
Expand Down Expand Up @@ -125,12 +127,23 @@
"in_list_view": 1,
"label": "Status",
"options": "Active\nInactive"
},
{
"fieldname": "especialties_section",
"fieldtype": "Section Break",
"label": "Professional profile"
},
{
"fieldname": "specialties",
"fieldtype": "Table",
"label": "Specialties",
"options": "Specialties"
}
],
"image_field": "image",
"links": [],
"max_attachments": 1,
"modified": "2020-02-27 14:45:37.815804",
"modified": "2020-03-13 11:34:59.956821",
"modified_by": "Administrator",
"module": "Account status",
"name": "Medical",
Expand Down
2 changes: 2 additions & 0 deletions leaf_develop/account_status/doctype/medical/test_medical.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def default_data():
"doctype":"Medical",
"first_name": "Izuku",
"last_name": "Midoriya",
"service": "CLI-SER-0016",
"identification_card": "0501-0000-01768",
"rtn": "0456-00H00",
"specialty": "Pediatra"
Expand All @@ -31,6 +32,7 @@ def create_events():
"doctype": doctor["doctype"],
"first_name": doctor["first_name"],
"last_name": doctor["last_name"],
"service": doctor["service"],
"identification_card": doctor["identification_card"],
"rtn": doctor["rtn"],
"specialty": doctor["specialty"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@
"fieldname": "total",
"fieldtype": "Currency",
"in_list_view": 1,
"label": "Total",
"set_only_once": 1
"label": "Total"
},
{
"fetch_from": "medical.full_name",
Expand Down Expand Up @@ -96,8 +95,7 @@
"in_standard_filter": 1,
"label": "Medical",
"options": "Medical",
"reqd": 1,
"set_only_once": 1
"reqd": 1
},
{
"fieldname": "honorarium_payment",
Expand Down Expand Up @@ -147,8 +145,7 @@
"in_standard_filter": 1,
"label": "Patient Statement",
"options": "Patient statement",
"reqd": 1,
"set_only_once": 1
"reqd": 1
},
{
"fetch_from": "medical.specialty",
Expand All @@ -159,7 +156,7 @@
}
],
"links": [],
"modified": "2020-02-24 10:05:56.069555",
"modified": "2020-03-12 14:29:11.408940",
"modified_by": "Administrator",
"module": "Account status",
"name": "Medical Honorarium",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
class MedicalHonorarium(Document):
def validate(self):
self.remaining()
self.verificate_changes()

if self.total_payment is None:
self.add_medical_honorarium_payment()
Expand All @@ -36,6 +37,22 @@ def apply_changes(self, total):
doc.cumulative_total += total
doc.save()

def verificate_changes(self):
now = frappe.get_all("Medical Honorarium", filters={'name': self.name}, fields={"total", "medical", "date", "patient_statement"})
for item in now:
if item.total != self.total:
self.total_remaining = self.total
self.condition_for_changes()
elif item.medical != self.medical:
self.condition_for_changes()
elif item.patient_statement != self.patient_statement:
self.condition_for_changes()

def condition_for_changes(self):
honorarium_payment = frappe.get_all("Honorarium Payment", filters={'honorarium': self.name})
if len(honorarium_payment) > 0:
frappe.throw(_("The fee cannot be edited because you already have a payment made"))

def add_medical_honorarium_payment(self):
total_price = 0
medico = frappe.get_all("Medical", ["service"], filters = {'name': self.medical})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,16 @@

import frappe
import frappe.defaults
from leaf_develop.account_status.doctype.medical_honorarium.medical_honorarium import validate
import unittest

test_records = frappe.get_test_records('Medical Honorarium')
model = "Medical Honorarium"

def default_data():
return {
"doctype":"Medical Honorarium",
"status": "Open",
"company": "Servicios Medicos Multiples - Clínica",
"date": "17-02-2020",
"medical": "AS-MA-00001",
"patient_statement": "Nuevo",
"total": 20000
}

Expand All @@ -29,21 +26,31 @@ def create_events():
frappe.set_user("Administrator")
doc = frappe.get_doc({
"doctype": honorarium["doctype"],
"status": honorarium["status"],
"company": honorarium["company"],
"date": honorarium["date"],
"medical": honorarium["medical"],
"patient_statement": honorarium["patient_statement"],
"total": honorarium["total"]
}).insert(ignore_permissions=True)
}).insert()

frappe.flags.test_events_created = True

class TestMedicalHonorarium(unittest.TestCase):
def non_commit(self):
frappe.set_user("Administrator")
pass

def setUp(self):
frappe.set_user("Administrator")
create_events()
frappe.db.commit = self.non_commit
frappe.db.begin()


def tearDown(self):
frappe.db.rollback()

def test_create_new_honorarium(self):
honorarium = default_data()
frappe.set_user("Administrator")
doc = frappe.get_doc("Medical Honorarium", frappe.db.get_value(model, {"medical": honorarium["medical"]}))
self.assertEqual(doc.medical, honorarium["medical"])
doc = frappe.get_doc("Medical Honorarium", frappe.db.get_value(model, {"name": honorarium["name"]}))
self.assertEqual(doc.name, honorarium["name"])
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"fieldtype": "Select",
"in_list_view": 1,
"label": "State",
"options": "Open\nClose\nCancelled",
"options": "Open\nClosed\nCancelled",
"read_only": 1
},
{
Expand Down Expand Up @@ -68,7 +68,7 @@
],
"is_submittable": 1,
"links": [],
"modified": "2020-02-24 13:29:13.389397",
"modified": "2020-03-13 10:50:22.001472",
"modified_by": "Administrator",
"module": "Account status",
"name": "Patient statement",
Expand Down
Loading