Compare commits

..

192 Commits

Author SHA1 Message Date
4e8115ca0a feat: filter workshops by active status in employee document workflows 2025-10-15 09:43:58 +03:30
Mahan Chamani
397280d0a2 Merge pull request #2 from samsyntax24/Main
Main
2025-10-14 12:11:11 +00:00
5975a92aa1 Merge branch 'Feature/Registeration-workflow/add-existed-employer' into Main 2025-10-14 15:15:03 +03:30
0cec7c0cce feat: update institution contract retrieval to use WorkshopGroup's InstitutionContractId 2025-10-14 15:14:36 +03:30
be6cb6430f Merge branch 'Fix/institution-contract/list-search' into Main
# Conflicts:
#	ServiceHost/Areas/Admin/Controllers/RegistrationWorkflowController.cs
2025-10-14 14:21:58 +03:30
f863fb065f feat: update search functionality in InstitutionContractRepository and add edit route in RegistrationWorkflowController 2025-10-14 14:20:56 +03:30
76aa1eae88 Merge branch 'Fix/institution-contract/list-search' into Main 2025-10-14 14:06:21 +03:30
d0b29e7643 feat: add GetInstitutionContractSelectList method for improved search functionality 2025-10-14 14:05:44 +03:30
f1106deff9 feat: add authentication fields and workflow registration retrieval for employers 2025-10-14 12:10:50 +03:30
94a5741906 feat: add optional legal type parameter to employer selection list retrieval 2025-10-14 10:33:08 +03:30
221d06a0fc Merge branch 'Feature/Registeration-workflow/add-existed-employer' into Main 2025-10-14 09:59:19 +03:30
2b993fb746 feat: enhance employer selection with optional legal type filtering 2025-10-14 09:58:49 +03:30
syntax24
5b3c7e471e web.config remove new tag 2025-10-13 15:45:12 +03:30
syntax24
330a3ca839 web.config change 2025-10-13 15:34:53 +03:30
7c4cf1e2ed feat: add edit laws and regulations link to the menu 2025-10-13 15:14:24 +03:30
1d2c4f26f1 Merge branch 'Feature/law/add-edit-law' 2025-10-13 13:02:18 +03:30
761ac352df Merge branch 'Feature/Registeration-workflow/add-existed-employer' into Main 2025-10-13 12:56:47 +03:30
ecfb7af386 feat: implement archive code retrieval for workshops in registration workflow 2025-10-13 12:43:53 +03:30
92fd8d6b0e feat: add support for existing employers in registration workflow 2025-10-13 11:33:42 +03:30
4f68d141e8 Merge branch 'Feature/Insurance/add-not-created-tab' 2025-10-13 11:17:40 +03:30
75ea35596b refactor: comment out conditional checks in Index.js for clarity 2025-10-13 11:17:13 +03:30
a0e2b969c0 fix insitution contract convetor for multi employer workshops 2025-10-13 10:47:29 +03:30
8efffe8b75 feat: add LawId to InstitutionContract and related classes for improved contract management 2025-10-13 09:29:59 +03:30
fdf7fa0d3c feat: add versioning to Law entity and implement version management in LawApplication 2025-10-13 09:02:17 +03:30
5cde26e7f3 fix: update dashboard links to use Next URLs 2025-10-13 08:00:20 +03:30
b448c43bb7 Merge branch 'Feature/Insurance/add-not-created-tab' 2025-10-13 07:49:13 +03:30
6045153865 fix: duplicate insurance record in not created insurances 2025-10-13 07:48:45 +03:30
5d16020c6a feat: optimize join queries in InsuranceListRepository for improved data retrieval 2025-10-12 12:23:56 +03:30
987e5acca4 Merge branch 'Main' 2025-10-11 23:35:58 +03:30
9ebbe00a95 fix bug 2025-10-11 23:35:28 +03:30
b576a8dd6b Merge branch 'Main' 2025-10-11 20:01:46 +03:30
69279b320c feat: enhance workshop handling by adding workshop group association and improving initialization logic 2025-10-11 19:36:48 +03:30
a360a20478 feat: add phone number to authentication methods and improve temporary client registration validation 2025-10-11 16:54:04 +03:30
aad1645edd Merge branch 'Feature/Insurance/add-not-created-tab' 2025-10-11 14:58:59 +03:30
af1388f0d7 feat: update not created workshops query to include filtering by left work insurance dates 2025-10-11 14:58:30 +03:30
4d0cf13d40 Merge branch 'Feature/Insurance/add-not-created-tab' 2025-10-11 14:46:05 +03:30
6584558e6a fix: update error message for invalid national ID and birth date mismatch 2025-10-11 14:35:37 +03:30
561f742eb5 Merge branch 'Feature/InstitutionContract/add-registration-style' into Main 2025-10-11 13:36:07 +03:30
560ea04f33 refactor: remove unused ExtensionInquiry method and clean up IInstitutionContractApplication interface 2025-10-11 13:28:04 +03:30
ed5681256d feat: enhance "Not Created" tab functionality and improve data loading in InsuranceList 2025-10-11 13:14:30 +03:30
a1a361a09c Merge branch 'Feature/InstitutionContract/add-registration-style' into Main 2025-10-11 11:10:08 +03:30
ccd99c5184 feat: enhance extension inquiry with detailed response and validation improvements 2025-10-11 11:08:31 +03:30
f29fac2631 Merge branch 'Feature/InstitutionContract/add-registration-style' into Main 2025-10-11 10:29:19 +03:30
4707c389ae refactor: standardize extension naming and add extension inquiry handling 2025-10-11 10:26:02 +03:30
a403b9f960 Merge branch 'Feature/InstitutionContract/add-registration-style' into Main 2025-10-09 14:44:22 +03:30
6a0abf2545 update contract start date calculation and ensure transaction commit in InstitutionContractRepository 2025-10-09 14:44:02 +03:30
7a58423eb3 feat: implement "GetNotCreatedWorkshop" method and update related functionality in InsuranceList 2025-10-09 14:30:09 +03:30
83ef2a1177 Merge branch 'Feature/InstitutionContract/add-registration-style' into Main 2025-10-09 13:49:27 +03:30
3fa05b99dd add [FromBody] attribute to ExtenstionComplete parameter in institutionContractController 2025-10-09 13:48:58 +03:30
70164ae498 feat: add "GetNotCreatedWorkshop" method to InsuranceList functionality 2025-10-09 13:47:43 +03:30
c5d6dcbbc3 Merge branch 'Feature/InstitutionContract/add-registration-style' into Main 2025-10-09 12:33:31 +03:30
d70ea10d2d add [FromBody] attribute to GetExtenstionPaymentMethod parameter in institutionContractController 2025-10-09 12:32:27 +03:30
db225fea18 feat: add "Not Created" tab and implement related functionality in InsuranceList page 2025-10-09 12:27:20 +03:30
bd331c8afe Merge branch 'Feature/InstitutionContract/add-registration-style' into Main 2025-10-09 11:54:50 +03:30
9f7d267afb add payment method handling to InstitutionContractExtension, update repository and controller 2025-10-09 11:54:30 +03:30
7abbd489bb remove redundant whitespace in InstitutionContract and InstitutionContractRepository 2025-10-09 11:35:46 +03:30
35811775f3 Merge branch 'Feature/InstitutionContract/add-registration-style' into Main 2025-10-09 10:51:46 +03:30
b78a06e743 add RollCallInPerson and CustomizeCheckout handling in InstitutionContract workflows and update repository 2025-10-09 10:51:23 +03:30
4ce82679ff add extension completion handling in InstitutionContract workflows and update repositories 2025-10-08 18:05:55 +03:30
e1161245cf Merge branch 'Feature/InstitutionContract/add-registration-style' into Main 2025-10-08 15:25:48 +03:30
8e83b32856 add payment models to InstitutionContractExtenstionTemp and update handling in repository 2025-10-08 15:24:51 +03:30
8eeec345d1 Merge branch 'Feature/InstitutionContract/add-registration-style' into Main 2025-10-08 14:39:34 +03:30
780a610e91 add payment method handling in institution contract extension and refactor installment calculation 2025-10-08 14:38:06 +03:30
e095f4e07d Merge branch 'Feature/InstitutionContract/add-registration-style' into Main 2025-10-08 11:32:13 +03:30
4a3ac6e096 add workshops and plan amounts handling in InstitutionContractExtenstionTemp and update related services 2025-10-08 11:31:44 +03:30
2bbe616127 fix: apply IgnoreQueryFilters in LeaveRepository for accurate data retrieval 2025-10-08 09:53:06 +03:30
f64e6ac176 Merge branch 'Feature/Leave/add-invalid-leave' 2025-10-07 17:23:27 +03:30
9095ed28e1 fix invalid bug 2025-10-07 17:20:48 +03:30
a1ad139730 Merge branch 'Feature/InstitutionContract/add-registration-style' into Main 2025-10-07 17:06:51 +03:30
dbe7aebf37 add institution contract extension plan service and integrate with controller 2025-10-07 17:05:11 +03:30
7eca8226b3 Merge branch 'Feature/InstitutionContract/add-registration-style' into Main 2025-10-07 15:09:13 +03:30
8912215bbc rename workshop service calculator route and add placeholders for future methods 2025-10-07 15:08:49 +03:30
6c5f224fda Merge branch 'Feature/InstitutionContract/add-registration-style' into Main 2025-10-07 14:43:43 +03:30
437f419c2d add LegalAuthentication method and integrate it with contract workflows 2025-10-07 14:42:21 +03:30
04ec2ed5a4 Merge branch 'Feature/Leave/add-invalid-leave' 2025-10-07 14:12:49 +03:30
fc1258e985 Merge branch 'Feature/Leave/add-invalid-leave' into Main 2025-10-07 14:11:32 +03:30
SamSys
c7f5310c56 Edit Employee change NationalCode Validation By Nationality 2025-10-07 14:02:12 +03:30
7b3d1f527c feat: integrate "IsInvalid" filter and dropdown functionality in leave management 2025-10-07 12:51:18 +03:30
dbbee73e2a add is invalid to list - NOT FINISHED 2025-10-06 20:07:32 +03:30
21df40af3b add isInvalid to leave entity - set query filter for it 2025-10-06 19:50:42 +03:30
6d0072c8ac add InstitutionContractExtenstionTemp - add mongodb Config 2025-10-06 15:04:26 +03:30
SamSys
f50fdd7f91 createLive bug fixed 2025-10-06 14:45:54 +03:30
76013946bd fix sms bug for sending link 2025-10-05 17:38:51 +03:30
024b8cfaa9 boost get list 2025-10-05 14:40:32 +03:30
b8c738bd14 add convertor for InstitutionContract.cs 2025-10-05 11:42:48 +03:30
126cbff54f add ticket and task count 2025-10-05 11:41:56 +03:30
2e97d3238d add convertor for InstitutionContract 2025-10-04 17:20:01 +03:30
ea0be6b865 fix institutionContract otp bug 2025-10-04 15:30:12 +03:30
896c891f70 Merge branch 'Feature/InstitutionContract/add-registration-style' into Main
# Conflicts:
#	CompanyManagment.EFCore/Repository/PersonalContractingPartyRepository.cs
2025-10-04 11:42:31 +03:30
11207a785c fix institution contract list bugs 2025-10-04 11:38:45 +03:30
SamSys
87cde91ad0 Extecpt Condition EmployeeId = 45104, workshopId = 315 2025-10-02 16:11:38 +03:30
SamSys
55f62da928 monthlyWage bug fixed 2025-10-02 15:39:01 +03:30
bfb7f4e38c add sms templates 2025-10-02 14:57:24 +03:30
SamSys
5a7f233568 checkout dailyWage bug fixed 2025-10-02 14:22:48 +03:30
SamSys
9d83de947f Merge branch 'master' of https://github.com/samsyntax24/OriginalGozareshgir 2025-10-02 13:03:47 +03:30
SamSys
f4c3aa1889 Except Personnel checkoutChange 2025-10-02 13:03:29 +03:30
8fb10ba5b0 add validation for leave 2025-10-01 16:32:58 +03:30
b5465f5501 Merge branch 'Feature/InstitutionContract/add-registration-style' into Main 2025-10-01 15:59:39 +03:30
bcb42cc05e add address details 2025-10-01 15:59:12 +03:30
ee9f802486 Merge branch 'Feature/InstitutionContract/add-registration-style' into Main 2025-10-01 15:14:38 +03:30
72d082d5f2 add oneMonthAmount 2025-10-01 15:14:14 +03:30
983f629cd6 Merge branch 'Feature/admin-dashboard/migrate-next' into Main 2025-10-01 14:03:19 +03:30
0e3e783c5c set client dashboard 2025-10-01 14:02:19 +03:30
136a9775ea Merge branch 'Feature/contracting-party/modify-apis' into Main 2025-10-01 12:20:40 +03:30
a6fdfd13f9 add new get contractingParty 2025-10-01 12:20:09 +03:30
9bf8153d95 set authorize data 2025-10-01 12:05:22 +03:30
SamSys
d0928804ee new permission to DailyWageReport btn on Contract list 2025-09-30 22:05:12 +03:30
SamSys
67f199e86f merge from master 2025-09-30 21:37:19 +03:30
8893b53d9a Merge branch 'Feature/InstitutionContract/add-registration-style' into Main 2025-09-30 16:50:19 +03:30
e49f635b4e change validation text 2025-09-30 16:49:50 +03:30
04d9b84eb6 Merge branch 'Feature/InstitutionContract/add-registration-style' into Main 2025-09-30 16:18:21 +03:30
39d887c4c3 add validation for create contractingParty 2025-09-30 15:46:28 +03:30
2e0d005ab9 add lock for sms 2025-09-30 13:40:04 +03:30
f90bb3dfc6 Merge branch 'Feature/InstitutionContract/add-registration-style' into Main 2025-09-30 12:24:01 +03:30
2d0365bc6e Add insurance Job and workshop details 2025-09-30 12:23:37 +03:30
dba90c9a3f Merge branch 'Feature/InstitutionContract/add-registration-style' into Main 2025-09-29 17:20:00 +03:30
0e360836f7 add custom exception 2025-09-29 17:19:41 +03:30
0753095415 Merge branch 'Feature/InstitutionContract/add-registration-style' into Main 2025-09-29 14:47:21 +03:30
7725384a87 add extra custom exception 2025-09-29 14:47:10 +03:30
94f16c8a49 Merge branch 'Feature/InstitutionContract/add-registration-style' into Main 2025-09-29 13:15:16 +03:30
f5c3e6351c feat: add exception and opt bugs 2025-09-29 13:15:04 +03:30
6bfc0a8d67 Merge branch 'Feature/InstitutionContract/add-registration-style' into Main 2025-09-29 10:31:29 +03:30
413bd3aad9 set allow anonymous for law get details 2025-09-29 10:31:16 +03:30
031f05937d Merge branch 'Feature/InstitutionContract/add-registration-style' into Main 2025-09-29 10:21:29 +03:30
84060e83f5 fix: change send sms verification and fix validation bug 2025-09-29 10:21:08 +03:30
SamSys
85936cad63 gozareshgir address and phone changed 2025-09-29 05:11:05 +03:30
SamSys
6f805d9abe add enamd logo 2025-09-28 18:33:09 +03:30
0acb691c54 Merge branch 'Feature/InstitutionContract/add-registration-style' into Main 2025-09-28 18:31:54 +03:30
90c6eef199 change condition if for institutioncontract 2025-09-28 18:31:40 +03:30
52f310353f Merge branch 'Feature/InstitutionContract/add-registration-style' into Main 2025-09-28 15:54:09 +03:30
71f7b05490 add is installment to institutioncontract 2025-09-28 15:53:49 +03:30
7681f4e95b Merge branch 'Feature/InstitutionContract/add-registration-style' into Main 2025-09-28 15:14:32 +03:30
681ac6eb1a remove statics for services 2025-09-28 15:14:22 +03:30
349b96ba08 Merge branch 'Feature/InstitutionContract/add-registration-style' into Main 2025-09-28 14:59:40 +03:30
c38aa29009 fix: institutioncontract verify details bugs 2025-09-28 14:59:21 +03:30
914a7def53 feat: add condition for left personnel for laon installment 2025-09-28 14:47:33 +03:30
2b6864c024 Merge branch 'Feature/InstitutionContract/add-registration-style' into Main 2025-09-28 13:07:38 +03:30
cf2849e47e feat: add labels for services 2025-09-28 13:07:24 +03:30
c0cbf20450 Merge branch 'Feature/InstitutionContract/add-registration-style' into Main 2025-09-28 12:53:27 +03:30
75cc5a3e5f set sms verification label 2025-09-28 12:53:09 +03:30
6603427845 Merge branch 'Feature/InstitutionContract/add-registration-style' into Main 2025-09-28 10:39:48 +03:30
3d12f3b4d2 change create workshop structure 2025-09-28 10:38:51 +03:30
c87d734b5a Merge branch 'Feature/InstitutionContract/add-registration-style' into Main 2025-09-27 14:32:37 +03:30
b47759244e change workshops in InstitutionContract to initial and current 2025-09-27 14:30:10 +03:30
7905dff7c6 Merge branch 'Feature/InstitutionContract/add-registration-style' into Main 2025-09-27 11:23:28 +03:30
0ebca7c613 add seprate tax for institutionContractController create 2025-09-27 11:22:52 +03:30
57dae3d8f1 Merge branch 'Feature/InstitutionContract/add-registration-style' into Main 2025-09-27 10:39:37 +03:30
81d78affa0 set installment persian numbers 2025-09-27 10:39:28 +03:30
32e118d6f7 Merge branch 'Feature/InstitutionContract/add-registration-style' into Main 2025-09-27 09:46:01 +03:30
68748ab8a6 Fix workflow new bugs 2025-09-27 09:45:44 +03:30
7777ad52de create workshop permission 2025-09-25 13:06:39 +03:30
b8b8d9c3c4 set account permission in EditWorkshop 2025-09-25 12:47:04 +03:30
SamSys
04710e321a Merge branch 'master' of https://git.dadmehrg.ir/gozareshgir/OriginalGozareshgir 2025-09-25 12:26:46 +03:30
SamSys
b9ff14757b new tab permission code 2025-09-25 12:26:38 +03:30
58152ae2d6 Merge branch 'Feature/InstitutionContract/add-registration-style' into Main 2025-09-25 10:32:32 +03:30
f51c42a359 fix route 2025-09-25 10:32:17 +03:30
0373a7e6be Merge branch 'Feature/InstitutionContract/add-registration-style' into Main 2025-09-25 10:06:05 +03:30
957284be7f feat: set second party for institution verification 2025-09-25 09:53:41 +03:30
c01bc80608 Merge branch 'master' into Main 2025-09-24 15:40:42 +03:30
f387d0c535 fix create pay bug 2025-09-24 15:38:47 +03:30
27109b3472 Merge branch 'Feature/InstitutionContract/add-registration-style' into Main 2025-09-24 14:28:43 +03:30
d1f64dd1b0 add fname and lname 2025-09-24 14:19:12 +03:30
ffc6969ee7 feat: change the create customize checkout 2025-09-24 13:47:55 +03:30
9beed6cf45 add ceo names in contracting party 2025-09-24 12:02:36 +03:30
868bb3f17a add amendment mapping in InstitutionContract 2025-09-23 18:59:19 +03:30
c3bbd9af98 feat: change the loan is paid by checkout 2025-09-23 17:55:03 +03:30
56cce8c93d add institutioncontract new data 2025-09-23 16:38:54 +03:30
c13a77e53d Merge branch 'Feature/InstitutionContract/add-registration-style' into Main 2025-09-22 16:27:22 +03:30
523cbc744b fix bug 2025-09-22 16:26:59 +03:30
e53f3a721a Merge branch 'Feature/InstitutionContract/add-registration-style' into Main 2025-09-22 14:45:35 +03:30
79b14ec958 add Services and updat get list institutioncontract 2025-09-22 14:45:19 +03:30
72435f2d47 fix: InsuranceList edit on get bug 2025-09-22 11:07:37 +03:30
df00f5cbac Merge branch 'feature/accounts/show-admin-based-on-role' into Feature/InstitutionContract/add-registration-style 2025-09-21 12:24:47 +03:30
90ee299b87 feat:add InstitutionContractWorkshopGroup add migrations 2025-09-20 17:02:03 +03:30
e6e81cd1c9 Refactor InstitutionContract to use VerificationStatus and add support for amendments and installments 2025-09-18 14:08:54 +03:30
SamSys
b3cf56eb1c conflict Fixed 2025-09-16 03:01:41 +03:30
SamSys
20dbd0121f Merge From Master 2025-09-16 03:01:02 +03:30
SamSys
7d3a1dad71 test mirror2 2025-09-08 00:53:59 +03:30
SamSys
b5fc98a47b test mirror 2025-09-08 00:50:28 +03:30
SamSys
29fed23805 Checkout NEW Compute DailyWage Completed 2025-09-02 04:33:30 +03:30
SamSys
a26f079969 merge from master to manualDailyWage 2025-08-31 17:20:27 +03:30
SamSys
77458978b5 checkout change 2025-08-31 05:28:59 +03:30
SamSys
7e3f7d1dcf Completed DailYWage and BaseYear report For Contract 2025-08-28 06:09:02 +03:30
SamSys
c40b457d1f Merge branch 'master' into ManualDailyWageContractSide 2025-08-26 01:49:05 +03:30
SamSys
a344c3f3a6 Merge branch 'master' into ManualDailyWageContractSide 2025-08-24 03:45:58 +03:30
SamSys
8f76b8c082 Upgraded daillyWage Completed 2025-08-24 03:37:54 +03:30
SamSys
584425b3af and new metod to upgrade dailyWage 2025-08-23 07:09:56 +03:30
SamSys
2f60883ea2 add new prop to contractTable - compute dailyWage 2025-08-23 04:27:04 +03:30
SamSys
df1e6f62b8 new manualdailywage metod to create contract 2025-08-21 15:55:53 +03:30
SamSys
856ed38f08 Merge branch 'master' into ManualDailyWageContractSide 2025-08-21 01:49:27 +03:30
SamSys
4a3515ad65 manualDailyWage frontEnd Completed 2025-08-20 02:52:06 +03:30
SamSys
49b84b50a5 add dailywage select on create contract front 2025-08-18 05:33:31 +03:30
209 changed files with 175579 additions and 6879 deletions

View File

@@ -3,4 +3,6 @@
public class AppSettingConfiguration
{
public string Domain { get; set; }
public string ClientDomain =>"client"+Domain;
public string AdminDomain =>"admin"+Domain;
}

View File

@@ -26,6 +26,10 @@ public interface ISmsService
#region Mahan
Task<double> GetCreditAmount();
public Task<bool> SendInstitutionVerificationLink(string number,string fullName, Guid institutionId);
public Task<bool> SendInstitutionVerificationCode(string number, string code);
#endregion

View File

@@ -0,0 +1,7 @@
namespace _0_Framework.Application.Sms;
public class OtpResultViewModel
{
public int ExpireTimeSec { get; set; }
public int ReSendTimeSec { get; set; }
}

View File

@@ -331,7 +331,28 @@ public class SmsService : ISmsService
}
}
public async Task<bool> SendInstitutionVerificationLink(string number,string fullName, Guid institutionId)
{
var guidStr=institutionId.ToString();
var firstPart = guidStr.Substring(0, 15);
var secondPart = guidStr.Substring(15);
var verificationSendResult =await SmsIr.VerifySendAsync(number, 527519, new VerifySendParameter[]
{
new("FULLNAME", fullName),
new("CODE1",firstPart),
new("CODE2",secondPart)
});
return verificationSendResult.Status == 0;
}
public async Task<bool> SendInstitutionVerificationCode(string number, string code)
{
var verificationSendResult =await SmsIr.VerifySendAsync(number, 965348, new VerifySendParameter[]
{
new("VERIFYCODE", code)
});
return verificationSendResult.Status == 0;
}
#endregion
}

View File

@@ -477,26 +477,42 @@ public static class Tools
string bb = string.Empty;
bool isNegative = false;
for (int x = 0; x < myMoney.Length; x++)
try
{
if (char.IsDigit(myMoney[x]))
if (!string.IsNullOrWhiteSpace(myMoney))
{
bb += myMoney[x];
}
else if (myMoney[x] == '-' && bb.Length == 0)
{
// اگر علامت منفی قبل از اولین عدد آمد، در نظر بگیر
isNegative = true;
}
}
for (int x = 0; x < myMoney.Length; x++)
{
if (char.IsDigit(myMoney[x]))
{
bb += myMoney[x];
}
else if (myMoney[x] == '-' && bb.Length == 0)
{
// اگر علامت منفی قبل از اولین عدد آمد، در نظر بگیر
isNegative = true;
}
}
if (bb.Length > 0)
{
double res = double.Parse(bb);
return isNegative ? -res : res;
if (bb.Length > 0)
{
double res = double.Parse(bb);
return isNegative ? -res : res;
}
else
{
return 0;
}
}
else
{
return 0;
}
}
else
catch (Exception)
{
return 0;
}
}

View File

@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
namespace _0_Framework.Exceptions;
@@ -14,5 +15,13 @@ public class BadRequestException:Exception
Details = details;
}
public BadRequestException(string message, Dictionary<string, object?> extra) :
base(message)
{
Extra = extra;
}
public string Details { get; }
public Dictionary<string,object> Extra { get; set; }
}

View File

@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Diagnostics;
@@ -24,37 +25,42 @@ public class CustomExceptionHandler : IExceptionHandler
"Error Message: {exceptionMessage}, Time of occurrence {time}",
exception.Message, DateTime.UtcNow);
(string Detail, string Title, int StatusCode) details = exception switch
(string Detail, string Title, int StatusCode, Dictionary<string, object>? Extra) details = exception switch
{
InternalServerException =>
(
exception.Message,
exception.GetType().Name,
context.Response.StatusCode = StatusCodes.Status500InternalServerError
context.Response.StatusCode = StatusCodes.Status500InternalServerError,
null
),
BadRequestException =>
BadRequestException bre =>
(
exception.Message,
exception.GetType().Name,
context.Response.StatusCode = StatusCodes.Status400BadRequest
context.Response.StatusCode = StatusCodes.Status400BadRequest,
bre.Extra
),
NotFoundException =>
(
exception.Message,
exception.GetType().Name,
context.Response.StatusCode = StatusCodes.Status404NotFound
context.Response.StatusCode = StatusCodes.Status404NotFound,
null
),
UnAuthorizeException =>
(
exception.Message,
exception.GetType().Name,
context.Response.StatusCode = StatusCodes.Status401Unauthorized
context.Response.StatusCode = StatusCodes.Status401Unauthorized,
null
),
_ =>
(
exception.Message,
exception.GetType().Name,
context.Response.StatusCode = StatusCodes.Status500InternalServerError
context.Response.StatusCode = StatusCodes.Status500InternalServerError,
null
)
};
@@ -63,9 +69,12 @@ public class CustomExceptionHandler : IExceptionHandler
Title = details.Title,
Detail = details.Detail,
Status = details.StatusCode,
Instance = context.Request.Path
Instance = context.Request.Path,
Extensions = details.Extra ?? new Dictionary<string, object>()
};
problemDetails.Extensions.Add("traceId", context.TraceIdentifier);
await context.Response.WriteAsJsonAsync(problemDetails, cancellationToken: cancellationToken);

View File

@@ -0,0 +1,8 @@
namespace _0_Framework.InfraStructure.Mongo;
public class MongoDbConfig
{
public string ConnectionString { get; set; } = null!;
public string DatabaseName { get; set; } = null!;
}

View File

@@ -5,14 +5,14 @@ namespace _0_Framework.InfraStructure;
public static class QueryableExtensions
{
public static IQueryable<T> ApplyPagination<T>(this IQueryable<T> query, int page, int pageSize)
public static IQueryable<T> ApplyPagination<T>(this IQueryable<T> query, int page, int pageSize = 30)
{
if (page <= 0) page = 1;
if (pageSize <= 0) pageSize = 10;
return query.Skip((page - 1) * pageSize).Take(pageSize);
}
public static IEnumerable<T> ApplyPagination<T>(this IEnumerable<T> source, int page, int pageSize)
public static IEnumerable<T> ApplyPagination<T>(this IEnumerable<T> source, int page, int pageSize = 30)
{
if (page <= 0) page = 1;
if (pageSize <= 0) pageSize = 10;

View File

@@ -10,7 +10,7 @@ namespace Company.Domain.ClassifiedSalaryAgg
{
public class ClassifiedSalary : EntityBase
{
//test
//test//test
public ClassifiedSalary(double group1, double group2, double group3, double group4, double group5, double group6, double group7, double group8, double group9, double group10, double group11, double group12, double group13, double group14, double group15, double group16, double group17, double group18, double group19, double group20, DateTime startDate, DateTime endDate, int year)
{
Group1 = group1;

View File

@@ -18,4 +18,8 @@
<Folder Include="CheckoutAgg\ValueObjects\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="MongoDB.Bson" Version="3.5.0" />
</ItemGroup>
</Project>

View File

@@ -74,4 +74,6 @@ public interface IPersonalContractingPartyRepository :IRepository<long, Personal
Task<GetRealContractingPartyDetailsViewModel> GetRealDetails(long id);
Task<GetLegalContractingPartyDetailsViewModel> GetLegalDetails(long id);
Task<PersonalContractingParty> GetByNationalCode(string nationalCode);
Task<PersonalContractingParty> GetByRegisterId(string registerId);
}

View File

@@ -83,6 +83,17 @@ public class PersonalContractingParty : EntityBase
/// سمت و صاحب امضاء اوراق (فقط برای طرف حقوقی)
/// </summary>
public string LegalPosition { get; private set; }
/// <summary>
/// نام مدیر عامل (فقط برای طرف حقوقی)
/// </summary>
public string CeoFName { get; private set; }
/// <summary>
/// نام خانوادگی مدیر عامل (فقط برای طرف حقوقی)
/// </summary>
public string CeoLName { get; private set; }
#endregion
@@ -98,7 +109,8 @@ public class PersonalContractingParty : EntityBase
public PersonalContractingParty(string fName, string lName, string nationalcode, string idNumber,
/*string legalName,*/ string registerId, string nationalId, string isLegal,
string phone, string agentPhone, string address,long representativeId,
string representativeFullName, int archiveCode, string state,string city, string zone, string sureName,string legalPosition=null)
string representativeFullName, int archiveCode, string state,string city,
string zone, string sureName,string ceoFName,string ceoLName,string legalPosition=null)
{
FName = fName;
@@ -125,6 +137,8 @@ public class PersonalContractingParty : EntityBase
IsBlock = "false";
BlockTimes = 0;
LegalPosition = legalPosition;
CeoFName = ceoFName;
CeoLName = ceoLName;
}
@@ -208,7 +222,8 @@ public class PersonalContractingParty : EntityBase
IsAuthenticated = true;
}
public void Authentication(string fName, string lName, string fatherName,string idNumber, string idNumberSeri, string idNumberSerial, string dateOfBirth, Gender gender)
public void Authentication(string fName, string lName, string fatherName,string idNumber,
string idNumberSeri, string idNumberSerial, string dateOfBirth, Gender gender,string phone)
{
this.FName = fName;
this.LName = lName;
@@ -219,6 +234,22 @@ public class PersonalContractingParty : EntityBase
this.IdNumber = idNumber;
this.Gender = gender;
this.IsAuthenticated = true;
Phone = phone;
}
public void LegalAuthentication(string fName, string lName, string fatherName,string idNumber, string idNumberSeri,
string idNumberSerial, string dateOfBirth, Gender gender,string phone)
{
CeoFName = fName;
CeoLName = lName;
this.FatherName = fatherName;
this.IdNumberSeri = idNumberSeri;
this.IdNumberSerial = idNumberSerial;
this.DateOfBirth = !string.IsNullOrWhiteSpace(dateOfBirth) ? dateOfBirth.ToGeorgianDateTime() : null;
this.IdNumber = idNumber;
this.Gender = gender;
this.IsAuthenticated = true;
Phone = phone;
}
public void RegisterComplete(string fatherName, string idNumberSeri, string idNumberSerial, DateTime dateOfBirth, Gender gender)

View File

@@ -17,7 +17,7 @@ public class Contract : EntityBase
public Contract(long personnelCode, long employeeId, long employerId,
long workshopIds, long yearlySalaryId, DateTime contarctStart, DateTime contractEnd, string dayliWage,
string archiveCode, DateTime getWorkDate, DateTime setContractDate, string jobType,
string contractType, string workshopAddress1, string workshopAddress2, string consumableItems, long jobTypeId, string housingAllowance, string agreementSalary, string workingHoursWeekly, string familyAllowance, string contractPeriod)
string contractType, string workshopAddress1, string workshopAddress2, string consumableItems, long jobTypeId, string housingAllowance, string agreementSalary, string workingHoursWeekly, string familyAllowance, string contractPeriod, double dailySalaryAffected, double baseYearAffected, double dailySalaryUnAffected, double baseYearUnAffected, bool hasManualDailyWage, string dailyWageType)
{
PersonnelCode = personnelCode;
EmployeeId = employeeId;
@@ -45,6 +45,19 @@ public class Contract : EntityBase
WorkingHoursWeekly = workingHoursWeekly;
FamilyAllowance = familyAllowance;
ContractPeriod = contractPeriod;
//پراپرتی های جدید برای دستمزد دلخواه
#region NewManualDailyWage
DailySalaryAffected = dailySalaryAffected;
BaseYearAffected = baseYearAffected;
DailySalaryUnAffected = dailySalaryUnAffected;
BaseYearUnAffected = baseYearUnAffected;
HasManualDailyWage = hasManualDailyWage;
DailyWageType = dailyWageType;
#endregion
Signature = "0";
@@ -65,7 +78,42 @@ public class Contract : EntityBase
public DateTime SetContractDate { get; private set; }
public string JobType { get; private set; }
public string ContractType { get; private set; }
/// <summary>
/// مزد تجمیعی یعد از تاثیر ساعت کار
/// </summary>
public string DayliWage { get; private set; }
/// <summary>
/// دستمزد روزانه خام بعد از تاثیر ساعت کار
/// </summary>
public double DailySalaryAffected { get; set; }
/// <summary>
/// پایه سنوات بعد از تاثیر ساعت کار
/// </summary>
public double BaseYearAffected { get; set; }
/// <summary>
/// دستمزد روزانه قبل از تاثیر ساعت کار
/// </summary>
public double DailySalaryUnAffected { get; set; }
/// <summary>
/// پایه سنوات قبل از تاثیر ساعت کار
/// </summary>
public double BaseYearUnAffected { get; set; }
/// <summary>
/// آیا دستمزد روزانه دستی وارد شده است؟
/// </summary>
public bool HasManualDailyWage { get; set; }
/// <summary>
/// نوع دستمزد انتخاب شده
/// </summary>
public string DailyWageType { get; set; }
public string IsActiveString { get; private set; }
public string ArchiveCode { get; private set; }
public string WorkshopAddress1 { get; private set; }
@@ -89,6 +137,7 @@ public class Contract : EntityBase
public Contract()
{
WorkingHoursList = new List<WorkingHours>();
}
public void Edit(long pesrsonnelCode, long employeeId, long employerId, long workshopId, long yearlySalaryId,

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using _0_Framework.Application;
using _0_Framework.Domain;
using CompanyManagment.App.Contracts.Contract;
@@ -9,6 +10,24 @@ namespace Company.Domain.ContractAgg;
public interface IContractRepository : IRepository<long, Contract>
{
/// <summary>
/// دریافت مزد ارتقاء یافته
/// </summary>
/// <param name="workshopId"></param>
/// <param name="employeeId"></param>
/// <param name="yearlySalaryId"></param>
/// <returns></returns>
Task<double> GetManualDailWage(long workshopId, long employeeId, long yearlySalaryId, DateTime contractStart);
/// <summary>
/// دریافت لیست مزد ارتقاء یافته
/// </summary>
/// <param name="workshopId"></param>
/// <param name="employeeId"></param>
/// <param name="contractStart"></param>
/// <returns></returns>
Task<UpgradeManualDailyWageModel> GetManualDailWageList(long workshopId, long employeeId,
DateTime contractStart);
EditContract GetDetails(long id);
EditContract GetContractByStartEnd(DateTime start, DateTime end, long workshopId, long employeeId);

View File

@@ -23,4 +23,5 @@ public interface IFinancialStatmentRepository : IRepository<long, FinancialStatm
Task<GetFinancialStatementBalanceAmount> GetBalanceAmount(long id);
Task<double> GetClientDebtAmount(long accountId);
Task<FinancialStatmentDetailsByContractingPartyViewModel> GetDetailsByContractingParty(long contractingPartyId,FinancialStatementSearchModel searchModel);
Task<FinancialStatment> GetByContractingPartyId(long contractingPartyId);
}

View File

@@ -49,7 +49,15 @@ public interface IInstitutionContractRepository : IRepository<long, InstitutionC
Task<GetInstitutionContractListStatsViewModel> GetListStats(InstitutionContractListSearchModel searchModel);
Task<List<RegistrationWorkflowMainListViewModel>> RegistrationWorkflowMainList();
Task<List<RegistrationWorkflowItemsViewModel>> RegistrationWorkflowItems(long institutionContractId);
Task<InstitutionContractWorkshopDetail> GetInstitutionWorkshopDetails(long institutionWorkshopDetailsId);
Task<InstitutionContractWorkshopInitial> GetInstitutionWorkshopInitialDetails(long institutionWorkshopInitialId);
Task<InstitutionContract> GetIncludeWorkshopDetailsAsync(long institutionContractId);
void UpdateStatusIfNeeded(long institutionContractId);
Task<GetInstitutionVerificationDetailsViewModel> GetVerificationDetails(Guid id);
Task<InstitutionContract> GetByPublicIdAsync(Guid id);
Task<InstitutionContractExtensionInquiryResult> GetExtensionInquiry(long previousContractId);
Task<InstitutionContractExtensionWorkshopsResponse> GetExtensionWorkshops(InstitutionContractExtensionWorkshopsRequest request);
Task<InstitutionContractExtensionPlanResponse> GetExtensionInstitutionPlan(InstitutionContractExtensionPlanRequest request);
Task<InstitutionContractExtensionPaymentResponse> GetExtensionPaymentMethod(InstitutionContractExtensionPaymentRequest request);
Task<OperationResult> ExtensionComplete(InstitutionContractExtensionCompleteRequest request);
Task<List<InstitutionContractSelectListViewModel>> GetInstitutionContractSelectList(string search, string selected);
}

View File

@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Security.Cryptography;
using _0_Framework.Application;
using _0_Framework.Domain;
using Company.Domain.InstitutionContractContactInfoAgg;
using CompanyManagment.App.Contracts.InstitutionContract;
@@ -16,7 +16,8 @@ public class InstitutionContract : EntityBase
string address, DateTime contractStartGr, string contractStartFa, DateTime contractEndGr,
string contractEndFa, double contractAmount, double dailyCompenseation, double obligation,
double totalAmount, int extensionNo, string workshopManualCount, string employeeManualCount, string description,
string officialCompany, string typeOfcontract, string hasValueAddedTax, double valueAddedTax)
string officialCompany, string typeOfcontract, string hasValueAddedTax, double valueAddedTax,
List<InstitutionContractWorkshopInitial> workshopDetails, long lawId)
{
ContractNo = contractNo;
RepresentativeId = representativeId;
@@ -48,29 +49,43 @@ public class InstitutionContract : EntityBase
TypeOfContract = typeOfcontract;
HasValueAddedTax = hasValueAddedTax;
ValueAddedTax = valueAddedTax;
Status = InstitutionContractStatus.Incomplete;
VerificationStatus = InstitutionContractVerificationStatus.PendingForVerify;
ContactInfoList = [];
WorkshopDetails = [];
Installments = [];
WorkshopGroup = new InstitutionContractWorkshopGroup(id, workshopDetails);
PublicId = Guid.NewGuid();
LawId = lawId;
}
public long LawId { get; private set; }
public string ContractNo { get; private set; }
public long RepresentativeId { get; private set; }
public string RepresentativeName { get; private set; }
public long ContractingPartyId { get; private set; }
public string ContractingPartyName { get; private set; }
public DateTime ContractDateGr { get; private set; }
public string ContractDateFa { get; private set; }
public string State { get; private set; }
public string City { get; private set; }
public string Address { get; private set; }
//public long ContactInfoId { get; private set; }
public DateTime ContractStartGr { get; private set; }
public string ContractStartFa { get; private set; }
public DateTime ContractEndGr { get; private set; }
public string ContractEndFa { get; private set; }
// مبلغ قرارداد
@@ -84,28 +99,59 @@ public class InstitutionContract : EntityBase
// مبلغ کل قرارداد
public double TotalAmount { get; private set; }
public string WorkshopManualCount { get; private set; }
public string EmployeeManualCount { get; private set; }
public string IsActiveString { get; private set; }
public int ExtensionNo { get; private set; }
public string Description { get; private set; }
public string Signature { get; private set; }
public string OfficialCompany { get; private set; }
public string TypeOfContract { get; private set; }
public string HasValueAddedTax { get; set; }
public double ValueAddedTax { get; set; }
public InstitutionContractStatus Status { get; private set; }
public List<InstitutionContractWorkshopDetail> WorkshopDetails { get; set; }
public string WorkshopManualCount { get; private set; }
public string EmployeeManualCount { get; private set; }
public string IsActiveString { get; private set; }
public int ExtensionNo { get; private set; }
public string Description { get; private set; }
public string Signature { get; private set; }
public string OfficialCompany { get; private set; }
public string TypeOfContract { get; private set; }
public string HasValueAddedTax { get; private set; }
public double ValueAddedTax { get; private set; }
public Guid PublicId { get; private set; }
public string VerifyCode { get; private set; }
public DateTime VerifyCodeCreation { get; private set; }
[NotMapped]
public bool VerifyCodeExpired => VerifyCodeCreation.Add(ExpireTime) <= DateTime.Now;
[NotMapped]
public bool CanResendVerifyCode => VerifyCodeCreation.Add(ReSendTime) <= DateTime.Now;
[NotMapped] public TimeSpan ExpireTime => TimeSpan.FromMinutes(5);
[NotMapped] public TimeSpan ReSendTime => TimeSpan.FromMinutes(2);
public bool IsInstallment { get; set; }
public InstitutionContractVerificationStatus VerificationStatus { get; private set; }
public InstitutionContractWorkshopGroup WorkshopGroup { get; private set; }
public List<InstitutionContractContactInfo> ContactInfoList { get; set; }
public List<InstitutionContractInstallment> Installments { get; set; }
public List<InstitutionContractAmendment> Amendments { get; private set; }
public InstitutionContract()
{
ContactInfoList = [];
WorkshopDetails = [];
Installments = [];
}
@@ -164,176 +210,131 @@ public class InstitutionContract : EntityBase
this.Signature = "0";
}
public void Complete()
public void Verified()
{
Status = InstitutionContractStatus.Completed;
VerificationStatus = InstitutionContractVerificationStatus.Verified;
}
public void SetWorkshopDetails(List<InstitutionContractWorkshopDetail> commandWorkshops)
public void SetPendingWorkflow()
{
WorkshopDetails = commandWorkshops;
VerificationStatus = InstitutionContractVerificationStatus.PendingWorkflow;
}
public void SetInstallments(List<InstitutionContractInstallment> installments)
{
Installments = installments;
IsInstallment = true;
}
public void SetVerifyCode(string code)
{
VerifyCode = code;
VerifyCodeCreation = DateTime.Now;
}
public void SetWorkshopGroup(InstitutionContractWorkshopGroup workshopGroup)
{
WorkshopGroup = workshopGroup;
}
public void SetAmount(double totalAmount, double tax, double oneMonthPayment)
{
ContractAmount = oneMonthPayment;
TotalAmount = totalAmount;
ValueAddedTax = tax;
HasValueAddedTax = tax > 0 ? "true" : "false";
}
public void ClearGroup()
{
WorkshopGroup = null;
}
}
public class InstitutionContractWorkshopDetail:EntityBase
public class InstitutionContractAmendment : EntityBase
{
public InstitutionContractWorkshopDetail(string workshopName, bool hasRollCallPlan,
bool hasCustomizeCheckoutPlan, bool hasContractPlan,bool hasContractPlanInPerson,bool hasInsurancePlan,bool hasInsurancePlanInPerson,
int personnelCount, double price)
{
WorkshopName = workshopName;
HasRollCallPlan = hasRollCallPlan;
HasCustomizeCheckoutPlan = hasCustomizeCheckoutPlan;
HasContractPlan = hasContractPlan;
HasContractPlanInPerson = hasContractPlanInPerson;
HasInsurancePlan = hasInsurancePlan;
HasInsurancePlanInPerson = hasInsurancePlanInPerson;
PersonnelCount = personnelCount;
WorkshopCreated = false;
Price = price;
Employers = [];
}
public long InstitutionContractId { get; set; }
public InstitutionContract InstitutionContract { get; set; }
public List<InstitutionContractInstallment> Installments { get; set; }
public double Amount { get; set; }
public bool HasInstallment { get; set; }
public string VerifyCode { get; set; }
public DateTime VerificationCreation { get; set; }
public List<InstitutionContractAmendmentChange> AmendmentChanges { get; set; }
}
/// <summary>
/// شناسه کارگاه
/// </summary>
public long? WorkshopId { get; private set; }
/// <summary>
/// نام کارگاه
/// </summary>
public string WorkshopName { get; private set; }
public class InstitutionContractAmendmentChange : EntityBase
{
public long InstitutionContractAmendmentId { get; private set; }
public InstitutionContractAmendment InstitutionContractAmendment { get; private set; }
public InstitutionContractAmendmentChangeType ChangeType { get; private set; }
public DateTime ChangeDateGr { get; private set; }
/// <summary>
/// پلن حضور و غیاب
/// </summary>
public bool HasRollCallPlan { get; private set; }
public bool? HasRollCallPlan { get; private set; }
/// <summary>
/// پلن فیش غیر رسمی
/// </summary>
public bool HasCustomizeCheckoutPlan { get; private set; }
public bool? HasCustomizeCheckoutPlan { get; private set; }
/// <summary>
/// پلن قرارداد و تصفیه
/// </summary>
public bool HasContractPlan { get; private set; }
public bool? HasContractPlan { get; private set; }
/// <summary>
/// پلن قرارداد و تصفیه حضوری
/// </summary>
public bool HasContractPlanInPerson { get; private set; }
public bool? HasContractPlanInPerson { get; private set; }
/// <summary>
/// پلن بیمه
/// </summary>
public bool HasInsurancePlan { get; private set; }
public bool? HasInsurancePlan { get; private set; }
/// <summary>
/// پلن بیمه حضوری
/// </summary>
public bool HasInsurancePlanInPerson { get; private set; }
public int PersonnelCount { get; private set; }
public bool WorkshopCreated { get; private set; }
public bool? HasInsurancePlanInPerson { get; private set; }
/// <summary>
/// شناسه قرارداد نهاد مرتبط
/// تعداد پرسنل
/// </summary>
public long InstitutionContractId { get; private set; }
public int? PersonnelCount { get; private set; }
/// <summary>
/// Navigation property to InstitutionContract
/// تعداد کارگاه
/// </summary>
public InstitutionContract InstitutionContract { get; private set; }
public double Price { get; private set; }
public long? WorkshopDetailsId { get; private set; }
private InstitutionContractWorkshopDetail()
{
}
public List<InstitutionContractWorkshopDetailEmployer> Employers { get; private set; } = new();
public void SetEmployers(List<long> employerIds)
{
Employers.Clear();
foreach (var employerId in employerIds)
{
Employers.Add(new InstitutionContractWorkshopDetailEmployer(id, employerId));
}
}
public void AddEmployer(long employerId)
{
if (Employers.Exists(x => x.EmployerId == employerId))
return;
Employers.Add(new InstitutionContractWorkshopDetailEmployer(id, employerId));
}
public void Edit(bool hasAttendancePlan, bool hasUnofficialPayslipPlan, bool hasContractSettlementPlan)
{
HasRollCallPlan = hasAttendancePlan;
HasCustomizeCheckoutPlan = hasUnofficialPayslipPlan;
HasContractPlan = hasContractSettlementPlan;
}
public void SetWorkshopId(long workshopId)
{
WorkshopId = workshopId;
WorkshopCreated = true;
}
}
public enum InstitutionContractStatus
public enum InstitutionContractAmendmentChangeType
{
/// <summary>
/// ناتمام - قرارداد هنوز تکمیل نشده و نیاز به انجام کارهای بیشتر دارد
/// </summary>
Incomplete = 0,
/// <summary>
/// تکمیل شده - قرارداد به طور کامل انجام شده و نهایی شده است
/// </summary>
Completed = 1
PersonCount,
Services,
WorkshopCreated
}
public class InstitutionContractInstallment
public enum InstitutionContractVerificationStatus
{
public InstitutionContractInstallment(DateTime installmentDateGr, double amount,
string description)
{
InstallmentDateGr = installmentDateGr;
InstallmentDateFa = installmentDateGr.ToFarsi();
Amount = amount;
Description = description;
}
/// <summary>
/// در انتظار تایید
/// </summary>
PendingForVerify = 0,
public long Id { get; private set; }
public DateTime InstallmentDateGr { get; private set; }
public string InstallmentDateFa { get; private set; }
public double Amount { get; private set; }
public string Description { get; private set; }
public long InstitutionContractId { get; private set; }
public InstitutionContract InstitutionContract { get; private set; }
}
public class InstitutionContractWorkshopDetailEmployer : EntityBase
{
public long InstitutionContractWorkshopDetailId { get; private set; }
public long EmployerId { get; private set; }
public InstitutionContractWorkshopDetailEmployer(long institutionContractWorkshopDetailId, long employerId)
{
InstitutionContractWorkshopDetailId = institutionContractWorkshopDetailId;
EmployerId = employerId;
}
private InstitutionContractWorkshopDetailEmployer() { }
/// <summary>
/// در انتظار کارپوشه
/// </summary>
PendingWorkflow = 1,
/// <summary>
/// تایید شده
/// </summary>
Verified = 2
}

View File

@@ -0,0 +1,28 @@
using System;
using _0_Framework.Application;
namespace Company.Domain.InstitutionContractAgg;
public class InstitutionContractInstallment
{
public InstitutionContractInstallment(DateTime installmentDateGr, double amount,
string description)
{
InstallmentDateGr = installmentDateGr;
InstallmentDateFa = installmentDateGr.ToFarsi();
Amount = amount;
Description = description;
}
public long Id { get; private set; }
public DateTime InstallmentDateGr { get; private set; }
public string InstallmentDateFa { get; private set; }
public double Amount { get; private set; }
public string Description { get; private set; }
public long InstitutionContractId { get; private set; }
public long? InstitutionContractAmendmentId { get; private set; }
public InstitutionContract InstitutionContract { get; private set; }
public InstitutionContractAmendment InstitutionContractAmendment { get; set; }
}

View File

@@ -0,0 +1,84 @@
using System;
using System.Collections.Generic;
using _0_Framework.Domain;
namespace Company.Domain.InstitutionContractAgg;
public class InstitutionContractWorkshopBase:EntityBase
{
protected InstitutionContractWorkshopBase(){}
public InstitutionContractWorkshopBase(string workshopName, bool hasRollCallPlan,bool hasRollCallPlanInPerson,
bool hasCustomizeCheckoutPlan, bool hasContractPlan,bool hasContractPlanInPerson,bool hasInsurancePlan,bool hasInsurancePlanInPerson,
int personnelCount, double price )
{
WorkshopName = workshopName;
Services = new WorkshopServices(hasInsurancePlan, hasInsurancePlanInPerson,
hasContractPlan, hasContractPlanInPerson, hasRollCallPlan, hasRollCallPlanInPerson,hasCustomizeCheckoutPlan);
PersonnelCount = personnelCount;
Price = price;
Employers = [];
}
/// <summary>
/// شناسه کارگاه
/// </summary>
public long? WorkshopId { get; protected set; }
/// <summary>
/// نام کارگاه
/// </summary>
public string WorkshopName { get; private set; }
public WorkshopServices Services { get; set; } = new (false, false,
false, false, false,
false, false);
public int PersonnelCount { get; private set; }
/// <summary>
/// شناسه قرارداد نهاد مرتبط
/// </summary>
public long InstitutionContractId { get; private set; }
public double Price { get; private set; }
public List<InstitutionContractWorkshopDetailEmployer> Employers { get; private set; } = new();
public void SetEmployers(List<long> employerIds)
{
Employers.Clear();
foreach (var employerId in employerIds)
{
Employers.Add(new InstitutionContractWorkshopDetailEmployer(employerId));
}
}
public void AddEmployer(long employerId)
{
if (Employers.Exists(x => x.EmployerId == employerId))
return;
Employers.Add(new InstitutionContractWorkshopDetailEmployer(employerId));
}
// ⚡️ Equality Implementation
public override bool Equals(object? obj)
{
if (obj is not InstitutionContractWorkshopBase other)
return false;
return WorkshopName == other.WorkshopName &&
PersonnelCount == other.PersonnelCount &&
Price == other.Price &&
Services == other.Services;
}
public override int GetHashCode()
{
return HashCode.Combine(WorkshopName, PersonnelCount, Price, Services);
}
}

View File

@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using _0_Framework_b.Domain;
namespace Company.Domain.InstitutionContractAgg;
public class InstitutionContractWorkshopCurrent:InstitutionContractWorkshopBase
{
private InstitutionContractWorkshopCurrent(){}
public InstitutionContractWorkshopCurrent(string workshopName, bool hasRollCallPlan,
bool hasRollCallPlanInPerson, bool hasCustomizeCheckoutPlan, bool hasContractPlan,
bool hasContractPlanInPerson, bool hasInsurancePlan, bool hasInsurancePlanInPerson,
int personnelCount, double price,long institutionContractWorkshopGroupId,InstitutionContractWorkshopGroup workshopGroup,long workshopId) : base(workshopName, hasRollCallPlan,
hasRollCallPlanInPerson, hasCustomizeCheckoutPlan, hasContractPlan,
hasContractPlanInPerson, hasInsurancePlan, hasInsurancePlanInPerson, personnelCount, price)
{
InstitutionContractWorkshopGroupId = institutionContractWorkshopGroupId;
WorkshopGroup = workshopGroup;
WorkshopId = workshopId;
}
public long InstitutionContractWorkshopGroupId { get; private set; }
public InstitutionContractWorkshopGroup WorkshopGroup { get; private set; }
public long InitialWorkshopId { get; private set; }
public InstitutionContractWorkshopInitial WorkshopInitial { get; private set; }
}

View File

@@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using _0_Framework_b.Domain;
namespace Company.Domain.InstitutionContractAgg;
public class InstitutionContractWorkshopGroup : EntityBase
{
private InstitutionContractWorkshopGroup()
{
}
public long InstitutionContractId { get; private set; }
public InstitutionContract InstitutionContract { get; set; }
public List<InstitutionContractWorkshopInitial> InitialWorkshops { get; private set; }
public List<InstitutionContractWorkshopCurrent> CurrentWorkshops { get; private set; }
public DateTime LastModifiedDate { get; private set; }
[NotMapped]
public bool HasChanges =>
!InitialWorkshops.Cast<InstitutionContractWorkshopBase>()
.SequenceEqual(CurrentWorkshops.Cast<InstitutionContractWorkshopBase>());
public InstitutionContractWorkshopGroup(long institutionContractId,
List<InstitutionContractWorkshopInitial> initialDetails)
{
InstitutionContractId = institutionContractId;
var initialWorkshops = initialDetails.ToList();
InitialWorkshops = initialWorkshops.ToList();
LastModifiedDate = DateTime.Now;
}
public void UpdateCurrentWorkshops(List<InstitutionContractWorkshopCurrent> updatedDetails)
{
CurrentWorkshops = updatedDetails.ToList();
LastModifiedDate = DateTime.Now;
}
}

View File

@@ -0,0 +1,70 @@
using System.Collections.Generic;
using System.Linq;
using _0_Framework.Domain;
using CompanyManagment.App.Contracts.InstitutionContract;
namespace Company.Domain.InstitutionContractAgg;
public class InstitutionContractWorkshopInitial:InstitutionContractWorkshopBase
{
private InstitutionContractWorkshopInitial(){}
public InstitutionContractWorkshopInitial(string workshopName, bool hasRollCallPlan,
bool hasRollCallPlanInPerson, bool hasCustomizeCheckoutPlan, bool hasContractPlan,
bool hasContractPlanInPerson, bool hasInsurancePlan, bool hasInsurancePlanInPerson,
int personnelCount, double price) : base(workshopName, hasRollCallPlan,
hasRollCallPlanInPerson, hasCustomizeCheckoutPlan, hasContractPlan, hasContractPlanInPerson,
hasInsurancePlan, hasInsurancePlanInPerson, personnelCount, price)
{
WorkshopCreated = false;
}
public long InstitutionContractWorkshopGroupId { get; private set; }
public InstitutionContractWorkshopGroup WorkshopGroup { get; private set; }
public bool WorkshopCreated { get; private set; }
public InstitutionContractWorkshopCurrent? WorkshopCurrent { get; private set; }
public long? InstitutionContractWorkshopCurrentId { get; private set; }
public void SetWorkshopId(long workshopId)
{
WorkshopId = workshopId;
WorkshopCreated = true;
WorkshopCurrent = new InstitutionContractWorkshopCurrent(WorkshopName,Services.RollCall,Services.RollCallInPerson,
Services.CustomizeCheckout,Services.Contract,Services.ContractInPerson,Services.Insurance,
Services.InsuranceInPerson,PersonnelCount,Price,InstitutionContractWorkshopGroupId,WorkshopGroup,workshopId);
WorkshopCurrent.SetEmployers(Employers.Select(x=>x.EmployerId).ToList());
}
public static InstitutionContractWorkshopInitial CreateManual(string workshopName, bool hasRollCallPlan,
bool hasRollCallPlanInPerson, bool hasCustomizeCheckoutPlan, bool hasContractPlan,
bool hasContractPlanInPerson, bool hasInsurancePlan, bool hasInsurancePlanInPerson,
int personnelCount, double price, long workshopId,List<long> employerIds)
{
var entity = new InstitutionContractWorkshopInitial(workshopName, hasRollCallPlan,
hasRollCallPlanInPerson, hasCustomizeCheckoutPlan, hasContractPlan, hasContractPlanInPerson,
hasInsurancePlan, hasInsurancePlanInPerson, personnelCount, price);
entity.WorkshopCreated = true;
entity.WorkshopId = workshopId;
entity.SetEmployers(employerIds);
return entity;
}
public void SetWorkshopGroup(InstitutionContractWorkshopGroup entityWorkshopGroup)
{
InstitutionContractWorkshopGroupId = entityWorkshopGroup.id;
WorkshopGroup = entityWorkshopGroup;
}
}
public class InstitutionContractWorkshopDetailEmployer : EntityBase
{
public long EmployerId { get; private set; }
public InstitutionContractWorkshopDetailEmployer(long employerId)
{
EmployerId = employerId;
}
private InstitutionContractWorkshopDetailEmployer() { }
}

View File

@@ -0,0 +1,23 @@
namespace Company.Domain.InstitutionContractAgg;
public record WorkshopServices
{
public WorkshopServices(bool insurance, bool insuranceInPerson, bool contract, bool contractInPerson, bool rollCall, bool rollCallInPerson, bool customizeCheckout)
{
Insurance = insurance;
InsuranceInPerson = insuranceInPerson;
Contract = contract;
ContractInPerson = contractInPerson;
RollCall = rollCall;
CustomizeCheckout = customizeCheckout;
RollCallInPerson = rollCallInPerson;
}
public bool Insurance { get; private set; }
public bool InsuranceInPerson { get; private set; }
public bool Contract { get; private set; }
public bool ContractInPerson { get; private set; }
public bool RollCall { get; private set; }
public bool RollCallInPerson { get; private set; }
public bool CustomizeCheckout { get; private set; }
}

View File

@@ -0,0 +1,13 @@
using System;
using System.Threading.Tasks;
using _0_Framework.Application;
namespace Company.Domain.InstitutionContractInsertTempAgg;
public interface IInstitutionContractExtenstionTempRepository
{
Task Create(InstitutionContractExtensionTemp institutionContract);
Task<InstitutionContractExtensionTemp> GetPreviousExtenstionData(long contractingPartyId);
Task Remove(Guid id);
}

View File

@@ -0,0 +1,168 @@
using System;
using System.Collections.Generic;
using CompanyManagment.App.Contracts.InstitutionContract;
using CompanyManagment.App.Contracts.InstitutionContractContactinfo;
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
namespace Company.Domain.InstitutionContractInsertTempAgg;
public class InstitutionContractExtensionTemp
{
public InstitutionContractExtensionTemp(long previousContractingPartyId)
{
Id = Guid.NewGuid();
PreviousId = previousContractingPartyId;
}
[BsonId] // Specifies this field as the _id in MongoDB
[BsonRepresentation(BsonType.String)] // Ensures the GUID is stored as a string
public Guid Id { get; set; }
public long PreviousId { get; set; }
public string Address { get; set; }
public string City { get; set; }
public string Province { get; set; }
public List<EditContactInfo> ContactInfos { get; set; }
public List<InstitutionContractExtensionTempWorkshop> Workshops { get; set; }
public InstitutionContractExtensionPlanDetail OneMonth { get; set; }
public InstitutionContractExtensionPlanDetail ThreeMonths { get; set; }
public InstitutionContractExtensionPlanDetail SixMonths { get; set; }
public InstitutionContractExtensionPlanDetail TwelveMonths { get; set; }
public InstitutionContractExtensionPaymentMonthly MonthlyPayment { get; set; }
public InstitutionContractExtensionPaymentOneTime OneTimePayment { get; set; }
public bool HasContractInPerson { get; set; }
public InstitutionContractDuration? Duration { get; set; }
public void SetContractingPartyInfos(string address, string city, string province, List<EditContactInfo> contactInfos)
{
Address = address;
City = city;
Province = province;
ContactInfos = contactInfos;
}
public void SetWorkshopsAndPlanAmounts(List<InstitutionContractExtensionTempWorkshop> workshops,
InstitutionContractExtensionPlanDetail oneMonth,
InstitutionContractExtensionPlanDetail threeMonth, InstitutionContractExtensionPlanDetail sixMonth,
InstitutionContractExtensionPlanDetail twelveMonth, bool hasContractInPerson)
{
Workshops = workshops;
OneMonth = oneMonth;
ThreeMonths = threeMonth;
SixMonths = sixMonth;
TwelveMonths = twelveMonth;
HasContractInPerson = hasContractInPerson;
}
public void SetAmountAndDuration(InstitutionContractDuration duration,InstitutionContractExtensionPaymentMonthly monthly,
InstitutionContractExtensionPaymentOneTime oneTime)
{
Duration = duration;
MonthlyPayment = monthly;
OneTimePayment = oneTime;
}
}
public class InstitutionContractExtenstionTempPlan
{
public InstitutionContractExtenstionTempPlan(string contractStart, string contractEnd,
string oneMonthPaymentDiscounted, string oneMonthDiscount, string oneMonthOriginalPayment,
string totalPayment, string dailyCompensation, string obligation)
{
ContractStart = contractStart;
ContractEnd = contractEnd;
OneMonthPaymentDiscounted = oneMonthPaymentDiscounted;
OneMonthDiscount = oneMonthDiscount;
OneMonthOriginalPayment = oneMonthOriginalPayment;
TotalPayment = totalPayment;
DailyCompensation = dailyCompensation;
Obligation = obligation;
}
public string ContractStart { get; set; }
public string ContractEnd { get; set; }
public string OneMonthPaymentDiscounted { get; set; }
public string OneMonthDiscount { get; set; }
public string OneMonthOriginalPayment { get; set; }
public string TotalPayment { get; set; }
public string DailyCompensation { get; set; }
public string Obligation { get; set; }
}
public class InstitutionContractExtensionTempWorkshop
{
public InstitutionContractExtensionTempWorkshop(string workshopName, int countPerson, bool contractAndCheckout, bool contractAndCheckoutInPerson,
bool insurance, bool insuranceInPerson,
bool rollCall,bool rollCallInPerson, bool customizeCheckout,double price,long workshopId)
{
WorkshopName = workshopName;
CountPerson = countPerson;
ContractAndCheckout = contractAndCheckout;
Insurance = insurance;
RollCall = rollCall;
CustomizeCheckout = customizeCheckout;
ContractAndCheckoutInPerson = contractAndCheckoutInPerson;
InsuranceInPerson = insuranceInPerson;
RollCallInPerson = rollCallInPerson;
Price = price;
WorkshopId = workshopId;
}
public long WorkshopId { get; set; }
/// <summary>
/// نام کارگاه
/// </summary>
public string WorkshopName { get; private set; }
/// <summary>
/// تعداد پرسنل
/// </summary>
public int CountPerson { get; private set; }
#region ServiceSelection
/// <summary>
/// قرارداد و تصفیه
/// </summary>
public bool ContractAndCheckout { get; private set; }
/// <summary>
/// بیمه
/// </summary>
public bool Insurance { get; private set; }
/// <summary>
/// حضورغباب
/// </summary>
public bool RollCall { get; private set; }
public bool RollCallInPerson { get; set; }
/// <summary>
/// فیش غیر رسمی
/// </summary>
public bool CustomizeCheckout { get;private set; }
/// <summary>
/// خدمات حضوری قرداد و تصفیه
/// </summary>
public bool ContractAndCheckoutInPerson { get; private set; }
/// <summary>
/// خدمات حضوری بیمه
/// </summary>
public bool InsuranceInPerson { get; private set; }
public double Price{ get; set; }
#endregion
}

View File

@@ -25,5 +25,6 @@ public interface IInsuranceJobRepositpry:IRepository<long, InsuranceJob>
OperationResult EditInsuranceJob(EditInsuranceJob command);
Task<List<InsuranceJobSelectListViewModel>> GetSelectList();
}

View File

@@ -67,6 +67,8 @@ public interface IInsuranceListRepository:IRepository<long, InsuranceList>
Task<InsuranceListTabsCountViewModel> GetTabCounts(InsuranceListSearchModel searchModel);
#endregion
Task<List<InsuranceListViewModel>> GetNotCreatedWorkshop(InsuranceListSearchModel searchModel);
}

View File

@@ -16,6 +16,7 @@ namespace Company.Domain.LawAgg
public LawType Type { get; private set; }
public string HeadTitle { get; private set; }
public string NotificationsJson { get; private set; }
public int Version { get; private set; }
[NotMapped]
public List<string> Notifications
@@ -26,14 +27,15 @@ namespace Company.Domain.LawAgg
set => NotificationsJson = JsonSerializer.Serialize(value);
}
public Law(string title, LawType lawType, List<string> notifications, string headTitle )
public Law(string title, LawType lawType, List<string> notifications, string headTitle, int version = 1)
{
Title = title;
IsActive = true;
IsActive = true; // آخرین نسخه فعال است
Items = new List<LawItem>();
Type = lawType;
Notifications = notifications ?? new List<string>();
HeadTitle = headTitle;
Version = version;
}
public void Edit(string title)
@@ -46,7 +48,6 @@ namespace Company.Domain.LawAgg
Items.Add(new LawItem(header, details, orderNumber));
}
public void SetItem(List<LawItem> items)
{
Items = items ?? new List<LawItem>();
@@ -67,6 +68,32 @@ namespace Company.Domain.LawAgg
{
IsActive = false;
}
public void SetAsLatestVersion()
{
IsActive = true;
}
public void SetAsOldVersion()
{
IsActive = false;
}
public Law CreateNewVersion(string title, List<string> notifications, string headTitle, List<LawItem> items)
{
var newVersion = new Law(
title,
this.Type,
notifications,
headTitle,
this.Version + 1
);
newVersion.SetItem(items);
newVersion.SetAsLatestVersion();
return newVersion;
}
}
public class LawItem

View File

@@ -22,7 +22,7 @@ public interface ILeaveRepository : IRepository<long, Leave>
bool CheckContractExist(DateTime myDate,long employeeId, long workshopId);
LeavErrorViewModel CheckErrors(DateTime startLeav, DateTime endLeav, long employeeId, long workshopId);
LeavErrorViewModel CheckErrors(DateTime startLeav, DateTime endLeav, long employeeId, long workshopId,bool isInvalid);
LeaveViewModel LeavOnChekout(DateTime starContract, DateTime endContract, long employeeId, long workshopId);
List<LeaveMainViewModel> searchClient(LeaveSearchModel searchModel);
LeavePrintViewModel PrintOne(long id);

View File

@@ -8,7 +8,9 @@ public class Leave: EntityBase
{
public Leave(DateTime startLeave, DateTime endLeave,
string leaveHourses, long workshopId, long employeeId,
string paidLeaveType, string leaveType, string employeeFullName, string workshopName, bool isAccepted, string decription, int year, int month, TimeSpan shiftDuration, bool hasShiftDuration)
string paidLeaveType, string leaveType, string employeeFullName, string workshopName,
bool isAccepted, string decription, int year, int month, TimeSpan shiftDuration,
bool hasShiftDuration,bool isInvalid)
{
StartLeave = startLeave;
EndLeave = endLeave;
@@ -25,6 +27,7 @@ public class Leave: EntityBase
Month = month;
ShiftDuration = shiftDuration;
HasShiftDuration = hasShiftDuration;
IsInvalid = isInvalid;
}
public DateTime StartLeave { get; private set; }
@@ -43,6 +46,10 @@ public class Leave: EntityBase
public TimeSpan ShiftDuration { get; private set; }
public bool HasShiftDuration { get; private set; }
/// <summary>
///آیا فاقد اعتبار است. فاقد اعتبار ها فقط برای فیش های غیررسمی مورد استفاده قرار میگیرند
/// </summary>
public bool IsInvalid { get; private set; }
public void Edit(DateTime startLeave, DateTime endLeave,
string leaveHourses, long workshopId, long employeeId,

View File

@@ -15,7 +15,7 @@ namespace Company.Domain.RollCallAgg;
public interface IRollCallMandatoryRepository : IRepository<long, RollCall>
{
ComputingViewModel MandatoryCompute(long employeeId, long workshopId, DateTime contractStart, DateTime contractEnd, CreateWorkingHoursTemp command, bool holidayWorking, bool isStaticCheckout, bool rotatingShiftCompute, bool totalLeaveCompute);
ComputingViewModel MandatoryCompute(long employeeId, long workshopId, DateTime contractStart, DateTime contractEnd, CreateWorkingHoursTemp command, bool holidayWorking, bool isStaticCheckout, bool rotatingShiftCompute, double dailyWageUnAffected, bool totalLeaveCompute);
/// <summary>
/// محاسبه ساعات کارکرد پرسنل در صورت داشتن حضور غیاب

View File

@@ -70,6 +70,7 @@ public interface IWorkshopRepository : IRepository<long, Workshop>
Task<List<WorkshopWithLeftWorkTempEmployeesDto>> GetWorkshopsForLeftWorkTemp(long accountId);
Task<int> GetWorkshopsForLeftWorkTempCount(long accountId);
Task<List<WorkshopSelectListViewModel>> GetSelectList(string search, long id);
int GetLastArchiveCode();
#endregion

View File

@@ -6,6 +6,7 @@ using CompanyManagment.App.Contracts.YearlySalary;
using System.Threading.Tasks;
using CompanyManagment.App.Contracts.Checkout;
using CompanyManagment.App.Contracts.Holiday;
using CompanyManagment.App.Contracts.Contract;
namespace Company.Domain.YearlySalaryAgg;
@@ -17,11 +18,39 @@ public interface IYearlySalaryRepository : IRepository<long, YearlySalary>
void TestDayliFeeCompute();
List<string> GetYears();
List<YearlySalaryViewModel> GetYearlySalary();
/// <summary>
/// دریافت مزد روزانه فیش حقوقی
/// </summary>
/// <param name="contract"></param>
/// <param name="checkoutStart"></param>
/// <param name="checkoutEnd"></param>
/// <returns></returns>
Task<double> GetCheckoutDailyWage(EditContract contract, DateTime checkoutStart, DateTime checkoutEnd);
/// <summary>
/// دریافت مزد روزانه بر اساس تاریخ شروع و پایان
/// </summary>
/// <param name="start"></param>
/// <param name="end"></param>
/// <returns></returns>
Task<(double dailyWage, long yearlySalaryId)> GetDailyWageByStartEnd(DateTime start, DateTime end);
MontlywageBunosYearsViewModel GetMontlyBunosYears(TimeSpan weeklyTime, DateTime contractStart,DateTime contractEnd, double daylyWage, string weeklyWorkingTime, int officialholiday, int friday, string totalHoursH, string totalHorsM, string basic, int fridayStartToEnd, double dayliFeeComplete, bool hasRollCall, bool holidaysWorking,string shiftWork);
double GetLeavePay(DateTime contractStart, DateTime contractEnd, double daylyWage, double consumableItem, double housingAllowance, double familyAllowance , string weeklyWorkingTime, int officialholiday, int friday, string totalHoursH, string totalHorsM);
double GetOverTimeWorking(double dayliWage, string overTimeWorkH, string overTimeWorkM);
double GetOverNightWorking(double dayliWage, string overNightWorkH, string overNightWorkM, string weeklyWorkingTime, int officialholiday, int friday, DateTime contractStart, DateTime contractEnd, string totalHoursH, string totalHorsM);
/// <summary>
/// متد ارتقاء مزد دلخواه
/// </summary>
/// <param name="newContractStart"></param>
/// <param name="lastContractStart"></param>
/// <param name="lastContractManualDailyWage"></param>
/// <returns></returns>
Task<UpgradeManualDailyWageModel> UpgradeManualDailyWage(DateTime newContractStart, DateTime lastContractStart,
double lastContractManualDailyWage);
/// <summary>
/// متد محاسبه پایه سنوات و لیست پایه سنوات های پرسنل
/// </summary>

View File

@@ -1,5 +1,7 @@
using System;
using System.Collections.Generic;
using System.Security.AccessControl;
using _0_Framework.Application;
using _0_Framework.Domain;
using Company.Domain.ContarctingPartyAgg;
using Company.Domain.ContractAgg;
@@ -66,6 +68,11 @@ public class Employer : EntityBase
public string SanaPassword { get; private set; }
public string EmployerNo { get; set; }
public bool IsAuth { get; set; }
public string IdNumberSerial { get; set; }
public string IdNumberSeri { get; set; }
public PersonalContractingParty ContractingParty { get; set; }
//public List<Workshop> Workshops { get; private set; }
@@ -227,4 +234,35 @@ public class Employer : EntityBase
this.IsActive = false;
this.Address = "false";
}
public void Authentication(string fName, string lName, string fatherName,string idNumber,
string idNumberSeri, string idNumberSerial, string dateOfBirth, Gender gender,string phone)
{
this.FName = fName;
this.LName = lName;
this.FatherName = fatherName;
this.IdNumberSeri = idNumberSeri;
this.IdNumberSerial = idNumberSerial;
this.DateOfBirth = !string.IsNullOrWhiteSpace(dateOfBirth) ? dateOfBirth.ToGeorgianDateTime() : new();
this.IdNumber = idNumber;
this.Gender = gender == _0_Framework.Application.Gender.Male? "مرد" : "زن";
this.IsAuth = true;
Phone = phone;
}
public void LegalAuthentication(string fName, string lName, string fatherName,string idNumber, string idNumberSeri,
string idNumberSerial, string dateOfBirth, Gender gender,string phone)
{
FName = fName;
EmployerLName = lName;
this.FatherName = fatherName;
this.IdNumberSeri = idNumberSeri;
this.IdNumberSerial = idNumberSerial;
this.DateOfBirth = !string.IsNullOrWhiteSpace(dateOfBirth) ? dateOfBirth.ToGeorgianDateTime() : new();
this.IdNumber = idNumber;
this.Gender =gender == _0_Framework.Application.Gender.Male? "مرد" : "زن";
this.IsAuth = true;
Phone = phone;
}
}

View File

@@ -1,9 +1,11 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using _0_Framework.Application;
using _0_Framework.Application.Enums;
using _0_Framework.Domain;
using CompanyManagment.App.Contracts.Checkout;
using CompanyManagment.App.Contracts.Employer;
using Microsoft.AspNetCore.Mvc;
namespace Company.Domain.empolyerAgg;
@@ -34,7 +36,7 @@ public interface IEmployerRepository : IRepository<long, Employer>
List<EmployerViewModel> GetEmployersHasWorkshop();
Task<List<EmployerSelectListViewModel>> GetSelectList(string search,long id);
Task<List<EmployerSelectListViewModel>> GetSelectList(string search, long id, LegalType? legalType);
#endregion
@@ -68,5 +70,5 @@ public interface IEmployerRepository : IRepository<long, Employer>
#endregion
Task<ActionResult<EditEmployerWorkflowRegistration>> GetWorkflowRegistrationForEdit(long employerId, long institutionWorkshopDetailsId);
}

View File

@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Company.Domain\Company.Domain.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="MongoDB.Driver" Version="3.5.0" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,32 @@
using Company.Domain.InstitutionContractInsertTempAgg;
using MongoDB.Driver;
namespace CompanyManagement.Infrastructure.Mongo.InstitutionContractInsertTempRepo;
public class InstitutionContractExtenstionTempRepository:IInstitutionContractExtenstionTempRepository
{
private readonly IMongoCollection<InstitutionContractExtensionTemp> _institutionExtenstionTemp;
public InstitutionContractExtenstionTempRepository(IMongoDatabase database)
{
_institutionExtenstionTemp = database.GetCollection<InstitutionContractExtensionTemp>("InstitutionContractExtenstionTemp");
}
public async Task Create(InstitutionContractExtensionTemp institutionContract)
{
await _institutionExtenstionTemp.InsertOneAsync(institutionContract);
}
public async Task<InstitutionContractExtensionTemp> GetPreviousExtenstionData(long contractingPartyId)
{
var entity = await _institutionExtenstionTemp
.Find(x => x.PreviousId == contractingPartyId)
.FirstOrDefaultAsync();
return entity;
}
public async Task Remove(Guid id)
{
await _institutionExtenstionTemp.DeleteOneAsync(x=>x.Id == id);
}
}

View File

@@ -160,4 +160,37 @@ public class CreateCheckout
public TimeSpan TotalPaidLeave { get; set; }
public TimeSpan TotalSickLeave { get; set; }
public bool HasLeft { get; set; }
/// <summary>
/// دستمزد روزانه خام بعد از تاثیر ساعت کار
/// </summary>
public double DailySalaryAffected { get; set; }
/// <summary>
/// پایه سنوات بعد از تاثیر ساعت کار
/// </summary>
public double BaseYearAffected { get; set; }
/// <summary>
/// دستمزد روزانه قبل از تاثیر ساعت کار
/// </summary>
public double DailySalaryUnAffected { get; set; }
/// <summary>
/// دستمزد روزانه دریافت شده از سمت فرانت
/// </summary>
public string DailySalaryUnAffectedStr { get; set; }
/// <summary>
/// مزد سالانه نرمال دریافت از سمت فرانت
/// </summary>
public string NormalDailyWage { get; set; }
/// <summary>
/// پایه سنوات قبل از تاثیر ساعت کار
/// </summary>
public double BaseYearUnAffected { get; set; }
}

View File

@@ -61,9 +61,23 @@ public class ComputingViewModel
/// </summary>
public TimeSpan EmployeeMandatoryHours { get; set; }
/// <summary>
/// مجموع مرخصی های پرسنل در این فیش حقوقی
/// پایه سنوات قبل از تاثیر ساعت کار
/// </summary>
//public TimeSpan TotalLeaveOnThisCheckout { get; set; }
public double BaseYearUnAffected { get; set; }
/// <summary>
/// پایه سنوات بعد از تاثیر ساعت کار
/// </summary>
public double BaseYearAffected { get; set; }
/// <summary>
/// دستمزد روزانه خام بعد از تاثیر ساعت کار
/// </summary>
public double DailySalaryAffected { get; set; }
//public List<string> holidays;
}

View File

@@ -0,0 +1,70 @@
using CompanyManagment.App.Contracts.YearlySalary;
using System.Collections.Generic;
namespace CompanyManagment.App.Contracts.Contract;
/// <summary>
/// نمایش نحوه محاسبه پایه سنوات و دستمزد روزانه
/// </summary>
public class ContractDailyWageAndBaseYearReport
{
/// <summary>
/// لیست داده های محاسبه پایه سنوات
/// </summary>
public BaseYearDataViewModel BaseYearDataViewModel { get; set; }
/// <summary>
/// پایه سنوات متاثر از ساعت کار
/// </summary>
public string BaseYearAffected { get; set; }
/// <summary>
/// دستمزد روزانه متاثر از ساعت کار
/// </summary>
public string DailySalaryAffected { get; set; }
/// <summary>
/// دستمزد روزانه بدون تاثیر ساعت کار
/// </summary>
public string DailySalaryUnAffected { get; set; }
/// <summary>
/// دستمزد روزانه تجمیعی
/// </summary>
public string DailyWage { get; set; }
/// <summary>
/// تاریخ قراداد
/// </summary>
public string ContractDate { get; set; }
/// <summary>
/// نوع دستمزد انتخاب شده
/// </summary>
public string DailyWageType { get; set; }
/// <summary>
/// لیست ارتقاء
/// </summary>
public List<UpgradeManualDailyWageList> UpgradeManualDailyWageLists { get; set; }
/// <summary>
/// نام پرسنل
/// </summary>
public string EmployeeName { get; set; }
/// <summary>
/// نام کارگاه
/// </summary>
public string WorkshopName { get; set; }
/// <summary>
/// آیا با متد جدید محاسبه شده
/// </summary>
public bool OldComputeMethod { get; set; }
/// <summary>
/// آیا محاسبات با مقادیر ذخیره شده مغایرت دارد
/// </summary>
public bool Contradiction { get; set; }
}

View File

@@ -140,7 +140,36 @@ public class CreateContract
public string ConvertMonth { get; set; }
public string FormStep { get; set; }
/// <summary>
/// دستمزد روزانه خام بعد از تاثیر ساعت کار
/// </summary>
public double DailySalaryAffected { get; set; }
/// <summary>
/// پایه سنوات بعد از تاثیر ساعت کار
/// </summary>
public double BaseYearAffected { get; set; }
/// <summary>
/// دستمزد روزانه قبل از تاثیر ساعت کار
/// </summary>
public double DailySalaryUnAffected { get; set; }
/// <summary>
/// پایه سنوات قبل از تاثیر ساعت کار
/// </summary>
public double BaseYearUnAffected { get; set; }
/// <summary>
/// آیا دستمزد روزانه دستی وارد شده است؟
/// </summary>
public bool HasManualDailyWage { get; set; }
/// <summary>
/// نوع دستمزد انتخاب شده
/// </summary>
public string DailyWageType { get; set; }
public List<ContractViweModel> Contracts { get; set; }
public List<WorkshopViewModel> Workshops { get; set; }
public List<EmployerViewModel> Employers { get; set; }

View File

@@ -7,6 +7,14 @@ namespace CompanyManagment.App.Contracts.Contract;
public interface IContractApplication
{
/// <summary>
/// دریافت مزد ارتقاء یافته
/// </summary>
/// <param name="workshopId"></param>
/// <param name="employeeId"></param>
/// <param name="yearlySalaryId"></param>
/// <returns></returns>
Task<double> GetManualDailWage(long workshopId, long employeeId, long yearlySalaryId, DateTime contractStart);
OperationResult Create(CreateContract command);
OperationResult CreateNew(createContractModel command);
OperationResult Edit(EditContract command);

View File

@@ -0,0 +1,36 @@
using System.Collections.Generic;
namespace CompanyManagment.App.Contracts.Contract;
/// <summary>
/// ویو مدل رتقاء دستمزد روزانه و لیست ارتقاء
/// </summary>
public class UpgradeManualDailyWageModel
{
/// <summary>
/// دستمزد روزانه
/// </summary>
public double DailyWage{ get; set; }
/// <summary>
/// لیست ارتقاء
/// </summary>
public List<UpgradeManualDailyWageList> UpgradeManualDailyWageLists { get; set; }
}
/// <summary>
/// لیست ارتقاء
/// </summary>
public class UpgradeManualDailyWageList
{
/// <summary>
/// تاریخ شروع و پایان بازه ارتقاء
/// </summary>
public string StartEndDate { get; set; }
/// <summary>
/// دستمزد روزانه
/// </summary>
public string DailyWage { get; set; }
}

View File

@@ -6,6 +6,7 @@ using _0_Framework.Application;
using _0_Framework.Application.Enums;
using CompanyManagment.App.Contracts.Checkout;
using CompanyManagment.App.Contracts.Employee;
using Microsoft.AspNetCore.Mvc;
namespace CompanyManagment.App.Contracts.Employer;
@@ -46,8 +47,9 @@ public interface IEmployerApplication
/// </summary>
/// <param name="search"></param>
/// <param name="id"></param>
/// <param name="legalType"></param>
/// <returns></returns>
Task<List<EmployerSelectListViewModel>> GetSelectList(string search, long id);
Task<List<EmployerSelectListViewModel>> GetSelectList(string search, long id, LegalType? legalType = null);
#endregion
#region NewByHeydari
@@ -145,6 +147,7 @@ public interface IEmployerApplication
Task<OperationResult> DeleteWorkflowRegistration(long employerId, long institutionWorkshopDetailsId);
Task<OperationResult<AuthenticateUserViewModel>> AuthenticateEmployer(string nationalCode, string dateOfBirth, string mobile);
Task<ActionResult<EditEmployerWorkflowRegistration>> GetWorkflowRegistrationForEdit(long employerId, long institutionWorkshopDetailsId);
}
public class AuthenticateUserViewModel
@@ -207,6 +210,11 @@ public class AuthenticateUserViewModel
/// </summary>
public class CreateEmployerWorkflowRegistration
{
/// <summary>
/// درزمانی که یوزر کارفرمایی رو انتخاب کرد که از قبل ثبت شده است
/// این فیلد باید مقدار داشته باشد
/// </summary>
public long EmployerId { get; set; }
/// <summary>
/// اطلاعات کارفرمای حقیقی
/// </summary>
@@ -225,7 +233,7 @@ public class CreateEmployerWorkflowRegistration
/// <summary>
/// شناسه جزئیات کارگاه موسسه
/// </summary>
public long InstitutionWorkshopDetailsId { get; set; }
public long InstitutionWorkshopInitialId { get; set; }
/// <summary>
/// شناسه قرارداد موسسه
@@ -323,7 +331,9 @@ public class CreateLegalEmployerWorkflowRegistration
/// اطلاعات سیستم دولتی
/// </summary>
public GovernmentSystemInfo GovernmentSystemInfo { get; set; }
public string IdNumberSeri { get; set; }
public string IdNumberSerial { get; set; }
}
/// <summary>
@@ -395,6 +405,9 @@ public class CreateRealEmployerWorkflowRegistration
/// شماره تلفن
/// </summary>
public string Telephone { get; set; }
public string IdNumberSeri { get; set; }
public string IdNumberSerial { get; set; }
}
/// <summary>

View File

@@ -8,6 +8,7 @@ namespace CompanyManagment.App.Contracts.InstitutionContract;
public class CreateInstitutionContract
{
public long LawId { get; set; }
public string ContractNo { get; set; }
[Required(ErrorMessage = "انتخاب معرف اجباری است")]

View File

@@ -99,6 +99,9 @@ public class CreateInstitutionContractRequest
/// </summary>
public double TaxAmount { get; set; }
public double OneMonthAmount { get; set; }
public long LawId { get; set; }
}
/// <summary>
/// مدت زمان قرارداد نهاد

View File

@@ -0,0 +1,13 @@
namespace CompanyManagment.App.Contracts.InstitutionContract;
/// <summary>
/// درخواست تمدید قرارداد مؤسسه
/// شامل اطلاعات قرارداد قبلی برای فرآیند تمدید
/// </summary>
public class ExtenstionInstitutionContractRequest : EditInstitutionContractRequest
{
/// <summary>
/// شناسه قرارداد قبلی که قرار است تمدید شود
/// </summary>
public long PreviousContractId { get; set; }
}

View File

@@ -85,4 +85,37 @@ public class GetInstitutionContractListItemsViewModel
public bool IsExpired { get; set; }
public long ContractingPartyId { get; set; }
public List<InstitutionContractListWorkshop> Workshops { get; set; }
}
public class InstitutionContractListWorkshop
{
public string WorkshopName { get; set; }
public int EmployeeCount { get; set; }
public WorkshopServicesViewModel WorkshopServices { get; set; }
}
public class WorkshopServicesViewModel
{
public bool Insurance { get; set; }
public string InsuranceLabel => "ارسال لیست بیمه";
public bool InsuranceInPerson { get; set; }
public string InsuranceInPersonLabel => "خدمات حضوری";
public bool Contract { get; set; }
public string ContractLabel => "قرارداد و تصفیه حساب";
public bool ContractInPerson { get; set; }
public string ContractInPersonLabel => "خدمات حضوری";
public bool RollCall { get; set; }
public string RollCallLabel => "ساعت حضور و غیاب";
public bool RollCallInPerson { get; set; }
public string RollCallInPersonLabel => "خدمات مستقیم";
public bool CustomizeCheckout { get; set; }
public string CustomizeCheckoutLabel => "فیش غیر رسمی";
}

View File

@@ -0,0 +1,27 @@
using System.Collections.Generic;
namespace CompanyManagment.App.Contracts.InstitutionContract;
public class GetInstitutionContractListStatsViewModel
{
/// <summary>
/// مجموع بدهی قراردادهای مؤسسه
/// این ویژگی بدهی‌های قراردادهای مربوطه را تجمیع می‌کند و
/// یک معیار واحد برای اندازه‌گیری تعهدات مالی ارائه می‌دهد
/// </summary>
public double TotalDebt { get; set; }
/// <summary>
/// مجموع ارزش پولی مرتبط با قراردادهای مؤسسه
/// این ویژگی مبلغ کل قراردادهای مربوطه را برای
/// گزارش‌گیری و تجزیه و تحلیل مالی تجمیع می‌کند
/// </summary>
public double TotalAmount { get; set; }
/// <summary>
/// مجموعه‌ای از تعداد قراردادهای مؤسسه دسته‌بندی شده بر اساس وضعیت
/// این ویژگی تعداد قراردادها را برای هر وضعیت تعریف شده در
/// شمارش InstitutionContractStatus ارائه می‌دهد که امکان تجزیه و تحلیل و نظارت بر توزیع قراردادها را فراهم می‌کند
/// </summary>
public List<InstitutionContractStatusCount> Counts { get; set; }
}

View File

@@ -0,0 +1,31 @@
using _0_Framework.Application.Enums;
using System.Collections.Generic;
namespace CompanyManagment.App.Contracts.InstitutionContract;
public class GetInstitutionVerificationDetailsViewModel
{
public InstitutionContratVerificationParty FirstParty { get; set; }
public InstitutionContratVerificationParty SecondParty { get; set; }
public string ContractNo { get; set; }
public string CreationDate { get; set; }
public string ContractStart { get; set; }
public string ContractEnd { get; set; }
public List<GetInstitutionVerificationDetailsWorkshopsViewModel> Workshops { get; set; }
public string TotalPrice { get; set; }
public string TaxPrice { get; set; }
public string PaymentPrice { get; set; }
public List<InstitutionContractInstallmentViewModel> Installments { get; set; }
public bool IsInstallment { get; set; }
}
public class InstitutionContratVerificationParty
{
public string CompanyNameOrFullName { get; set; }
public string NationalCodeOrNationalId { get; set; }
public string CeoName { get; set; }
public string Address { get; set; }
public string PostalCode { get; set; }
public string PhoneNumber { get; set; }
public LegalType LegalType { get; set; }
}

View File

@@ -0,0 +1,9 @@
namespace CompanyManagment.App.Contracts.InstitutionContract;
public class GetInstitutionVerificationDetailsWorkshopsViewModel
{
public string Name { get; set; }
public int PersonnelCount { get; set; }
public WorkshopServicesViewModel Services { get; set; }
public string Price { get; set; }
}

View File

@@ -5,8 +5,11 @@ using System.Drawing;
using System.Linq;
using System.Threading.Tasks;
using _0_Framework.Application;
using _0_Framework.Application.Sms;
using CompanyManagment.App.Contracts.Checkout;
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
using CompanyManagment.App.Contracts.Workshop;
using CompanyManagment.App.Contracts.WorkshopPlan;
using Microsoft.AspNetCore.Mvc;
namespace CompanyManagment.App.Contracts.InstitutionContract;
@@ -186,13 +189,7 @@ public interface IInstitutionContractApplication
/// <param name="command"></param>
/// <returns></returns>
Task<OperationResult> EditAsync(EditInstitutionContractRequest command);
/// <summary>
/// تمدید قرارداد
/// </summary>
/// <param name="command"></param>
/// <returns></returns>
Task<OperationResult> ExtensionَAsync(CreateInstitutionContractRequest command);
/// <summary>
/// دریافت لیست طرف حساب هایی که ثبت نام آنها تکمیل شده
@@ -206,96 +203,75 @@ public interface IInstitutionContractApplication
/// <param name="institutionContractId"></param>
/// <returns></returns>
Task<List<RegistrationWorkflowItemsViewModel>> RegistrationWorkflowItems(long institutionContractId);
#endregion
}
public class GetInstitutionContractListStatsViewModel
{
/// <summary>
/// مجموع بدهی قراردادهای مؤسسه
/// این ویژگی بدهی‌های قراردادهای مربوطه را تجمیع می‌کند و
/// یک معیار واحد برای اندازه‌گیری تعهدات مالی ارائه می‌دهد
/// </summary>
public double TotalDebt { get; set; }
/// <summary>
/// مجموع ارزش پولی مرتبط با قراردادهای مؤسسه
/// این ویژگی مبلغ کل قراردادهای مربوطه را برای
/// گزارش‌گیری و تجزیه و تحلیل مالی تجمیع می‌کند
/// </summary>
public double TotalAmount { get; set; }
/// <summary>
/// مجموعه‌ای از تعداد قراردادهای مؤسسه دسته‌بندی شده بر اساس وضعیت
/// این ویژگی تعداد قراردادها را برای هر وضعیت تعریف شده در
/// شمارش InstitutionContractStatus ارائه می‌دهد که امکان تجزیه و تحلیل و نظارت بر توزیع قراردادها را فراهم می‌کند
/// </summary>
public List<InstitutionContractStatusCount> Counts { get; set; }
}
/// <summary>
/// شمارش وضعیت قراردادهای مؤسسه
/// نمایش تعداد قراردادها برای هر وضعیت خاص
/// </summary>
public class InstitutionContractStatusCount
{
/// <summary>
/// وضعیت لیست قرارداد
/// </summary>
public InstitutionContractListStatus ListStatus { get; set; }
/// <summary>
/// تعداد قراردادها در این وضعیت
/// </summary>
public int Count { get; set; }
Task<GetInstitutionVerificationDetailsViewModel> GetVerificationDetails(Guid id);
Task<OperationResult<OtpResultViewModel>> SendVerifyOtp(Guid id);
Task<OperationResult> VerifyOtp(Guid publicId, string code);
Task<InstitutionContractWorkshopDetailViewModel> GetWorkshopInitialDetails(long workshopDetailsId);
Task<InstitutionContractExtensionInquiryResult> GetExtensionInquiry(long previousContractId);
Task<InstitutionContractExtensionWorkshopsResponse> GetExtensionWorkshops(InstitutionContractExtensionWorkshopsRequest request);
Task<InstitutionContractExtensionPlanResponse> GetExtensionInstitutionPlan(InstitutionContractExtensionPlanRequest request);
Task<InstitutionContractExtensionPaymentResponse> GetExtensionPaymentMethod(
InstitutionContractExtensionPaymentRequest request);
Task<OperationResult> ExtensionComplete(InstitutionContractExtensionCompleteRequest request);
Task<List<InstitutionContractSelectListViewModel>> GetInstitutionContractSelectList(string search,string selected);
}
/// <summary>
/// درخواست تمدید قرارداد مؤسسه
/// شامل اطلاعات قرارداد قبلی برای فرآیند تمدید
/// </summary>
public class ExtenstionInstitutionContractRequest : EditInstitutionContractRequest
{
/// <summary>
/// شناسه قرارداد قبلی که قرار است تمدید شود
/// </summary>
public long PreviousContractId { get; set; }
}
public class InstitutionContractSelectListViewModel : SelectListViewModel;
/// <summary>
/// مدل نمایش اقساط قرارداد مؤسسه
/// شامل اطلاعات مربوط به هر قسط از قرارداد
/// </summary>
public class InstitutionContractInstallmentViewModel
public class InstitutionContractExtensionInquiryResponse
{
/// <summary>
/// شناسه یکتای قسط
/// </summary>
public long Id { get; set; }
/// <summary>
/// تاریخ میلادی قسط
/// </summary>
public DateTime InstallmentDateGr { get; set; }
/// <summary>
/// تاریخ فارسی قسط
/// </summary>
public string InstallmentDateFa { get; set; }
/// <summary>
/// مبلغ قسط
/// </summary>
public double Amount { get; set; }
/// <summary>
/// توضیحات قسط
/// </summary>
public string Description { get; set; }
/// <summary>
/// شناسه قرارداد مؤسسه مربوط به این قسط
/// </summary>
public long InstitutionContractId { get; set; }
public string FName { get; set; }
public string LName { get; set; }
public string DateOfBirthFa { get; set; }
public string FatherName { get; set; }
public string IdNumberSerial { get; set; }
public string IdNumber { get; set; }
public string Address { get; set; }
public string Phone { get; set; }
public string City { get; set; }
public string State { get; set; }
public long RepresentativeId { get; set; }
public string NationalCode { get; set; }
}
public class InstitutionContractExtensionCompleteRequest
{
public Guid TemporaryId { get; set; }
public bool IsInstallment { get; set; }
public long LawId { get; set; }
}
public class InstitutionContractExtensionPaymentResponse
{
public InstitutionContractExtensionPaymentOneTime OneTime { get; set; }
public InstitutionContractExtensionPaymentMonthly Monthly { get; set; }
}
public class InstitutionContractExtensionPaymentMonthly:InstitutionContractExtensionPaymentOneTime
{
public List<MonthlyInstallment> Installments { get; set; }
}
public class InstitutionContractExtensionPaymentOneTime
{
/// <summary>
/// مجموع مبالغ
/// </summary>
public string TotalAmount { get; set; }
/// <summary>
/// ارزش افزوده
/// </summary>
public string Tax { get; set; }
/// <summary>
/// مبلغ قابل پرداخت
/// </summary>
public string PaymentAmount { get; set; }
}

View File

@@ -0,0 +1,9 @@
namespace CompanyManagment.App.Contracts.InstitutionContract;
public class InstitutionContractExtensionInquiryRequest
{
public long ContractingPartyId { get; set; }
public string NationalCode { get; set; }
public string BirthDate { get; set; }
public string Mobile { get; set; }
}

View File

@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using _0_Framework.Application.Enums;
using CompanyManagment.App.Contracts.InstitutionContractContactinfo;
namespace CompanyManagment.App.Contracts.InstitutionContract;
public class InstitutionContractExtensionInquiryResult
{
/// <summary>
/// اطلاعات شخص حقیقی
/// </summary>
public CreateInstitutionContractRealPartyRequest RealParty { get; set; }
/// <summary>
/// اطلاعات شخص حقوقی
/// </summary>
public CreateInstitutionContractLegalPartyRequest LegalParty { get; set; }
public LegalType LegalType { get; set; }
public Guid TemporaryId { get; set; }
public string Address { get; set; }
public string City { get; set; }
public string Province { get; set; }
public List<EditContactInfo> ContactInfoViewModels { get; set; }
public long RepresentativeId { get; set; }
}

View File

@@ -0,0 +1,9 @@
using System;
namespace CompanyManagment.App.Contracts.InstitutionContract;
public class InstitutionContractExtensionPaymentRequest
{
public InstitutionContractDuration Duration { get; set; }
public Guid TempId { get; set; }
}

View File

@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
namespace CompanyManagment.App.Contracts.InstitutionContract;
public class InstitutionContractExtensionPlanRequest
{
public List<WorkshopTempViewModel> WorkshopTemps { get; set; }
public string TotalAmount { get; set; }
public Guid TempId { get; set; }
}

View File

@@ -0,0 +1,20 @@
namespace CompanyManagment.App.Contracts.InstitutionContract;
public class InstitutionContractExtensionPlanResponse
{
public InstitutionContractExtensionPlanDetail OneMonth { get; set; }
public InstitutionContractExtensionPlanDetail ThreeMonths { get; set; }
public InstitutionContractExtensionPlanDetail SixMonths { get; set; }
public InstitutionContractExtensionPlanDetail TwelveMonths { get; set; }
}
public class InstitutionContractExtensionPlanDetail
{
public string ContractStart { get; set; }
public string ContractEnd { get; set; }
public string OneMonthPaymentDiscounted { get; set; }
public string OneMonthDiscount { get; set; }
public string OneMonthOriginalPayment { get; set; }
public string TotalPayment { get; set; }
public string DailyCompenseation { get; set; }
public string Obligation { get; set; }
}

View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using CompanyManagment.App.Contracts.InstitutionContractContactinfo;
namespace CompanyManagment.App.Contracts.InstitutionContract;
public class InstitutionContractExtensionWorkshopsRequest
{
public Guid TempId { get; set; }
public string City {get; set;}
public string Province { get; set; }
public string Address { get; set; }
public List<EditContactInfo> ContactInfos { get; set; }
}

View File

@@ -0,0 +1,10 @@
using System.Collections.Generic;
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
namespace CompanyManagment.App.Contracts.InstitutionContract;
public class InstitutionContractExtensionWorkshopsResponse
{
public List<WorkshopTempViewModel> WorkshopTemps { get; set; }
public string TotalAmount { get; set; }
}

View File

@@ -0,0 +1,40 @@
using System;
namespace CompanyManagment.App.Contracts.InstitutionContract;
/// <summary>
/// مدل نمایش اقساط قرارداد مؤسسه
/// شامل اطلاعات مربوط به هر قسط از قرارداد
/// </summary>
public class InstitutionContractInstallmentViewModel
{
/// <summary>
/// شناسه یکتای قسط
/// </summary>
public long Id { get; set; }
/// <summary>
/// تاریخ میلادی قسط
/// </summary>
public DateTime InstallmentDateGr { get; set; }
/// <summary>
/// تاریخ فارسی قسط
/// </summary>
public string InstallmentDateFa { get; set; }
/// <summary>
/// مبلغ قسط
/// </summary>
public string Amount { get; set; }
/// <summary>
/// عدد قسط فارسی
/// </summary>
public string InstallmentIndex { get; set; }
/// <summary>
/// شناسه قرارداد مؤسسه مربوط به این قسط
/// </summary>
public long InstitutionContractId { get; set; }
}

View File

@@ -8,5 +8,6 @@ public enum InstitutionContractListStatus
Block,
Free,
PendingForRenewal,
WithoutWorkshop
WithoutWorkshop,
PendingForVerify
}

View File

@@ -0,0 +1,18 @@
namespace CompanyManagment.App.Contracts.InstitutionContract;
/// <summary>
/// شمارش وضعیت قراردادهای مؤسسه
/// نمایش تعداد قراردادها برای هر وضعیت خاص
/// </summary>
public class InstitutionContractStatusCount
{
/// <summary>
/// وضعیت لیست قرارداد
/// </summary>
public InstitutionContractListStatus ListStatus { get; set; }
/// <summary>
/// تعداد قراردادها در این وضعیت
/// </summary>
public int Count { get; set; }
}

View File

@@ -0,0 +1,8 @@
namespace CompanyManagment.App.Contracts.InstitutionContract;
public class InstitutionContractWorkshopDetailViewModel
{
public WorkshopServicesViewModel ServicesViewModel { get; set; }
public string WorkshopName { get; set; }
public int ArchiveCode { get; set; }
}

View File

@@ -21,4 +21,12 @@ public interface IInsuranceJobApplication
List<InsuranceJobViewModel> Search(InsuranceJobSearchModel searchModel);
OperationResult Remove(long id);
Task<List<InsuranceJobSelectListViewModel>> GetSelectList();
}
public class InsuranceJobSelectListViewModel
{
public long Id { get; set; }
public string InsuranceJobTitle { get; set; }
public string EconomicCode { get; set; }
}

View File

@@ -6,6 +6,7 @@ using System.Threading.Tasks;
using _0_Framework.Application;
using CompanyManagment.App.Contracts.InsuranceList;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace CompanyManagment.App.Contracts.InsuranceList;
@@ -47,4 +48,6 @@ public interface IInsuranceListApplication
Task<InsuranceListTabsCountViewModel> GetTabCounts(InsuranceListSearchModel searchModel);
#endregion
Task<List<InsuranceListViewModel>> GetNotCreatedWorkshop(InsuranceListSearchModel searchModel);
}

View File

@@ -14,6 +14,7 @@ namespace CompanyManagment.App.Contracts.Law
public LawType Type { get; set; }
public string HeadTitle { get; set; }
public List<string> Notifications { get; set; }
public int Version { get; set; }
}
public class LawItemViewModel

View File

@@ -37,4 +37,5 @@ public class CreateLeave
public List<CustomizeRotatingShiftsViewModel> RotatingShifts { get; set; }
public bool HasRollCall { get; set; }
public CustomizeRotatingShiftsViewModel SelectedShift { get; set; }
public bool IsInvallid { get; set; }
}

View File

@@ -14,5 +14,8 @@ namespace CompanyManagment.App.Contracts.Leave
public string LeftWorlErrMessage { get; set; }
public bool HasNotContract { get; set; }
public string ContractErrMessage { get; set; }
public bool HasHolidayError { get; set; }
public string HolidayErrorMessage { get; set; }
}
}

View File

@@ -27,4 +27,5 @@ public class LeavePrintViewModel
public string MonthGr { get; set; }
public int PrintCounter { get; set; }
public List<EmprViewModel> EmployerList { get; set; }
public bool IsInvalid { get; set; }
}

View File

@@ -20,4 +20,5 @@ public class LeaveSearchModel
public int Year { get; set; }
public int Month { get; set; }
public int PageIndex { get; set; }
public bool IsInvalid { get; set; }
}

View File

@@ -27,4 +27,5 @@ public class LeaveViewModel
public TimeSpan ShiftDuration { get; set; }
public bool HasShiftDuration { get; set; }
public bool IsInvalid { get; set; }
}

View File

@@ -57,4 +57,12 @@ public class ContractingPartyGetListViewModel
/// </summary>
public ActivationStatus Status { get; set; }
public string Address { get; set; }
public string PhoneNumber { get; set; }
public string NationalId { get; set; }
public string RepresentativeName { get; set; }
}

View File

@@ -8,7 +8,8 @@ namespace CompanyManagment.App.Contracts.RollCall;
public interface IRollCallMandatoryApplication
{
bool HasRollCallRecord(long employeeId, long workshopId, DateTime contractStart);
ComputingViewModel MandatoryCompute(long employeeId, long workshopId, DateTime contractStart, DateTime contractEnd, CreateWorkingHoursTemp command, bool holidayWorking, bool isStaticCheckout, bool rotatingShiftCompute, bool totalLeaveCompute);
ComputingViewModel MandatoryCompute(long employeeId, long workshopId, DateTime contractStart, DateTime contractEnd, CreateWorkingHoursTemp command, bool holidayWorking, bool isStaticCheckout, bool rotatingShiftCompute, double dailyWageUnAffected, bool totalLeaveCompute);
/// <summary>
/// گزارش نوبت کاری حضور غیاب

View File

@@ -8,4 +8,8 @@ public class ContractingPartyTempViewModel : CreateContractingPartyTemp
/// </summary>
public string DateOfBirthFa { get; set; }
public string Address { get; set; }
public string City { get; set; }
public long RepresentativeId { get; set; }
}

View File

@@ -33,6 +33,7 @@ public class CreateWorkshopTemp
/// حضورغباب
/// </summary>
public bool RollCall { get; set; }
public bool RollCallInPerson { get; set; }
/// <summary>
/// فیش غیر رسمی

View File

@@ -46,7 +46,9 @@ public class ReviewAndPaymentViewModel
/// مالیات بر ارزش افزوده
/// string
/// </summary>
public string ValueAddedTaxStr { get; set; }
public string MonthlyValueAddedTaxStr { get; set; }
public string OneTimeValueAddedTaxStr { get; set; }
/// <summary>
/// لیست اقساط ماهیانه

View File

@@ -15,4 +15,6 @@ public class WorkshopTempViewModel : CreateWorkshopTemp
/// فارسی
/// </summary>
public string WorkshopServicesAmountStr { get; set; }
public long WorkshopId { get; set; }
}

View File

@@ -311,4 +311,9 @@ public class CreateWorkingHoursTemp
public string WeeklyWorkingTime { get; set; }
public long ContractId { get; set; }
public long WorknigHoursId { get; set; }
/// <summary>
/// دستمزد روزانه قبل از تاثیر ساعت کار
/// </summary>
public double DailySalaryUnAffected { get; set; }
}

View File

@@ -1,4 +1,6 @@
namespace CompanyManagment.App.Contracts.Workshop.DTOs;
using System.ComponentModel.DataAnnotations.Schema;
namespace CompanyManagment.App.Contracts.Workshop.DTOs;
public class AutoExtensionEmployeeListDto
{
@@ -32,6 +34,17 @@ public class AutoExtensionEmployeeListDto
public bool EmployeeHasCreateContract { get; set; }
/// <summary>
/// دستمزد روزانه دریافت شده از سمت فرانت
/// </summary>
public string DailySalaryUnAffectedStr => "0";
/// <summary>
/// مزد سالانه نرمال دریافت از سمت فرانت
/// </summary>
public string NormalDailyWage => "0";
public string ContarctStart { get; set; }
public string ContractEnd { get; set; }

View File

@@ -97,9 +97,9 @@ public interface IWorkshopApplication
public class CreateWorkshopWorkflowRegistration
{
/// <summary>
/// شناس<EFBFBD><EFBFBD> جزئیات کارگاه قرارداد مؤسسه
/// شناسه جزئیات کارگاه قرارداد نهاد مرتبط
/// </summary>
public long InstitutionContractWorkshopDetailId { get; set; }
public long InstitutionContractWorkshopInitialId { get; set; }
/// <summary>
/// نام کارگاه
/// </summary>
@@ -155,7 +155,7 @@ public class CreateWorkshopWorkflowRegistration
/// <summary>
/// باز بودن در تعطیلات
/// </summary>
public bool OpenInHolidays { get; set; }
public bool WorkingInHoliday { get; set; }
/// <summary>
/// محاسبه نوبت کاری در فیش حقوقی
/// </summary>
@@ -170,7 +170,7 @@ public class CreateWorkshopWorkflowRegistration
/// </summary>
public bool SignContract { get; set; }
/// <summary>
/// ایجات تصف<EFBFBD><EFBFBD>ه حساب
/// ایجات تصفیه حساب
/// </summary>
public bool CreateCheckout { get; set; }
/// <summary>
@@ -248,9 +248,17 @@ public class CreateWorkshopWorkflowRegistration
/// </summary>
public string AgreementNumber { get; set; }
/// <summary>
/// نوع محاسبه طلب مرخصی
/// </summary>
public string ComputeOptions { get; set; }
public bool AddYearsPay { get; set; }
public bool AddLeavePay { get; set; }
/// <summary>
/// نوع محسبه عیدی و پاداش
/// </summary>
public string BonusesOptions { get; set; }
/// <summary>
/// نوع محاسبه سنوات
/// </summary>
public string YearsOptions { get; set; }
}

View File

@@ -9,4 +9,5 @@ public class WorkshopAccountViewModel
public string Insurance { get; set; }
public string Tax { get; set; }
public string IsActiveSting { get; set; }
public string WorkshopIsActive { get; set; }
}

View File

@@ -38,6 +38,46 @@ public class createContractModel
public long YearlySalaryId { get; set; }
public long EmployerId { get; set; }
/// <summary>
/// دستمزد روزانه خام بعد از تاثیر ساعت کار
/// </summary>
public double DailySalaryAffected { get; set; }
/// <summary>
/// پایه سنوات بعد از تاثیر ساعت کار
/// </summary>
public double BaseYearAffected { get; set; }
/// <summary>
/// دستمزد روزانه قبل از تاثیر ساعت کار
/// </summary>
public double DailySalaryUnAffected { get; set; }
/// <summary>
/// دستمزد روزانه دریافت شده از سمت فرانت
/// </summary>
public string DailySalaryUnAffectedStr { get; set; }
/// <summary>
/// مزد سالانه نرمال دریافت از سمت فرانت
/// </summary>
public string NormalDailyWage { get; set; }
/// <summary>
/// پایه سنوات قبل از تاثیر ساعت کار
/// </summary>
public double BaseYearUnAffected { get; set; }
/// <summary>
/// آیا دستمزد روزانه دستی وارد شده است؟
/// </summary>
public bool HasManualDailyWage { get; set; }
/// <summary>
/// نوع دستمزد انتخاب شده
/// </summary>
public string DailyWageType { get; set; }
}

View File

@@ -24,6 +24,11 @@ public class BaseYearDataViewModel
/// </summary>
public double BaseYearResult { get; set; }
/// <summary>
/// اولین روز شروع بکار
/// </summary>
public string FirstWorkDayInLeftWork { get; set; }
/// <summary>
/// لیست تمام پایه سنوات های محاسبه شده
/// </summary>
@@ -64,4 +69,29 @@ public class BaseYearDataList
/// سالی که در آن پایه سنوات تعلق گرفته
/// </summary>
public string Year { get; set; }
/// <summary>
///روزی که پایه سنوات تعلق گرفته
///یا شروع بکار. ترک کار
/// شمسی
/// </summary>
public string BaseYearPayDay { get; set; }
/// <summary>
/// روزی که پایه سنوات تعلق گرفته
///یا شروع بکار. ترک کار
/// میلادی
/// </summary>
public DateTime BaseYearPayDayGr { get; set; }
/// <summary>
/// آیا تاریخ شروع بکار دارد
/// </summary>
public bool HasStartWork { get; set; }
/// <summary>
/// آیا تاریخ پایان کار دارد
/// </summary>
public bool HasLeftWork { get; set; }
}

View File

@@ -2,7 +2,9 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using _0_Framework.Application;
using CompanyManagment.App.Contracts.Contract;
using CompanyManagment.App.Contracts.Holiday;
using CompanyManagment.App.Contracts.LeftWork;
namespace CompanyManagment.App.Contracts.YearlySalary;
@@ -14,6 +16,35 @@ public interface IYearlySalaryApplication
OperationResult Err();
EditYearlySalary GetDetails(long id);
List<YearlySalaryViewModel> GetYearlySalary();
/// <summary>
/// متد ارتقاء مزد دلخواه
/// </summary>
/// <param name="newContractStart"></param>
/// <param name="lastContractStart"></param>
/// <param name="lastContractManualDailyWage"></param>
/// <returns></returns>
Task<UpgradeManualDailyWageModel> UpgradeManualDailyWage(DateTime newContractStart, DateTime lastContractStart,
double lastContractManualDailyWage);
/// <summary>
/// متد محاسبه پایه سنوات و لیست پایه سنوات های پرسنل
/// </summary>
/// <param name="contractStart"></param>
/// <param name="contractEnd"></param>
/// <param name="employeeId"></param>
/// <param name="workshopId"></param>
/// <param name="leftWorkList"></param>
/// <returns></returns>
Task<BaseYearDataViewModel> BaseYearComputeByContractId(long contractId);
/// <summary>
/// دریافت مزد روزانه بر اساس تاریخ شروع و پایان
/// </summary>
/// <param name="start"></param>
/// <param name="end"></param>
/// <returns></returns>
Task<(double dailyWage, long yearlySalaryId)> GetDailyWageByStartEnd(DateTime start, DateTime end);
List<YearlySalaryViewModel> Search(YearlySalarySearchModel searchModel);
EditYearlySalary GetDetailsBySearchModel(YearlySalarySearchModel searchModel);

View File

@@ -152,17 +152,38 @@ public class CheckoutApplication : ICheckoutApplication
var housingAllowance = command.HousingAllowance.MoneyToDouble();
//حق تاهل
var marriedAllowance = command.MarriedAllowance.MoneyToDouble();
var MontlyYearsBunos =
_yearlySalaryRepository.GetMontlyBunosYears(command.WeeklyTime, command.ContractStartGr, command.ContractEndGr, dayliWage, command.WorkingWeeklyTime, command.officialholiday, command.friday, command.TotalHolidaysAndNotH, command.TotalHolidaysAndNotM, command.Basic, command.FridayStarttoEnd, command.DailFeeComplete, command.HasRollCall, command.HolidayWorking, command.ShiftWork);
//دستمزد ماهانه
var monthlyWage = MontlyYearsBunos.MontlyWage;
//سنوات
var years = command.YearsPay;
//var MontlyYearsBunos =
//_yearlySalaryRepository.GetMontlyBunosYears(command.WeeklyTime, command.ContractStartGr, command.ContractEndGr, dayliWage, command.WorkingWeeklyTime, command.officialholiday, command.friday, command.TotalHolidaysAndNotH, command.TotalHolidaysAndNotM, command.Basic, command.FridayStarttoEnd, command.DailFeeComplete, command.HasRollCall, command.HolidayWorking, command.ShiftWork);
//دستمزد ماهانه
#region Salary
var totalDays = (command.ContractEndGr - command.ContractStartGr).TotalDays + 1;
var mandatoryDays = totalDays - command.FridayStarttoEnd - command.officialholiday;
if (!command.HasRollCall && command.ShiftWork != "4")
mandatoryDays = totalDays - command.FridayStarttoEnd;
var monthlyWage = command.DailySalaryAffected * totalDays;
//پایه سنوات
var bacicYears = command.BaseYearAffected * totalDays;
#endregion
//سنوات
var years = command.YearsPay;
//عیدی و پاداش
var bunos = command.BonusesPay;
//پایه سنوات
var bacicYears = MontlyYearsBunos.BasicYears;
var sumOfWorkingDays = MontlyYearsBunos.SumOfWorkingDay;
//فاطمه احمدژاد === موقت عیدی و پاداش و سنوات حساب نشه
if (command.EmployeeId == 45104 && command.WorkshopId == 315)
{
years = 0;
bunos = 0;
}
var sumOfWorkingDays = $"{totalDays}";
if (command.friday > 0)
{
var fridayPercent = dayliWage * 40 / 100;
@@ -200,11 +221,11 @@ public class CheckoutApplication : ICheckoutApplication
.Select(x => new CheckoutSalaryAid(x.Amount, x.SalaryAidDateTimeGe, x.SalaryAidDateTimeFa, x.CalculationDateTimeGe, x.CalculationDateTimeFa, x.Id)).ToList();
command.SalaryAidDeduction = salaryAids.Sum(x => x.Amount.MoneyToDouble());
var loanInstallments = _rollCallMandatoryRepository.LoanInstallmentForCheckout(command.EmployeeId,
command.WorkshopId, command.ContractStartGr, command.ContractEndGr)
.Select(x => new CheckoutLoanInstallment(x.Amount, x.Month, x.Year, x.IsActive, x.RemainingAmount, x.LoanAmount, x.Id)).ToList();
command.WorkshopId, command.ContractStartGr, command.HasLeft ? DateTime.MaxValue : command.ContractEndGr)
.Select(x =>
new CheckoutLoanInstallment(x.Amount, x.Month, x.Year, x.IsActive, x.RemainingAmount, x.LoanAmount, x.Id)).ToList();
command.InstallmentDeduction = loanInstallments.Sum(x => x.AmountForMonth.MoneyToDouble());

View File

@@ -78,6 +78,11 @@ public class ContractApplication : IContractApplication
}
public async Task<double> GetManualDailWage(long workshopId, long employeeId, long yearlySalaryId, DateTime contractStart)
{
return await _contractRepository.GetManualDailWage(workshopId, employeeId, yearlySalaryId, contractStart);
}
public OperationResult Create(CreateContract command)
{
var yearlysalaryList = _yearlySalaryRepository.GetYearlySalary();
@@ -142,7 +147,9 @@ public class ContractApplication : IContractApplication
yearlySalarId,
start, end, command.DayliWage, command.ArchiveCode, getWorkdate, setContractDate,
command.JobType, command.ContractType, command.WorkshopAddress1, command.WorkshopAddress2,
command.ConsumableItems, command.JobTypeId, command.HousingAllowance, command.AgreementSalary, command.WorkingHoursWeekly, command.FamilyAllowance, command.ContractPeriod);
command.ConsumableItems, command.JobTypeId, command.HousingAllowance, command.AgreementSalary,
command.WorkingHoursWeekly, command.FamilyAllowance, command.ContractPeriod,command.DailySalaryAffected,
command.BaseYearAffected, command.DailySalaryUnAffected,command.BaseYearUnAffected, command.HasManualDailyWage, command.DailyWageType);
_contractRepository.Create(makeContract);
_contractRepository.SaveChanges();
@@ -356,7 +363,9 @@ public class ContractApplication : IContractApplication
command.YearlySalaryId,
start, end, command.DayliWage, command.ArchiveCode, getWorkdate, setContractDate,
command.JobName, command.ContractType, command.WorkshopAddress1, command.WorkshopAddress2,
command.ConsumableItems, command.JobId, command.HousingAllowance, "0", command.WorkingHoursWeekly, command.FamilyAllowance, command.ContractPeriod);
command.ConsumableItems, command.JobId, command.HousingAllowance, "0", command.WorkingHoursWeekly, command.FamilyAllowance, command.ContractPeriod,
command.DailySalaryAffected,
command.BaseYearAffected, command.DailySalaryUnAffected, command.BaseYearUnAffected, command.HasManualDailyWage, command.DailyWageType);
_contractRepository.Create(makeContract);
_contractRepository.SaveChanges();

View File

@@ -319,7 +319,10 @@ namespace CompanyManagment.Application
if (workshopId == 170)
{
var exceptionEmployeeIds = _customizeWorkshopGroupSettingsRepository.GetEmployeeSettingsByGroupSettingsId(117).Select(x => x.EmployeeId).ToList();
var exceptionEmployeeIds = _customizeWorkshopGroupSettingsRepository
.GetEmployeeSettingsByGroupSettingsId(117)
.Select(x => x.EmployeeId)
.Where(x=> workshopLeftWorksInMonth.Select(l=>l.EmployeeId).Contains(x)).ToList();
foreach (var employeesId in exceptionEmployeeIds)
{

View File

@@ -249,7 +249,10 @@ namespace CompanyManagment.Application
if (workshopId == 170)
{
var exceptionEmployeeIds = _customizeWorkshopGroupSettingsRepository.GetEmployeeSettingsByGroupSettingsId(117).Select(x => x.EmployeeId).ToList();
var exceptionEmployeeIds = _customizeWorkshopGroupSettingsRepository
.GetEmployeeSettingsByGroupSettingsId(117)
.Select(x => x.EmployeeId)
.Where(x=> workshopLeftWorksInMonth.Select(l=>l.EmployeeId).Contains(x)).ToList();
foreach (var employeesId in exceptionEmployeeIds)
{

View File

@@ -179,8 +179,13 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
else
{
nationalCodValid = false;
return opration.Failed("کد ملی وارد شده نا معتبر است");
nationalCodValid = false;
return opration.Failed("کد ملی وارد شده نا معتبر است");
}
}
catch (Exception)
@@ -313,8 +318,15 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
else
{
nationalCodValid = false;
return opration.Failed("کد ملی وارد شده نا معتبر است");
if (command.Nationality == "ایرانی")
{
nationalCodValid = false;
return opration.Failed("کد ملی وارد شده نا معتبر است");
}
else
{
nationalCodValid = true;
}
}
}
catch (Exception)
@@ -1632,11 +1644,11 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
if (apiResult.ResponseContext.Status.Code == 3)
{
return op.Failed("کد ملی نامعتبر است");
return op.Failed("کد ملی و تاریخ تولد با هم همخانی ندارند");
}
if (apiResult.ResponseContext.Status.Code != 0)
{
return op.Failed("کد ملی و تاریخ تولد با هم همخانی ندارند");
return op.Failed("اطلاعات وارد شده نامعتبر میباشد");
}
var basicInfo = apiResult.BasicInformation;
var identityInfo = apiResult.IdentificationInformation;

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Security.AccessControl;
using System.Threading.Tasks;
using System.Xml;
using _0_Framework.Application;
using _0_Framework.Application.Enums;
using _0_Framework.Application.UID;
@@ -13,6 +14,7 @@ using Company.Domain.WorkshopAgg;
using CompanyManagment.App.Contracts.Checkout;
using CompanyManagment.App.Contracts.Employer;
using CompanyManagment.EFCore.Repository;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Identity.Client;
namespace CompanyManagment.Application;
@@ -42,7 +44,6 @@ public class EmployerApplication : IEmployerApplication
}
public OperationResult Active(long id)
{
var opration = new OperationResult();
@@ -1029,7 +1030,7 @@ public class EmployerApplication : IEmployerApplication
}
#endregion
#region Api
public async Task<List<GetEmployerListViewModel>> GetEmployerList(GetEmployerSearchModel searchModel)
@@ -1285,9 +1286,10 @@ public class EmployerApplication : IEmployerApplication
return opration.Succcedded();
}
public async Task<List<EmployerSelectListViewModel>> GetSelectList(string search, long id)
public async Task<List<EmployerSelectListViewModel>> GetSelectList(string search, long id,
LegalType? legalType = null)
{
return await _EmployerRepository.GetSelectList(search, id);
return await _EmployerRepository.GetSelectList(search, id, legalType);
}
async Task<OperationResult<string>> IEmployerApplication.Remove(long id)
@@ -1311,30 +1313,44 @@ public class EmployerApplication : IEmployerApplication
public async Task<OperationResult> CreateWorkflowRegistration(CreateEmployerWorkflowRegistration command)
{
var operation = new OperationResult();
OperationResult<Employer> createEmployerResult = command.LegalType switch
var tranasction = await _EmployerRepository.BeginTransactionAsync();
Employer employer;
if (command.EmployerId != 0)
{
LegalType.Real => await CreateRealEmployerRegistration(command.RealEmployer, command.ContractingPartyId),
LegalType.Legal => await CreateLegalEmployerRegistration(command.LegalEmployer, command.ContractingPartyId),
_ => throw new ArgumentOutOfRangeException()
};
var employer = createEmployerResult.Data;
employer = _EmployerRepository.Get(command.EmployerId);
if (employer == null)
throw new NotFoundException("کارفرمای مورد نظر یافت نشد");
}
else
{
OperationResult<Employer> createEmployerResult = command.LegalType switch
{
LegalType.Real =>
await CreateRealEmployerRegistration(command.RealEmployer, command.ContractingPartyId),
LegalType.Legal => await CreateLegalEmployerRegistration(command.LegalEmployer,
command.ContractingPartyId),
_ => throw new ArgumentOutOfRangeException()
};
employer = createEmployerResult.Data;
if (!createEmployerResult.IsSuccedded)
return operation.Failed(createEmployerResult.Message);
if (!createEmployerResult.IsSuccedded)
return operation.Failed(createEmployerResult.Message);
}
var workshopDetails =
await _institutionContractRepository.GetInstitutionWorkshopDetails(command.InstitutionWorkshopDetailsId);
await _institutionContractRepository.GetInstitutionWorkshopInitialDetails(command
.InstitutionWorkshopInitialId);
workshopDetails.AddEmployer(employer.id);
await _institutionContractRepository.SaveChangesAsync();
await tranasction.CommitAsync();
return operation.Succcedded();
}
public async Task<OperationResult> EditWorkflowRegistration(EditEmployerWorkflowRegistration command)
{
var operation = new OperationResult();
// Get the existing employer
var employer = _EmployerRepository.Get(command.EmployerId);
if (employer == null)
@@ -1363,55 +1379,56 @@ public class EmployerApplication : IEmployerApplication
public async Task<OperationResult> DeleteWorkflowRegistration(long employerId, long institutionWorkshopDetailsId)
{
var operation = new OperationResult();
// Check if employer exists
var employer = _EmployerRepository.Get(employerId);
if (employer == null)
return operation.Failed("کارفرمای مورد نظر یافت نشد");
// Get workshop details
var workshopDetails = await _institutionContractRepository.GetInstitutionWorkshopDetails(institutionWorkshopDetailsId);
var workshopDetails =
await _institutionContractRepository.GetInstitutionWorkshopInitialDetails(institutionWorkshopDetailsId);
if (workshopDetails == null)
return operation.Failed("جزئیات کارگاه موسسه یافت نشد");
// Find and remove the employer from workshop details
var employerDetail = workshopDetails.Employers.FirstOrDefault(e => e.EmployerId == employerId);
if (employerDetail == null)
return operation.Failed("کارفرما در لیست کارگاه یافت نشد");
// Remove the employer from the list
workshopDetails.Employers.Remove(employerDetail);
await _institutionContractRepository.SaveChangesAsync();
// Delete the employer
_EmployerRepository.Remove(employerId);
await _EmployerRepository.SaveChangesAsync();
return operation.Succcedded();
}
public async Task<OperationResult<AuthenticateUserViewModel>> AuthenticateEmployer(string nationalCode,
string dateOfBirth,
string mobile)
{
var op = new OperationResult<AuthenticateUserViewModel>();
var dateOfBirthGr = dateOfBirth.ToGeorgianDateTime();
var isMachMobilAndNationalCode = await _uidService.IsMachPhoneWithNationalCode(nationalCode, mobile);
if (isMachMobilAndNationalCode == null)
return op.Failed("خطا در سرویس احراز هویت");
if (!isMachMobilAndNationalCode.IsMatched)
return op.Failed("شماره همراه وارد شده با کد ملی مطابقت ندارد");
var apiRespons = await _uidService.GetPersonalInfo(nationalCode, dateOfBirth);
if (apiRespons == null)
throw new InternalServerException("سیستم احراز هویت در دسترس نمی باشد");
if (apiRespons.ResponseContext.Status.Code ==14)
if (apiRespons.ResponseContext.Status.Code == 14)
throw new InternalServerException("سیستم احراز هویت در دسترس نمی باشد");
if (apiRespons.ResponseContext.Status.Code != 0)
return op.Failed($"{apiRespons.ResponseContext.Status.Message}");
@@ -1419,6 +1436,7 @@ public class EmployerApplication : IEmployerApplication
? apiRespons.IdentificationInformation.NationalId
: apiRespons.IdentificationInformation.ShenasnamehNumber;
var res = new AuthenticateUserViewModel()
{
DateOfBirth = dateOfBirth,
@@ -1435,6 +1453,12 @@ public class EmployerApplication : IEmployerApplication
return op.Succcedded(res);
}
public Task<ActionResult<EditEmployerWorkflowRegistration>> GetWorkflowRegistrationForEdit(long employerId,
long institutionWorkshopDetailsId)
{
return _EmployerRepository.GetWorkflowRegistrationForEdit(employerId, institutionWorkshopDetailsId);
}
private async Task<OperationResult<Employer>> CreateLegalEmployerRegistration(
CreateLegalEmployerWorkflowRegistration command, long contractingPartyId)
{
@@ -1501,6 +1525,11 @@ public class EmployerApplication : IEmployerApplication
command.GovernmentSystemInfo.EServiceUsername, command.GovernmentSystemInfo.EServicePassword,
command.GovernmentSystemInfo.TaxUsername, command.GovernmentSystemInfo.TaxPassword,
command.GovernmentSystemInfo.SanaUsername, command.GovernmentSystemInfo.SanaPassword);
if (command.IsAuth)
{
legalEmployerData.LegalAuthentication(command.CeoFName,command.CeoLName,command.CeoFatherName,
command.CeoIdNumber,command.IdNumberSeri,command.IdNumberSerial,command.CeoDateOfBirth,command.Gender,command.PhoneNumber);
}
await _EmployerRepository.CreateAsync(legalEmployerData);
await _EmployerRepository.SaveChangesAsync();
@@ -1554,6 +1583,12 @@ public class EmployerApplication : IEmployerApplication
command.GovernmentSystemInfo.EServicePassword,
command.GovernmentSystemInfo.TaxUsername, command.GovernmentSystemInfo.TaxPassword,
command.GovernmentSystemInfo.SanaUsername, command.GovernmentSystemInfo.SanaPassword);
if (command.IsAuth)
{
employerData.Authentication(command.FName, command.LName, command.FatherName, command.IdNumber,
command.IdNumberSeri,
command.IdNumberSerial, command.DateOfBirth, command.Gender, command.PhoneNumber);
}
await _EmployerRepository.CreateAsync(employerData);
await _EmployerRepository.SaveChangesAsync();
@@ -1663,5 +1698,6 @@ public class EmployerApplication : IEmployerApplication
await _EmployerRepository.SaveChangesAsync();
return operation.Succcedded();
}
#endregion
}

View File

@@ -6,6 +6,8 @@ using System.Threading;
using System.Threading.Tasks;
using _0_Framework.Application;
using _0_Framework.Application.Enums;
using _0_Framework.Application.Sms;
using _0_Framework.Application.UID;
using _0_Framework.Exceptions;
using AccountManagement.Application.Contracts.Account;
using Company.Domain.ContarctingPartyAgg;
@@ -24,6 +26,8 @@ using CompanyManagment.App.Contracts.InstitutionContractContactinfo;
using CompanyManagment.App.Contracts.PersonalContractingParty;
using CompanyManagment.App.Contracts.Workshop;
using CompanyManagment.EFCore.Migrations;
using Microsoft.AspNetCore.Mvc;
using OfficeOpenXml.Packaging.Ionic.Zip;
using PersianTools.Core;
using ConnectedPersonnelViewModel = CompanyManagment.App.Contracts.Workshop.ConnectedPersonnelViewModel;
using FinancialStatment = Company.Domain.FinancialStatmentAgg.FinancialStatment;
@@ -44,6 +48,8 @@ public class InstitutionContractApplication : IInstitutionContractApplication
private readonly IFinancialStatmentRepository _financialStatmentRepository;
private readonly IContactInfoApplication _contactInfoApplication;
private readonly IAccountApplication _accountApplication;
private readonly ISmsService _smsService;
private readonly IUidService _uidService;
public InstitutionContractApplication(IInstitutionContractRepository institutionContractRepository,
@@ -53,7 +59,7 @@ public class InstitutionContractApplication : IInstitutionContractApplication
IFinancialStatmentApplication financialStatmentApplication, IWorkshopApplication workshopApplication,
IContractingPartyTempRepository contractingPartyTempRepository,
IFinancialStatmentRepository financialStatmentRepository, IContactInfoApplication contactInfoApplication,
IAccountApplication accountApplication)
IAccountApplication accountApplication, ISmsService smsService, IUidService uidService)
{
_institutionContractRepository = institutionContractRepository;
_contractingPartyRepository = contractingPartyRepository;
@@ -67,6 +73,8 @@ public class InstitutionContractApplication : IInstitutionContractApplication
_financialStatmentRepository = financialStatmentRepository;
_contactInfoApplication = contactInfoApplication;
_accountApplication = accountApplication;
_smsService = smsService;
_uidService = uidService;
}
public OperationResult Create(CreateInstitutionContract command)
@@ -201,7 +209,7 @@ public class InstitutionContractApplication : IInstitutionContractApplication
command.ContractStartFa, contractEndGr, command.ContractEndFa, command.ContractAmount,
command.DailyCompenseation, command.Obligation,
command.TotalAmount, 0, command.WorkshopManualCount, command.EmployeeManualCount, command.Description,
command.OfficialCompany, command.TypeOfContract, command.HasValueAddedTax, command.ValueAddedTax);
command.OfficialCompany, command.TypeOfContract, command.HasValueAddedTax, command.ValueAddedTax, [],command.LawId);
_institutionContractRepository.Create(createContract);
_institutionContractRepository.SaveChanges();
@@ -310,7 +318,7 @@ public class InstitutionContractApplication : IInstitutionContractApplication
command.DailyCompenseation, command.Obligation,
command.TotalAmount, command.ExtensionNo, command.WorkshopManualCount, command.EmployeeManualCount,
command.Description, command.OfficialCompany, command.TypeOfContract, command.HasValueAddedTax,
command.ValueAddedTax);
command.ValueAddedTax, [],command.LawId);
_institutionContractRepository.Create(createContract);
_institutionContractRepository.SaveChanges();
@@ -926,19 +934,78 @@ public class InstitutionContractApplication : IInstitutionContractApplication
var syear = command.ContractStartFa.Substring(0, 4);
var smonth = command.ContractStartFa.Substring(5, 2);
var sday = command.ContractStartFa.Substring(8, 2);
var transaction = await _contractingPartyRepository.BeginTransactionAsync();
OperationResult<PersonalContractingParty> contractingPartyResult = command.ContractingPartyLegalType switch
if (command.ContractStartFa.TryToGeorgianDateTime(out var contractStartGr) == false)
return opration.Failed("تاریخ شروع قرارداد معتبر نیست");
contractStartGr.AddMonthsFa((int)command.Duration, out var contractEndGr);
contractEndGr = contractEndGr.ToFarsi().FindeEndOfMonth().ToGeorgianDateTime();
PersonalContractingParty existingContractingParty = null;
if (command.ContractingPartyLegalType == LegalType.Legal)
{
LegalType.Legal => await CreateLegalContractingPartyEntity(command.LegalParty, command.RepresentativeId),
LegalType.Real => await CreateRealContractingPartyEntity(command.RealParty, command.RepresentativeId),
_ => throw new BadRequestException("نوع طرف قرارداد مشخص نشده است")
};
existingContractingParty =
await _contractingPartyRepository.GetByRegisterId(command.LegalParty.RegisterId);
if (_contractingPartyRepository.Exists(x =>
x.LName == command.LegalParty.CompanyName && x.RegisterId == command.LegalParty.RegisterId))
{
if (_institutionContractRepository.Exists(x => x.ContractStartGr < contractEndGr
&& contractStartGr < x.ContractEndGr
&& x.ContractingPartyId == existingContractingParty.id
&& x.IsActiveString == "true"))
{
throw new BadRequestException("امکان ایجاد قرارداد تکراری وجود ندارد");
}
}
}
else if (command.ContractingPartyLegalType == LegalType.Real)
{
existingContractingParty =
await _contractingPartyRepository.GetByNationalCode(command.RealParty.NationalCode);
if (_contractingPartyRepository.Exists(x =>
x.LName == command.RealParty.LName && x.Nationalcode == command.RealParty.NationalCode))
{
if (_institutionContractRepository.Exists(x => x.ContractStartGr < contractEndGr
&& contractStartGr < x.ContractEndGr
&& x.ContractingPartyId == existingContractingParty.id
&& x.IsActiveString == "true"))
{
throw new BadRequestException("امکان ایجاد قرارداد تکراری وجود ندارد");
}
}
}
if (!contractingPartyResult.IsSuccedded)
return opration.Failed(contractingPartyResult.Message);
PersonalContractingParty contractingParty;
if (existingContractingParty != null)
{
contractingParty = existingContractingParty;
}
else
{
OperationResult<PersonalContractingParty> contractingPartyResult = command.ContractingPartyLegalType switch
{
LegalType.Legal => await CreateLegalContractingPartyEntity(command.LegalParty, command.RepresentativeId,
command.Address,
command.City, command.Province),
LegalType.Real => await CreateRealContractingPartyEntity(command.RealParty, command.RepresentativeId,
command.Address,
command.City, command.Province),
_ => throw new BadRequestException("نوع طرف قرارداد مشخص نشده است")
};
var contractingParty = contractingPartyResult.Data;
if (!contractingPartyResult.IsSuccedded)
return opration.Failed(contractingPartyResult.Message);
contractingParty = contractingPartyResult.Data;
}
if (_institutionContractRepository.Exists(x =>
x.ContractingPartyId == contractingParty.id && x.RepresentativeId == command.RepresentativeId &&
x.TypeOfContract == "JobRelation"))
return opration.Failed(
"برای این معرف و طرف حساب قبلا قرارداد ایجاد شده است، شما میتوانید از تمدید استفاده کنید");
var contractNo = $"{syear}{smonth}{sday}/{contractingParty.ArchiveCode}/0";
@@ -946,15 +1013,12 @@ public class InstitutionContractApplication : IInstitutionContractApplication
if (representative == null)
return opration.Failed("معرف مورد نظر یافت نشد");
if (command.ContractStartFa.TryToGeorgianDateTime(out var contractStartGr) == false)
return opration.Failed("تاریخ شروع قرارداد معتبر نیست");
if (command.IsInstallment && !command.Workshops.Any(x=>x.HasContractPlanInPerson || x.HasInsurancePlanInPerson))
if (command.IsInstallment &&
!command.Workshops.Any(x => x.HasContractPlanInPerson || x.HasInsurancePlanInPerson))
{
return opration.Failed("برای قراردادهای اقساطی حداقل یک کارگاه باید دارای طرح حضوری باشد");
}
contractStartGr.AddMonthsFa((int)command.Duration, out var contractEndGr);
contractEndGr = contractEndGr.ToFarsi().FindeEndOfMonth().ToGeorgianDateTime();
var today = DateTime.Today;
@@ -966,27 +1030,39 @@ public class InstitutionContractApplication : IInstitutionContractApplication
var contractingPartyFullName = contractingParty.FName + " " + contractingParty.LName;
var workshopDetails = command.Workshops.Select(x =>
new InstitutionContractWorkshopInitial(x.WorkshopName, x.HasRollCallPlan, false, x.HasCustomizeCheckoutPlan,
x.HasContractPlan, x.HasContractPlanInPerson, x.HasInsurancePlan, x.HasInsurancePlanInPerson,
x.PersonnelCount, x.Price)).ToList();
var entity = new InstitutionContract(contractNo, command.RepresentativeId, representative.FullName,
contractingParty.id,
contractingPartyFullName, contractDateGr, contractDateFa, command.Province, command.City, command.Address,
contractStartGr,
contractStartGr.ToFarsi(), contractEndGr, contractEndGr.ToFarsi(), 0, command.DailyCompensation,
contractStartGr.ToFarsi(), contractEndGr, contractEndGr.ToFarsi(), command.OneMonthAmount,
command.DailyCompensation,
command.Obligation, command.TotalAmount, 0,
command.Workshops.Count.ToString(),
command.Workshops.Sum(x => x.PersonnelCount).ToString(), command.Description,
"NotOfficial", "JobRelation", hasValueAddedTax
, command.TaxAmount);
"NotOfficial", "JobRelation", hasValueAddedTax,
command.TaxAmount, workshopDetails,command.LawId);
var workshopDetails = command.Workshops.Select(x =>
new InstitutionContractWorkshopDetail(x.WorkshopName, x.HasRollCallPlan, x.HasCustomizeCheckoutPlan,
x.HasContractPlan, x.HasContractPlanInPerson,x.HasInsurancePlan,x.HasInsurancePlanInPerson,x.PersonnelCount, x.Price)).ToList();
var financialStatement = new FinancialStatment(contractingParty.id, contractingPartyFullName);
FinancialStatment financialStatement;
if (_financialStatmentRepository.Exists(x => x.ContractingPartyId == contractingParty.id))
{
financialStatement = await _financialStatmentRepository.GetByContractingPartyId(contractingParty.id);
}
else
{
financialStatement = new FinancialStatment(contractingParty.id, contractingPartyFullName);
await _financialStatmentRepository.CreateAsync(financialStatement);
}
if (command.IsInstallment)
{
var installments =
var installments =
CalculateInstallment(command.TotalAmount, (int)command.Duration, command.ContractStartFa, true);
// دریافت مبلغ اولین قسط
@@ -1016,8 +1092,7 @@ public class InstitutionContractApplication : IInstitutionContractApplication
financialStatement.AddFinancialTransaction(financialTransaction);
}
entity.SetWorkshopDetails(workshopDetails);
await _financialStatmentRepository.CreateAsync(financialStatement);
await _institutionContractRepository.CreateAsync(entity);
await _institutionContractRepository.SaveChangesAsync();
@@ -1063,8 +1138,13 @@ public class InstitutionContractApplication : IInstitutionContractApplication
var res = _accountApplication.RegisterClient(createAcc);
if (res.IsSuccedded)
CreateContractingPartyAccount(contractingParty.id, res.SendId);
await _institutionContractRepository.SaveChangesAsync();
await _smsService.SendInstitutionVerificationLink(contractingParty.Phone, contractingPartyFullName,
entity.PublicId);
await transaction.CommitAsync();
return opration.Succcedded();
}
@@ -1073,11 +1153,7 @@ public class InstitutionContractApplication : IInstitutionContractApplication
{
throw new NotImplementedException();
}
public async Task<OperationResult> ExtensionَAsync(CreateInstitutionContractRequest command)
{
throw new NotImplementedException();
}
public Task<List<RegistrationWorkflowMainListViewModel>> RegistrationWorkflowMainList()
{
@@ -1089,14 +1165,158 @@ public class InstitutionContractApplication : IInstitutionContractApplication
return _institutionContractRepository.RegistrationWorkflowItems(institutionContractId);
}
public async Task<GetInstitutionVerificationDetailsViewModel> GetVerificationDetails(Guid id)
{
return await _institutionContractRepository.GetVerificationDetails(id);
}
public async Task<OperationResult<OtpResultViewModel>> SendVerifyOtp(Guid id)
{
var institutionContract = await _institutionContractRepository.GetByPublicIdAsync(id);
if (institutionContract == null)
{
throw new NotFoundException("رکورد مورد نظر یافت نشد");
}
if (institutionContract.VerificationStatus == InstitutionContractVerificationStatus.Verified)
throw new BadRequestException("این قرارداد مالی قبلا تایید شده است");
if (institutionContract.VerificationStatus == InstitutionContractVerificationStatus.PendingForVerify &&
institutionContract.VerifyCodeCreation != DateTime.MinValue)
{
if (!institutionContract.CanResendVerifyCode)
{
throw new BadRequestException("کد تایید قبلی هنوز منقضی نشده است",
new Dictionary<string, object>
{
{
"expireTime", (int)institutionContract.ReSendTime.TotalSeconds -
(int)(DateTime.Now - institutionContract.VerifyCodeCreation).TotalSeconds
}
});
}
}
var contractingParty = _contractingPartyRepository.Get(institutionContract.ContractingPartyId);
if (contractingParty == null)
throw new NotFoundException("طرف قرارداد یافت نشد");
var code = new Random().Next(1000, 9999).ToString();
institutionContract.SetVerifyCode(code);
var transaction = await _institutionContractRepository.BeginTransactionAsync();
try
{
await _institutionContractRepository.SaveChangesAsync();
_smsService.VerifySend(contractingParty.Phone, code);
}
catch (Exception e)
{
transaction.Rollback();
Console.WriteLine(e);
throw;
}
await transaction.CommitAsync();
var result = new OtpResultViewModel
{
ExpireTimeSec = (int)institutionContract.ExpireTime.TotalSeconds,
ReSendTimeSec = (int)institutionContract.ReSendTime.TotalSeconds
};
return new OperationResult<OtpResultViewModel>().Succcedded(result);
}
public async Task<OperationResult> VerifyOtp(Guid publicId, string code)
{
var op = new OperationResult();
var institutionContract = await _institutionContractRepository.GetByPublicIdAsync(publicId);
if (institutionContract == null)
{
throw new NotFoundException("رکورد مورد نظر یافت نشد");
}
if (institutionContract.VerificationStatus == InstitutionContractVerificationStatus.Verified)
throw new BadRequestException("این قرارداد مالی قبلا تایید شده است");
if (institutionContract.VerificationStatus == InstitutionContractVerificationStatus.PendingForVerify &&
institutionContract.VerifyCodeExpired)
throw new BadRequestException("کد تایید منقضی شده است");
var contractingParty = _contractingPartyRepository.Get(institutionContract.ContractingPartyId);
if (contractingParty == null)
throw new NotFoundException("طرف قرارداد یافت نشد");
if (institutionContract.VerifyCode != code)
return op.Failed("کد وارد شده صحیح نمی باشد");
institutionContract.SetPendingWorkflow();
await _institutionContractRepository.SaveChangesAsync();
return op.Succcedded();
}
public async Task<InstitutionContractWorkshopDetailViewModel> GetWorkshopInitialDetails(long workshopDetailsId)
{
var details = await _institutionContractRepository.GetInstitutionWorkshopInitialDetails(workshopDetailsId);
var services = details.Services;
var newArchiveCode = _workshopRepository.GetLastArchiveCode() + 1;
var res = new InstitutionContractWorkshopDetailViewModel()
{
ServicesViewModel = new WorkshopServicesViewModel()
{
Contract = services.Contract,
ContractInPerson = services.ContractInPerson,
CustomizeCheckout = services.CustomizeCheckout,
Insurance = services.Insurance,
InsuranceInPerson = services.InsuranceInPerson,
RollCall = services.RollCall,
RollCallInPerson = services.RollCallInPerson
},
WorkshopName = details.WorkshopName,
ArchiveCode =newArchiveCode
};
return res;
}
public async Task<InstitutionContractExtensionInquiryResult> GetExtensionInquiry(long previousContractId)
{
return await _institutionContractRepository.GetExtensionInquiry(previousContractId);
}
public async Task<InstitutionContractExtensionWorkshopsResponse> GetExtensionWorkshops(
InstitutionContractExtensionWorkshopsRequest request)
{
return await _institutionContractRepository.GetExtensionWorkshops(request);
}
public async Task<InstitutionContractExtensionPlanResponse> GetExtensionInstitutionPlan(InstitutionContractExtensionPlanRequest request)
{
return await _institutionContractRepository.GetExtensionInstitutionPlan(request);
}
public async Task<InstitutionContractExtensionPaymentResponse> GetExtensionPaymentMethod(InstitutionContractExtensionPaymentRequest request)
{
return await _institutionContractRepository.GetExtensionPaymentMethod(request);
}
public async Task<OperationResult> ExtensionComplete(InstitutionContractExtensionCompleteRequest request)
{
return await _institutionContractRepository.ExtensionComplete(request);
}
public async Task<List<InstitutionContractSelectListViewModel>> GetInstitutionContractSelectList(string search, string selected)
{
return await _institutionContractRepository.GetInstitutionContractSelectList(search,selected);
}
private async Task<OperationResult<PersonalContractingParty>> CreateLegalContractingPartyEntity(
CreateInstitutionContractLegalPartyRequest request, long representativeId)
CreateInstitutionContractLegalPartyRequest request, long representativeId, string address, string city,
string state)
{
var opration = new OperationResult<PersonalContractingParty>();
if (_contractingPartyRepository.Exists(x =>
x.LName == request.CompanyName && x.RegisterId == request.RegisterId))
return opration.Failed("امکان ثبت رکورد تکراری وجود ندارد");
if (representativeId < 1)
return opration.Failed("لطفا معرف را انتخاب کنید");
@@ -1124,9 +1344,15 @@ public class InstitutionContractApplication : IInstitutionContractApplication
var legalContractingParty = new PersonalContractingParty("*", request.CompanyName,
"*", "*", request.RegisterId, request.NationalId,
"حقوقی",
request.PhoneNumber, request.PhoneNumber, null, representativeId, representative.FullName,
archiveCode, null, null, null, null, request.Position);
request.PhoneNumber, request.PhoneNumber, address, representativeId, representative.FullName,
archiveCode, state, city, null, null,
request.FName, request.LName, request.Position);
if (request.IsAuth)
{
legalContractingParty.LegalAuthentication(request.FName,request.LName,request.FatherName,
request.IdNumber,null,null,request.BirthDateFa,request.Gender,request.PhoneNumber);
}
await _contractingPartyRepository.CreateAsync(legalContractingParty);
await _contractingPartyRepository.SaveChangesAsync();
@@ -1135,13 +1361,11 @@ public class InstitutionContractApplication : IInstitutionContractApplication
}
private async Task<OperationResult<PersonalContractingParty>> CreateRealContractingPartyEntity(
CreateInstitutionContractRealPartyRequest request, long representativeId)
CreateInstitutionContractRealPartyRequest request, long representativeId, string address,
string city, string province)
{
var operation = new OperationResult<PersonalContractingParty>();
if (_contractingPartyRepository.Exists(x =>
x.LName == request.LName && x.Nationalcode == request.NationalCode))
return operation.Failed("امکان ثبت رکورد تکراری وجود ندارد");
if (representativeId < 1)
return operation.Failed("لطفا معرف را انتخاب کنید");
@@ -1166,9 +1390,14 @@ public class InstitutionContractApplication : IInstitutionContractApplication
var personalContractingParty = new PersonalContractingParty(request.FName, request.LName,
request.NationalCode, request.IdNumber, "*", "*",
"حقیقی",
request.PhoneNumber, request.PhoneNumber, null, representativeId, representative.FullName, archiveCode,
null, null, null, null);
request.PhoneNumber, request.PhoneNumber, address, representativeId, representative.FullName, archiveCode,
province, city, null, null, null, null);
if (request.IsAuth)
{
personalContractingParty.Authentication(request.FName, request.LName, request.FatherName,
request.IdNumber, null,null, request.BirthDateFa, request.Gender,request.PhoneNumber);
}
await _contractingPartyRepository.CreateAsync(personalContractingParty);
await _contractingPartyRepository.SaveChangesAsync();
@@ -1284,4 +1513,4 @@ public class WorkshopsAndEmployeeViewModel
public int ArchiveCode { get; set; }
}
#endregion
#endregion

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using _0_Framework.Application;
using Company.Domain.InsuranceJobItemAgg;
using Company.Domain.InsurancJobAgg;
@@ -155,4 +156,9 @@ public class InsuranceJobApplication: IInsuranceJobApplication
{
return _insuranceJobRepositpry.Remove(id);
}
public async Task<List<InsuranceJobSelectListViewModel>> GetSelectList()
{
return await _insuranceJobRepositpry.GetSelectList();
}
}

View File

@@ -2366,5 +2366,10 @@ public class InsuranceListApplication : IInsuranceListApplication
return _insuranceListRepositpry.GetTabCounts(searchModel);
}
public async Task<List<InsuranceListViewModel>> GetNotCreatedWorkshop(InsuranceListSearchModel searchModel)
{
return await _insuranceListRepositpry.GetNotCreatedWorkshop(searchModel);
}
#endregion
}

View File

@@ -20,9 +20,16 @@ public class LawApplication : ILawApplication
public OperationResult Create(CreateLaw command)
{
var operation = new OperationResult();
if (_lawRepository.Exists(x => x.Type == command.Type))
// قبل از ایجاد قانون جدید، همه قوانین قدیمی از این نوع را غیرفعال می‌کنیم
var existingLaws = _lawRepository.Get().Where(x => x.Type == command.Type).ToList();
if (existingLaws.Any())
{
return operation.Failed("این قانون قبلا ثبت شده است");
foreach (var existingLaw in existingLaws)
{
existingLaw.Deactivate();
}
_lawRepository.SaveChanges();
}
var law = new Law(command.Title, command.Type, command.Notifications, command.HeadTitle);
@@ -56,6 +63,8 @@ public class LawApplication : ILawApplication
{
return operation.Failed("باید حداقل یک بند برای قانون باید ثبت شود");
}
// Create new items list for the new version
var orderNumber = 1;
var lawItems = command.Items.Select(x =>
{
@@ -63,12 +72,17 @@ public class LawApplication : ILawApplication
orderNumber++;
return res;
}).ToList();
law.Edit(command.Title);
law.SetItem(lawItems);
// Mark the current version as old version
law.SetAsOldVersion();
// Create a new version based on the old one
var newVersion = law.CreateNewVersion(command.Title, command.Notifications, command.HeadTitle, lawItems);
// Save the new version
_lawRepository.Create(newVersion);
_lawRepository.SaveChanges();
return operation.Succcedded();
}
@@ -82,13 +96,13 @@ public class LawApplication : ILawApplication
return operation.Failed("باید حداقل یک بند برای قانون باید ثبت شود");
}
// Check if law exists by type
var existingLaw = _lawRepository.Get().FirstOrDefault(x => x.Type == command.Type);
// Check if active law exists by type
var existingLaw = _lawRepository.Get().FirstOrDefault(x => x.Type == command.Type && x.IsActive);
if (existingLaw == null)
{
// If law doesn't exist, create a new one
var law = new Law(command.Title, command.Type,command.Notifications, command.HeadTitle);
var law = new Law(command.Title, command.Type, command.Notifications, command.HeadTitle);
var orderNumber = 1;
foreach (var item in command.Items)
@@ -102,7 +116,10 @@ public class LawApplication : ILawApplication
}
else
{
// If law exists, update it
// Mark the current version as old version
existingLaw.SetAsOldVersion();
// Create new items list for the new version
var orderNumber = 1;
var lawItems = command.Items.Select(x =>
{
@@ -111,9 +128,11 @@ public class LawApplication : ILawApplication
return res;
}).ToList();
existingLaw.Edit(command.Title);
existingLaw.SetItem(lawItems);
// Create a new version based on the old one
var newVersion = existingLaw.CreateNewVersion(command.Title, command.Notifications, command.HeadTitle, lawItems);
// Save the new version
_lawRepository.Create(newVersion);
_lawRepository.SaveChanges();
}
@@ -128,8 +147,17 @@ public class LawApplication : ILawApplication
if (law == null)
return operation.Failed(ApplicationMessages.RecordNotFound);
// غیرفعال کردن همه نسخه‌های قبلی از این نوع قانون
var otherLaws = _lawRepository.Get().Where(x => x.Type == law.Type && x.id != law.id).ToList();
foreach (var otherLaw in otherLaws)
{
otherLaw.Deactivate();
}
// فعال کردن این نسخه به عنوان آخرین نسخه
law.Activate();
_lawRepository.SaveChanges();
return operation.Succcedded();
}
@@ -149,9 +177,11 @@ public class LawApplication : ILawApplication
public OperationResult ActivateByType(LawType type)
{
var operation = new OperationResult();
var law = _lawRepository.Get().FirstOrDefault(x => x.Type == type);
if (law == null)
// غیرفعال کردن همه نسخه‌های قبلی از این نوع قانون
var existingLaws = _lawRepository.Get().Where(x => x.Type == type).ToList();
if (!existingLaws.Any())
{
// If law doesn't exist, create a new active one with default values
var newLaw = new Law(GetDefaultTitleForLawType(type), type, new List<string>(), "");
@@ -160,21 +190,36 @@ public class LawApplication : ILawApplication
_lawRepository.SaveChanges();
return operation.Succcedded();
}
law.Activate();
// فعال کردن آخرین نسخه (با بالاترین شماره نسخه)
var latestVersion = existingLaws.OrderByDescending(x => x.Version).First();
// غیرفعال کردن سایر نسخه‌ها
foreach (var law in existingLaws.Where(x => x.id != latestVersion.id))
{
law.Deactivate();
}
// فعال کردن آخرین نسخه
latestVersion.Activate();
_lawRepository.SaveChanges();
return operation.Succcedded();
}
public OperationResult DeactivateByType(LawType type)
{
var operation = new OperationResult();
var law = _lawRepository.Get().FirstOrDefault(x => x.Type == type);
var laws = _lawRepository.Get().Where(x => x.Type == type).ToList();
if (law == null)
if (!laws.Any())
return operation.Failed("قانون مورد نظر یافت نشد");
law.Deactivate();
foreach (var law in laws)
{
law.Deactivate();
}
_lawRepository.SaveChanges();
return operation.Succcedded();
}
@@ -187,6 +232,8 @@ public class LawApplication : ILawApplication
Id = law.id,
Title = law.Title,
Type = law.Type,
HeadTitle = law.HeadTitle,
Notifications = law.Notifications,
Items = law.Items.OrderBy(x => x.OrderNumber).Select(x => new LawItemViewModel
{
Header = x.Header,
@@ -197,10 +244,8 @@ public class LawApplication : ILawApplication
public async Task<List<LawViewModel>> GetList(LawSearchModel searchModel)
{
// Get filtered laws from database
// Get all laws from database, including version information
return await _lawRepository.GetList(searchModel);
}
private string GetDefaultTitleForLawType(LawType lawType)
@@ -225,6 +270,9 @@ public class LawApplication : ILawApplication
IsActive = law.IsActive,
CreatedAt = law.CreationDate,
Type = law.Type,
HeadTitle = law.HeadTitle,
Notifications = law.Notifications,
Version = law.Version,
Items = law.Items.OrderBy(x=>x.OrderNumber).Select(x => new LawItemViewModel
{
Header = x.Header,
@@ -235,6 +283,7 @@ public class LawApplication : ILawApplication
public async Task<LawViewModel> GetLawByType(LawType type)
{
// Only get the active (latest) version of the law
var lawViewModel = await _lawRepository.GetByType(type);
// If no law exists for this type, return a default empty law
@@ -247,6 +296,7 @@ public class LawApplication : ILawApplication
IsActive = false,
CreatedAt = DateTime.Now,
Type = type,
Version = 1,
Items = new List<LawItemViewModel>()
};
}

View File

@@ -84,7 +84,7 @@ public class LeaveApplication : ILeaveApplication
var end = command.PaidLeaveType == "ساعتی" ? start : command.EndLeave.ToGeorgianDateTime();
var checkErr = _leaveRepository.CheckErrors(start, end, command.EmployeeId, command.WorkshopId);
var checkErr = _leaveRepository.CheckErrors(start, end, command.EmployeeId, command.WorkshopId,command.IsInvallid);
// start = new DateTime(start.Year, start.Month, start.Day, startH.Hours, startH.Minutes, startH.Seconds);
//end = new DateTime(end.Year, end.Month, end.Day, endH.Hours, endH.Minutes, endH.Seconds);
@@ -96,8 +96,10 @@ public class LeaveApplication : ILeaveApplication
return op.Failed(checkErr.ContractErrMessage);
if (checkErr.HasLeftWork)
return op.Failed(checkErr.LeftWorlErrMessage);
//if (checkErr.HasHolidayError)
// return op.Failed(checkErr.HolidayErrorMessage);
if (start > end)
if (start > end)
return op.Failed("تارخ شروع از پایان بزرگتر است");
@@ -180,29 +182,30 @@ public class LeaveApplication : ILeaveApplication
shiftDuration = shiftEndDateTime - shiftStartDateTime;
hasShiftDuration = true;
}
}
else if (employeeSettings is { WorkshopShiftStatus: WorkshopShiftStatus.Irregular })
{
if ((end - start).TotalDays > 1)
else if (employeeSettings is { WorkshopShiftStatus: WorkshopShiftStatus.Irregular })
{
return op.Failed("شما نمیتوانید بیشتر از یک روز مرخصی روزانه ثبت کنید");
}
var isActive = _rollCallEmployeeStatusApplication.IsActiveInPeriod(command.EmployeeId, command.WorkshopId, start, start);
if (isActive)
{
shiftDuration = employeeSettings.IrregularShift.WorkshopIrregularShifts switch
if ((end - start).TotalDays > 1)
{
WorkshopIrregularShifts.TwelveThirtySix => TimeSpan.FromHours(12),
WorkshopIrregularShifts.TwelveTwentyFour => TimeSpan.FromHours(12),
WorkshopIrregularShifts.TwentyFourFortyEight => TimeSpan.FromHours(24),
WorkshopIrregularShifts.TwentyFourTwentyFour => TimeSpan.FromHours(24),
_ => new TimeSpan()
};
hasShiftDuration = true;
}
return op.Failed("شما نمیتوانید بیشتر از یک روز مرخصی روزانه ثبت کنید");
}
var isActive = _rollCallEmployeeStatusApplication.IsActiveInPeriod(command.EmployeeId, command.WorkshopId, start, start);
if (isActive)
{
shiftDuration = employeeSettings.IrregularShift.WorkshopIrregularShifts switch
{
WorkshopIrregularShifts.TwelveThirtySix => TimeSpan.FromHours(12),
WorkshopIrregularShifts.TwelveTwentyFour => TimeSpan.FromHours(12),
WorkshopIrregularShifts.TwentyFourFortyEight => TimeSpan.FromHours(24),
WorkshopIrregularShifts.TwentyFourTwentyFour => TimeSpan.FromHours(24),
_ => new TimeSpan()
};
hasShiftDuration = true;
}
}
}
}
@@ -235,7 +238,8 @@ public class LeaveApplication : ILeaveApplication
var employeeFullName = _employeeRepository.GetDetails(command.EmployeeId).EmployeeFullName;
var workshopName = _workshopRepository.GetDetails(command.WorkshopId).WorkshopName;
var leave = new Leave(start, end, totalhourses, command.WorkshopId, command.EmployeeId
, command.PaidLeaveType, command.LeaveType, employeeFullName, workshopName, command.IsAccepted, command.Decription, year, month, shiftDuration, hasShiftDuration);
, command.PaidLeaveType, command.LeaveType, employeeFullName, workshopName, command.IsAccepted, command.Decription,
year, month, shiftDuration, hasShiftDuration,command.IsInvallid);
_leaveRepository.Create(leave);
_leaveRepository.SaveChanges();
@@ -297,13 +301,15 @@ public class LeaveApplication : ILeaveApplication
return op.Failed("لطفا تاریخ پایان را وارد کنید");
var start = command.StartLeave.ToGeorgianDateTime();
var end = command.PaidLeaveType == "ساعتی" ? start : command.EndLeave.ToGeorgianDateTime();
var checkErr = _leaveRepository.CheckErrors(start, end, command.EmployeeId, command.WorkshopId);
var checkErr = _leaveRepository.CheckErrors(start, end, command.EmployeeId, command.WorkshopId,command.IsInvallid);
if (checkErr.HasChekout)
return op.Failed(checkErr.CheckoutErrMessage);
if (checkErr.HasLeftWork)
return op.Failed(checkErr.LeftWorlErrMessage);
if (checkErr.HasHolidayError)
return op.Failed(checkErr.HolidayErrorMessage);
if (start > end)
return op.Failed("تارخ شروع از پایان بزرگتر است");

View File

@@ -131,7 +131,7 @@ public class PersonalContractingPartyApplication : IPersonalContractingPartyApp
command.Nationalcode, command.IdNumber, "*", "*",
"حقیقی",
command.Phone, command.AgentPhone, command.Address,command.RepresentativeId,representative.FullName,command.ArchiveCode,
command.State,command.City,command.Zone,command.SureName);
command.State,command.City,command.Zone,command.SureName,null,null);
_personalContractingPartyRepository.Create(personalContractingParty);
@@ -203,7 +203,7 @@ public class PersonalContractingPartyApplication : IPersonalContractingPartyApp
"*", "*", command.RegisterId, command.NationalId,
"حقوقی",
command.Phone, command.AgentPhone, command.Address,command.RepresentativeId, representative.FullName,command.ArchiveCode,
command.State, command.City, command.Zone,command.SureName);
command.State, command.City, command.Zone,command.SureName,null,null);
_personalContractingPartyRepository.Create(legalContractingParty);
@@ -554,7 +554,7 @@ public class PersonalContractingPartyApplication : IPersonalContractingPartyApp
command.NationalCode, command.IdNumber, "*", "*",
"حقیقی",
command.PhoneNumber, command.AgentPhone, command.Address, command.RepresentativeId, representative.FullName, command.ArchiveCode,
command.State, command.City, command.Zone, command.SureName);
command.State, command.City, command.Zone, command.SureName, null, null);
await _personalContractingPartyRepository.CreateAsync(personalContractingParty);
@@ -607,7 +607,7 @@ public class PersonalContractingPartyApplication : IPersonalContractingPartyApp
"حقوقی",
command.PhoneNumber, command.AgentPhone, command.Address, command.RepresentativeId, representative.FullName,
command.ArchiveCode,
command.State, command.City, command.Zone, command.SureName);
command.State, command.City, command.Zone, command.SureName,null,null);
await _personalContractingPartyRepository.CreateAsync(legalContractingParty);

View File

@@ -21,9 +21,11 @@ public class RollCallMandatoryApplication : IRollCallMandatoryApplication
return _rollCallMandatoryRepository.Exists(x => x.EmployeeId == employeeId && x.WorkshopId == workshopId && x.StartDate.Value.Date >= contractStart.Date);
}
public ComputingViewModel MandatoryCompute(long employeeId, long workshopId, DateTime contractStart, DateTime contractEnd, CreateWorkingHoursTemp command, bool holidayWorking, bool isStaticCheckout, bool rotatingShiftCompute,bool totalLeaveCompute)
public ComputingViewModel MandatoryCompute(long employeeId, long workshopId, DateTime contractStart, DateTime contractEnd, CreateWorkingHoursTemp command, bool holidayWorking, bool isStaticCheckout, bool rotatingShiftCompute, double dailyWageUnAffected, bool totalLeaveCompute)
{
return _rollCallMandatoryRepository.MandatoryCompute(employeeId,workshopId, contractStart, contractEnd, command, holidayWorking, isStaticCheckout, rotatingShiftCompute, totalLeaveCompute);
return _rollCallMandatoryRepository.MandatoryCompute(employeeId,workshopId, contractStart, contractEnd, command, holidayWorking, isStaticCheckout, rotatingShiftCompute, dailyWageUnAffected, totalLeaveCompute);
}
public async Task<ComputingViewModel> RotatingShiftReport(long workshopId, long employeeId, DateTime contractStart, DateTime contractEnd,

View File

@@ -12,6 +12,7 @@ using Company.Domain.TemporaryClientRegistrationAgg;
using CompanyManagment.App.Contracts.InstitutionContract;
using CompanyManagment.App.Contracts.InstitutionPlan;
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
using CompanyManagment.EFCore.Repository;
using IPE.SmsIrClient.Models.Results;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
@@ -58,7 +59,7 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
string dateOfBirth, string mobile)
{
var op = new OperationResult<ContractingPartyTempViewModel>();
var result = new ContractingPartyTempViewModel();
#region Validations
if (string.IsNullOrWhiteSpace(nationalCode) || string.IsNullOrWhiteSpace(dateOfBirth) ||
@@ -94,69 +95,149 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
var dateOfBirthGr = dateOfBirth.ToGeorgianDateTime();
var contractingParty =await _personalContractingPartyRepository.GetByNationalCode(nationalCode);
//اگر طرف حساب موقت قبلا ایجاد شده دیتای آن را برمیگرداند
if (getExistTemp != null)
if (contractingParty != null)
{
var institutionContractTemp = await
_institutionContractTempRepository.GetInstitutionContractTemp(0, getExistTemp.Id);
result.Id = contractingParty.id;
result.FName = contractingParty.FName;
result.LName = contractingParty.LName;
result.DateOfBirthFa = dateOfBirth;
result.FatherName = contractingParty.FatherName;
result.IdNumberSerial = contractingParty.IdNumberSerial;
result.IdNumber = contractingParty.IdNumber;
result.NationalCode = contractingParty.Nationalcode;
if (contractingParty.DateOfBirth != null &&contractingParty.DateOfBirth != dateOfBirthGr)
return op.Failed("تاریخ تولد مطابقت ندارد");
if (institutionContractTemp != null)
var idNumberParty = contractingParty.IdNumber;
if (!contractingParty.IsAuthenticated)
{
if (institutionContractTemp.RegistrationStatus == InstitutionContractTempStatus.Completed)
return op.Failed("شما قبلا ثبت نام خود را تکمیل نموده اید");
//دریافت اطلاعات احراز هویت
var apiResponsParty = await _uidService.GetPersonalInfo(nationalCode, dateOfBirth);
//چک کردن مطابقت شماره همراه و کد ملی
var isMachMobilAndNationalCode = await _uidService.IsMachPhoneWithNationalCode(nationalCode, mobile);
if (isMachMobilAndNationalCode == null)
return op.Failed("خطا در سرویس احراز هویت");
if (!isMachMobilAndNationalCode.IsMatched)
return op.Failed("شماره همراه وارد شده با کد ملی مطابقت ندارد");
if (apiResponsParty == null)
throw new InternalServerException("خطا در سرویس احراز هویت");
if (apiResponsParty.ResponseContext.Status.Code ==14)
throw new InternalServerException("سیستم احراز هویت در دسترس نمی باشد");
if (apiResponsParty.ResponseContext.Status.Code != 0)
return op.Failed($"{apiResponsParty.ResponseContext.Status.Message}");
idNumberParty = apiResponsParty.IdentificationInformation.ShenasnamehNumber == "0"
? apiResponsParty.IdentificationInformation.NationalId
: apiResponsParty.IdentificationInformation.ShenasnamehNumber;
contractingParty.Authentication(apiResponsParty.BasicInformation.FirstName, apiResponsParty.BasicInformation.LastName,
apiResponsParty.BasicInformation.FatherName,idNumberParty,apiResponsParty.IdentificationInformation.ShenasnameSeri,
apiResponsParty.IdentificationInformation.ShenasnameSerial,dateOfBirth,apiResponsParty.BasicInformation.GenderEnum,
mobile);
await _contractingPartyTempRepository.SaveChangesAsync();
}
if (contractingParty.Phone != mobile)
return op.Failed("شما قبلا با شماره همراه دیگری احراز هویت شده اید");
result.Id = contractingParty.id;
result.FName = contractingParty.FName;
result.LName = contractingParty.LName;
result.DateOfBirthFa = dateOfBirth;
result.FatherName = contractingParty.FatherName;
result.IdNumberSerial = contractingParty.IdNumberSerial;
result.IdNumber = idNumberParty;
result.Address = contractingParty.Address;
result.Phone = contractingParty.Phone;
result.City = contractingParty.City;
result.State = contractingParty.State;
result.RepresentativeId = contractingParty.RepresentativeId;
result.NationalCode = contractingParty.Nationalcode;
return op.Succcedded(result);
}
else
{
//اگر طرف حساب موقت قبلا ایجاد شده دیتای آن را برمیگرداند
if (getExistTemp != null)
{
var institutionContractTemp = await
_institutionContractTempRepository.GetInstitutionContractTemp(0, getExistTemp.Id);
if (institutionContractTemp != null)
{
if (institutionContractTemp.RegistrationStatus == InstitutionContractTempStatus.Completed)
return op.Failed("شما قبلا ثبت نام خود را تکمیل نموده اید");
}
if (getExistTemp.DateOfBirth != dateOfBirthGr)
return op.Failed("تاریخ تولد مطابقت ندارد");
if (getExistTemp.Phone != mobile)
return op.Failed("شما قبلا با شماره همراه دیگری ثبت نام نموده اید");
return op.Succcedded(getExistTemp);
}
if (getExistTemp.DateOfBirth != dateOfBirthGr)
return op.Failed("تاریخ تولد مطابقت ندارد");
if (getExistTemp.Phone != mobile)
return op.Failed("شما قبلا با شماره همراه دیگری ثبت نام نموده اید");
return op.Succcedded(getExistTemp);
//چک کردن مطابقت شماره همراه و کد ملی
var isMachMobilAndNationalCode = await _uidService.IsMachPhoneWithNationalCode(nationalCode, mobile);
if (isMachMobilAndNationalCode == null)
return op.Failed("خطا در سرویس احراز هویت");
if (!isMachMobilAndNationalCode.IsMatched)
return op.Failed("شماره همراه وارد شده با کد ملی مطابقت ندارد");
//دریافت اطلاعات احراز هویت
var apiRespons = await _uidService.GetPersonalInfo(nationalCode, dateOfBirth);
if (apiRespons == null)
throw new InternalServerException("خطا در سرویس احراز هویت");
if (apiRespons.ResponseContext.Status.Code == 14)
throw new InternalServerException("سیستم احراز هویت در دسترس نمی باشد");
if (apiRespons.ResponseContext.Status.Code != 0)
return op.Failed($"{apiRespons.ResponseContext.Status.Message}");
var idNumber = apiRespons.IdentificationInformation.ShenasnamehNumber == "0"
? apiRespons.IdentificationInformation.NationalId
: apiRespons.IdentificationInformation.ShenasnamehNumber;
//ایجاد طرف حساب موقت
var createTemp = new ContractingPartyTemp(apiRespons.BasicInformation.FirstName,
apiRespons.BasicInformation.LastName, nationalCode, idNumber, mobile,
apiRespons.BasicInformation.FatherName, "", "", "",
apiRespons.IdentificationInformation.ShenasnameSeri,
apiRespons.IdentificationInformation.ShenasnameSerial, apiRespons.BasicInformation.GenderEnum,
dateOfBirthGr);
await _contractingPartyTempRepository.CreateAsync(createTemp);
await _contractingPartyTempRepository.SaveChangesAsync();
result.Id = createTemp.id;
result.FName = createTemp.FName;
result.LName = createTemp.LName;
result.DateOfBirthFa = dateOfBirth;
result.FatherName = createTemp.FatherName;
result.IdNumberSerial = createTemp.IdNumberSerial;
result.IdNumber = idNumber;
result.NationalCode = createTemp.NationalCode;
return op.Succcedded(result);
}
//چک کردن مطابقت شماره همراه و کد ملی
var isMachMobilAndNationalCode = await _uidService.IsMachPhoneWithNationalCode(nationalCode, mobile);
if (isMachMobilAndNationalCode == null)
return op.Failed("خطا در سرویس احراز هویت");
if (!isMachMobilAndNationalCode.IsMatched)
return op.Failed("شماره همراه وارد شده با کد ملی مطابقت ندارد");
//دریافت اطلاعات احراز هویت
var apiRespons = await _uidService.GetPersonalInfo(nationalCode, dateOfBirth);
if (apiRespons == null)
throw new InternalServerException("خطا در سرویس احراز هویت");
if (apiRespons.ResponseContext.Status.Code ==14)
throw new InternalServerException("سیستم احراز هویت در دسترس نمی باشد");
if (apiRespons.ResponseContext.Status.Code != 0)
return op.Failed($"{apiRespons.ResponseContext.Status.Message}");
var idNumber = apiRespons.IdentificationInformation.ShenasnamehNumber == "0"
? apiRespons.IdentificationInformation.NationalId
: apiRespons.IdentificationInformation.ShenasnamehNumber;
//ایجاد طرف حساب موقت
var createTemp = new ContractingPartyTemp(apiRespons.BasicInformation.FirstName,
apiRespons.BasicInformation.LastName, nationalCode, idNumber, mobile,
apiRespons.BasicInformation.FatherName, "", "", "",
apiRespons.IdentificationInformation.ShenasnameSeri,
apiRespons.IdentificationInformation.ShenasnameSerial, apiRespons.BasicInformation.GenderEnum,
dateOfBirthGr);
await _contractingPartyTempRepository.CreateAsync(createTemp);
await _contractingPartyTempRepository.SaveChangesAsync();
var result = new ContractingPartyTempViewModel();
result.Id = createTemp.id;
result.FName = createTemp.FName;
result.LName = createTemp.LName;
result.DateOfBirthFa = dateOfBirth;
result.FatherName = createTemp.FatherName;
result.IdNumberSerial = createTemp.IdNumberSerial;
result.IdNumber = idNumber;
return op.Succcedded(result);
}
}
@@ -548,7 +629,6 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
result.SumOfWorkshopsPayment = roundAmount2.ToMoney();
var installmentstart = (DateTime.Now).ToFarsi();
var originalDay = int.Parse(installmentstart.Substring(8, 2));
result.ContractStartFa = installmentstart;
result.ContractStartGr = result.ContractStartFa.ToGeorgianDateTime();
@@ -561,7 +641,6 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
{
var tenPercent = sumOfWorkshopsPaymentDouble * 10 / 100;
//مالیات
result.ValueAddedTaxStr = tenPercent.ToMoney();
//پرداخت یکجا
#region OneTimePaymentResult
@@ -571,11 +650,14 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
//مبلغ بدون مالیات و با تخفیف
result.OneTimeWithoutTaxPaymentStr = discountOneTimePeyment.ToMoney();
var oneTimeValueAddedTax = (discountOneTimePeyment * 10) / 100;
result.OneTimeValueAddedTaxStr = oneTimeValueAddedTax.ToMoney();
//مبلغ با مالیات
var oneTimePayment = discountOneTimePeyment + tenPercent;
var oneTimePayment = discountOneTimePeyment + oneTimeValueAddedTax;
result.OneTimeTotalPaymentStr = oneTimePayment.ToMoney();
result.DiscountedAmountForOneMonth = roundAmount2.ToMoney();
#endregion
@@ -589,65 +671,11 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
result.MonthlyWithoutTaxPaymentStr = sumOfWorkshopsPaymentDouble.ToMoney();
// مبلغ با مالیات
result.MonthlyValueAddedTaxStr= tenPercent.ToMoney();
var monthlyTotalPaymentDouble = sumOfWorkshopsPaymentDouble + tenPercent;
result.MonthlyTotalPaymentStr = monthlyTotalPaymentDouble.ToMoney();
var installmentList = new List<MonthlyInstallment>();
var installmentList = InstitutionContractRepository.InstitutionMonthlyInstallmentCaculation(duration, monthlyTotalPaymentDouble, installmentstart);
int instalmentCount = (int)duration;
var instalmentAmount = monthlyTotalPaymentDouble / instalmentCount;
int currentInstallmentStartDay = int.Parse(installmentstart.Substring(8, 2));
bool endOfMonth = currentInstallmentStartDay == 31;
// Loop through each installment period
for (int i = 1; i <= instalmentCount; i++)
{
string installmentDate;
// For first installment, use the initial date
if (i == 1)
{
installmentDate = installmentstart;
}
else
{
var currentDay = int.Parse(installmentstart.Substring(8, 2));
var currentMonth = int.Parse(installmentstart.Substring(5, 2));
var currentYear = int.Parse(installmentstart.Substring(0, 4));
// Get next month's date
var nextMonthFa = installmentstart.ToGeorgianDateTime().AddMonthsFa(1, out var nextMonth);
var maxDayInNextMonth = int.Parse(nextMonthFa.FindeEndOfMonth().Substring(8, 2));
// Use original day if possible, otherwise use last day of month
var dayToUse = Math.Min(originalDay, maxDayInNextMonth);
installmentDate = nextMonthFa.Substring(0, 8) + dayToUse.ToString("D2");
// Update installmentstart for next iteration
installmentstart = installmentDate;
}
installmentList.Add(new MonthlyInstallment()
{
InstallmentAmountStr = instalmentAmount.ToMoney(),
InstallmentCounter = i switch
{
1 => "اول",
2 => "دوم",
3 => "سوم",
4 => "چهارم",
5 => "پنجم",
6 => "ششم",
7 => "هفتم",
8 => "هشتم",
9 => "نهم",
10 => "دهم",
11 => "یازدهم",
12 => "دوازدهم",
_ => "دوازدهم",
},
InstalmentDate = installmentDate
});
}
#endregion
result.MonthlyInstallments = installmentList;
@@ -669,7 +697,7 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
result.Discount = oneMonthDiscountAmount.ToMoney();
result.DiscountedAmountForOneMonth = (roundAmount2 - oneMonthDiscountAmount).ToMoney();
var taxDouble = (discountedPayment * 10)/100;
result.ValueAddedTaxStr =taxDouble.ToMoney();
result.OneTimeValueAddedTaxStr =taxDouble.ToMoney();
result.OneTimeWithoutTaxPaymentStr = discountedPayment.ToMoney();
result.OneTimeTotalPaymentStr =( discountedPayment + taxDouble).ToMoney();
}
@@ -679,6 +707,8 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
return result;
}
/// <summary>
/// ایجاد یا ویرایش قرارداد موقت
/// </summary>
@@ -893,7 +923,7 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
temp.NationalCode, temp.IdNumber, "*", "*",
"حقیقی",
temp.Phone, null, temp.Address, 1, "-", lastArchiveCode,
temp.State, temp.City, null, null);
temp.State, temp.City, null, null, null, null);
_personalContractingPartyRepository.Create(personalContractingParty);
_personalContractingPartyRepository.SaveChanges();

View File

@@ -946,13 +946,12 @@ public class WorkshopAppliction : IWorkshopApplication
bool createPlanValidations = false;
var operation = new OperationResult();
var transaction = await _workshopRepository.BeginTransactionAsync();
var contractWorkshopDetail =
await _institutionContractRepository.GetInstitutionWorkshopDetails(command
.InstitutionContractWorkshopDetailId);
if (contractWorkshopDetail == null)
var contractWorkshopInitial =
await _institutionContractRepository.GetInstitutionWorkshopInitialDetails(command.InstitutionContractWorkshopInitialId);
if (contractWorkshopInitial == null)
return operation.Failed("جزئیات قرارداد موسسه یافت نشد");
var employerIds = contractWorkshopDetail.Employers.Select(x => x.EmployerId).ToList();
var employerIds = contractWorkshopInitial.Employers.Select(x => x.EmployerId).ToList();
if (employerIds.Count == 0)
return operation.Failed("لطفا کارفرما را انتخاب نمایید");
@@ -1048,8 +1047,8 @@ public class WorkshopAppliction : IWorkshopApplication
var account = new AccountViewModel();
var institutionContract =
await _institutionContractRepository.GetIncludeWorkshopDetailsAsync(contractWorkshopDetail
.InstitutionContractId);
await _institutionContractRepository.GetIncludeWorkshopDetailsAsync(contractWorkshopInitial
.WorkshopGroup.InstitutionContractId);
if (institutionContract == null)
{
return operation.Failed("قرارداد مالی موسسه یافت نشد");
@@ -1071,10 +1070,10 @@ public class WorkshopAppliction : IWorkshopApplication
command.ArchiveCode, command.AgentName, command.AgentPhone, command.Province, command.City,
command.Address,
command.TypeOfInsuranceSend, command.TypeOfContract, command.ContractTerm, command.AgreementNumber
, command.FixedSalary, command.Population, command.InsuranceJobId, null, false,
command.AddYearsPay, command.AddLeavePay, command.TotalPaymentHide, false,
, command.FixedSalary, command.Population, command.InsuranceJobId, null, true,
true, true, command.TotalPaymentHide, false,
command.ComputeOptions,
command.BonusesOptions, command.YearsOptions, command.HasRollCallFreeVip, command.OpenInHolidays,
command.BonusesOptions, command.YearsOptions, command.HasRollCallFreeVip, command.WorkingInHoliday,
command.InsuranceCheckoutOvertime, command.InsuranceCheckoutFamilyAllowance, command.CreateContract,
command.SignContract,
command.CreateCheckout, command.SignCheckout, command.CutContractEndOfYear, command.RotatingShiftCompute,
@@ -1098,7 +1097,7 @@ public class WorkshopAppliction : IWorkshopApplication
_rollCallServiceApplication.Create(commandSave);
}
contractWorkshopDetail.SetWorkshopId(workshop.id);
contractWorkshopInitial.SetWorkshopId(workshop.id);
await _workshopRepository.SaveChangesAsync();
foreach (var e in employerIds)
@@ -1112,7 +1111,8 @@ public class WorkshopAppliction : IWorkshopApplication
accountIds.Add(command.SeniorInsuranceAccountId);
accountIds.Add(command.JuniorInsuranceAccountId);
var op = _workshopRepository.CreateAccountLeftWorkAndWorkshopAccounts(accountIds.Distinct().ToList(),
var op = _workshopRepository
.CreateAccountLeftWorkAndWorkshopAccounts(accountIds.Distinct().ToList(),
workshop.id);
_institutionContractRepository.UpdateStatusIfNeeded(institutionContract.id);

Some files were not shown because too many files have changed in this diff Show More