Compare commits

...

13 Commits

Author SHA1 Message Date
mmrbnjd
089722131b ... 2025-10-18 20:25:59 +03:30
mmrbnjd
93dcaa65f0 ... 2025-10-18 18:04:58 +03:30
mmrbnjd
bca445db1a اولین کامیت سرور جدید 2025-10-10 20:39:52 +03:30
mmrbnjd
4df6c87012 docker 2025-10-03 23:30:01 +03:30
mmrbnjd
ef2cf5ff30 ... 2025-01-25 23:46:57 +03:30
mmrbnjd
f2dd0bd837 createdf 2025-01-25 20:46:47 +03:30
mmrbnjd
b57839a212 ... 2025-01-25 12:57:07 +03:30
mmrbnjd
48072d6e00 ... 2025-01-24 19:18:17 +03:30
mmrbnjd
505adf6ab2 ... 2025-01-23 02:44:11 +03:30
mmrbnjd
e40192c428 ... 2025-01-22 13:55:20 +03:30
mmrbnjd
88d4b63394 ... 2025-01-22 13:02:53 +03:30
mmrbnjd
83d7514581 ... 2025-01-21 19:40:24 +03:30
mmrbnjd
b896c9aced ... 2025-01-21 19:40:15 +03:30
78 changed files with 8473 additions and 788 deletions

30
.dockerignore Normal file
View File

@@ -0,0 +1,30 @@
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/bin
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md
!**/.gitignore
!.git/HEAD
!.git/config
!.git/packed-refs
!.git/refs/heads/**

View File

@@ -0,0 +1,5 @@
{
"version": 1,
"isRoot": true,
"tools": {}
}

View File

@@ -4,12 +4,15 @@
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>3a1884b0-3dfb-48c8-8b55-fac6d02b8d35</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Blazor.PersianDatePicker" Version="2.1.0" />
<PackageReference Include="Melipayamak.RestClient" Version="1.0.0" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.2.0" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.21.0" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.5" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
<PackageReference Include="FluentValidation" Version="11.9.0" />
@@ -25,7 +28,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="System.Drawing.Common" Version="9.0.0" />
<PackageReference Include="TaxCollectData.Library" Version="0.0.23" />
</ItemGroup>
<ItemGroup>
@@ -36,10 +39,4 @@
<ProjectReference Include="..\Shared\Shared.csproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="Service">
<HintPath>C:\Dlls\Service.dll</HintPath>
</Reference>
</ItemGroup>
</Project>

View File

@@ -95,6 +95,21 @@ namespace Back.Common
return new PagingDto<T>(rowCount, PageCount, await values.Skip(skip).Take(take).ToListAsync());
}
}
public static async Task<PagingDto<T>> Paging<T>(this IEnumerable<T> values, int pageId, int take)
{
if (/*values.Count()<1000 && */pageId == 0 && take == 0)
{
return new PagingDto<T>(values.Count(), 1, values.ToList());
}
else
{
int skip = (pageId - 1) * take;
int rowCount = values.Count();
int PageCount = rowCount % take == 0 ? rowCount / take : rowCount / take + 1;
return new PagingDto<T>(rowCount, PageCount, values.Skip(skip).Take(take).ToList());
}
}
public static System.Linq.Expressions.Expression<Func<TEntity, bool>> GetFunc<TEntity>(string Fild, string Value)
{

View File

@@ -52,6 +52,17 @@ namespace Back.Controllers
});
}
[HttpGet("GetVra/{ID}")]
public async Task<ActionResult<decimal>> GetVra(int ID)
{
var claim = HttpContext.User.Claims.First(c => c.Type == "UserID");
var UserID = claim.Value;
var user = await _servUser.GetUserByUserID(Convert.ToInt32(UserID));
var cod = await _servCOD.GetCodByCodID(ID, user.RolUsers.First().CompanyID);
if(cod!=null)
return Ok(cod.TaxRate);
return NotFound();
}
[HttpGet("GetAllForidName")]
public async Task<ActionResult<List<CODIdName<int>>>> GetAllForidName()
{

View File

@@ -4,7 +4,6 @@ using Back.Services;
using Back.Validations;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Service;
using Shared.DTOs;
using System.Net;
using System.Reflection.Emit;

View File

@@ -31,7 +31,7 @@ namespace Back.Controllers
private readonly WarehouseService _warehouseService;
private readonly ReceiptService _receiptService;
public InvoiceController(IConfiguration configuration, servInvoice servInvoice, servUser servUser, AddOrUpdateInvoiceValidation validationInvoice, servTaxPayer servTaxPayer, servReport servReport, IAsyncRepository<rptQueue> rptQueueRepository, RemittanceService remittanceService, WarehouseService warehouseService)
public InvoiceController(IConfiguration configuration, servInvoice servInvoice, servUser servUser, AddOrUpdateInvoiceValidation validationInvoice, servTaxPayer servTaxPayer, servReport servReport, IAsyncRepository<rptQueue> rptQueueRepository, RemittanceService remittanceService, WarehouseService warehouseService, ReceiptService receiptService)
{
_configuration = configuration;
_servInvoice = servInvoice;
@@ -42,6 +42,7 @@ namespace Back.Controllers
_rptQueueRepository = rptQueueRepository;
_remittanceService = remittanceService;
_warehouseService = warehouseService;
_receiptService = receiptService;
}
[HttpPost("GetAll")]
@@ -233,7 +234,32 @@ namespace Back.Controllers
//{
// return BadRequest(new List<string> { $"صورتحساب در حالت {invoice.invoiceType.GetEnumDisplayName()} نمی تواند ویرایش شود" });
//}
//if (invoice.invoiceType!=InvoiceType.Cancellation)
//{
//bool InvoiceHasaRemittanceBillReference = invoice.BillReference.HasValue && await _remittanceService.HasaRemittance(invoice.BillReference.Value);
await _receiptService.DeleteByInvoiceID(invoice.ID, user.RolUsers.First().CompanyID);
await _remittanceService.DeleteByInvoiceID(invoice.ID,user.RolUsers.First().CompanyID);
//foreach (var item in invoice.invoiceDetails)
//{
// if (await _remittanceService.HasaRemittance(invoice.ID, item.CODID))
// {
// await _receiptService.ADD(new Shared.DTOs.Warehouse.ReceiptDto()
// {
// CODID = item.CODID,
// Count = item.am.GetValueOrDefault(),
// Date = DateTime.Now.ConvertMiladiToShamsi(),
// ForSale = true,
// InvoiceID = item.InvoiceID,
// Type = TypeReceipt.Shopping,
// info = $"حذف صورتحساب {item.InvoiceID}",
// }, user.RolUsers.First().CompanyID, true);
// }
//}
// }
invoice.LastChangeUserID = Convert.ToInt32(UserID);
//----Update and sendResult
return Ok(await _servInvoice.DeleteInvoice(invoice));
@@ -359,7 +385,29 @@ namespace Back.Controllers
foreach (var item in Invoice.invoiceDetails)
{
if (await _remittanceService.HasaRemittance(Invoice.ID, item.CODID))
await _remittanceService.ChangeRemittance(Invoice.ID, item.CODID, result);
{
await _remittanceService.DeleteByCODIDAndInvoiceID(Invoice.ID,item.CODID, user.RolUsers.First().CompanyID);
//await _receiptService.ADD(new Shared.DTOs.Warehouse.ReceiptDto()
//{
// CODID = item.CODID,
// Count = item.am.GetValueOrDefault(),
// Date = DateTime.Now.ConvertMiladiToShamsi(),
// ForSale = true,
// InvoiceID = item.InvoiceID,
// Type = TypeReceipt.Shopping,
// info = $"رسید خودکار: صورتحساب {item.InvoiceID} از {Invoice.invoiceType.GetEnumDisplayName()} به {((InvoiceType)invoiceType).GetEnumDisplayName()}",
//}, user.RolUsers.First().CompanyID, true);
await _remittanceService.ADD(new Shared.DTOs.Warehouse.RemittanceDto()
{
CODID = item.CODID,
Count = item.am.GetValueOrDefault(),
Date = DateTime.Now.ConvertMiladiToShamsi(),
InvoiceID = result,
Type = TypeRemittance.Sale,
info = $"حواله خودکار: از صورتحساب {result}"
});
}
}
return Ok(await _servInvoice.GetInvoice(user.RolUsers.First().CompanyID, result));
}
@@ -434,7 +482,29 @@ namespace Back.Controllers
foreach (var item in Invoice.invoiceDetails)
{
if (await _remittanceService.HasaRemittance(Invoice.ID, item.CODID))
await _remittanceService.ChangeRemittance(Invoice.ID, item.CODID, result1);
{
await _remittanceService.DeleteByCODIDAndInvoiceID(Invoice.ID, item.CODID, user.RolUsers.First().CompanyID);
//await _receiptService.ADD(new Shared.DTOs.Warehouse.ReceiptDto()
//{
// CODID = item.CODID,
// Count = item.am.GetValueOrDefault(),
// Date = DateTime.Now.ConvertMiladiToShamsi(),
// ForSale = true,
// InvoiceID = item.InvoiceID,
// Type = TypeReceipt.Shopping,
// info = $"رسید خودکار: صورتحساب {item.InvoiceID} از {Invoice.invoiceType.GetEnumDisplayName()} به {((InvoiceType)invoiceType).GetEnumDisplayName()}",
//}, user.RolUsers.First().CompanyID, true);
await _remittanceService.ADD(new Shared.DTOs.Warehouse.RemittanceDto()
{
CODID = item.CODID,
Count = item.am.GetValueOrDefault(),
Date = DateTime.Now.ConvertMiladiToShamsi(),
InvoiceID = result1,
Type = TypeRemittance.Sale,
info = $"حواله خودکار: از صورتحساب {result1}"
});
}
}
return Ok(await _servInvoice.GetInvoice(user.RolUsers.First().CompanyID, result1));
}
@@ -537,7 +607,29 @@ namespace Back.Controllers
foreach (var item in Invoice.invoiceDetails)
{
if (await _remittanceService.HasaRemittance(Invoice.ID, item.CODID))
await _remittanceService.ChangeRemittance(Invoice.ID, item.CODID, result2);
{
await _remittanceService.DeleteByCODIDAndInvoiceID(Invoice.ID, item.CODID, user.RolUsers.First().CompanyID);
//await _receiptService.ADD(new Shared.DTOs.Warehouse.ReceiptDto()
//{
// CODID = item.CODID,
// Count = item.am.GetValueOrDefault(),
// Date = DateTime.Now.ConvertMiladiToShamsi(),
// ForSale = true,
// InvoiceID = item.InvoiceID,
// Type = TypeReceipt.Shopping,
// info = $"رسید خودکار: صورتحساب {item.InvoiceID} از {Invoice.invoiceType.GetEnumDisplayName()} به {((InvoiceType)invoiceType).GetEnumDisplayName()}",
//}, user.RolUsers.First().CompanyID, true);
await _remittanceService.ADD(new Shared.DTOs.Warehouse.RemittanceDto()
{
CODID = item.CODID,
Count = item.am.GetValueOrDefault(),
Date = DateTime.Now.ConvertMiladiToShamsi(),
InvoiceID = result2,
Type = TypeRemittance.Sale,
info = $"حواله خودکار: از صورتحساب {result2}"
});
}
}
return Ok(await _servInvoice.GetInvoice(user.RolUsers.First().CompanyID, result2));
}
@@ -709,6 +801,11 @@ namespace Back.Controllers
}
else
{
if (_servInvoice.checkFatherInvoiceByInvoiceID(user.RolUsers.First().CompanyID, InvoiceID).Result)
return BadRequest(new List<string> {"این صورتحساب، مرجع چند صورتحساب دیگر می باشد " +'\n'+'\r'+
"نمیتواند برای این صورتحساب حواله صادر کنید، ابتدا صورتحساب هایی که ارتباط دارند را حذف کنید" });
List<string> errors = new List<string>();
var result = await _servInvoice.GetInvoice(user.RolUsers.First().CompanyID, InvoiceID);
if (result.invoiceType == InvoiceType.Bidding || result.invoiceType == InvoiceType.Cancellation)
@@ -720,9 +817,9 @@ namespace Back.Controllers
.GroupBy(i => i.CODID).Select(g => new { CODID = g.Key, TotalAm = g.Sum(i => i.am) }))
{
var Inventory = await _warehouseService.Inventory(CompanyID.Value, item.CODID);
if (Inventory - item.TotalAm <= 0)
if (Inventory - item.TotalAm < 0)
{
errors.Add($"موجودی کالا {item.CODID} کمتر از درخواست شماست");
errors.Add($"موجودی کالا {result.items.First(w => w.CODID == item.CODID).sstt} کمتر از درخواست شماست");
}
}
if (errors.Count == 0)
@@ -737,6 +834,7 @@ namespace Back.Controllers
Type = TypeRemittance.Sale,
InvoiceID = InvoiceID,
Deleted = false,
CreateDt=DateTime.Now
}).ToList());
return Ok();
}
@@ -751,6 +849,28 @@ namespace Back.Controllers
}
[HttpPost("FreeRemittance/{InvoiceID}")]
public async Task<ActionResult> FreeRemittance(int InvoiceID)
{
//-----GetUserAndCompany
var claim = HttpContext.User.Claims.First(c => c.Type == "UserID");
var UserID = claim.Value;
var user = await _servUser.GetUserByUserID(Convert.ToInt32(UserID));
var CompanyID = user?.RolUsers.First().CompanyID;
if (!await _servInvoice.ExistInvoiceByInvoiceID(CompanyID.Value, InvoiceID))
return NotFound();
await _receiptService.DeleteByInvoiceID(InvoiceID, CompanyID.Value);
await _remittanceService.DeleteByInvoiceID(InvoiceID, CompanyID.Value);
return Ok();
//return BadRequest(new List<string>() { $"حواله ای یافت نشد" });
}
[HttpGet("HasaRemittance/{InvoiceID}")]
public async Task<ActionResult> HasaRemittance(int InvoiceID)

View File

@@ -26,15 +26,17 @@ namespace Back.Controllers
private readonly servInvoice _servInvoice;
private readonly RemittanceService _remittanceService;
private readonly WarehouseService _warehouseService;
public InvoiceItemController(servInvoiceItem servInvoiceItem, AUInvoiceItemValidation validationInvoiceItem
, servUser servUser, servInvoice servInvoice)
public InvoiceItemController(servInvoiceItem servInvoiceItem, servUser servUser, AUInvoiceItemValidation validationInvoiceItem, servInvoice servInvoice, RemittanceService remittanceService, WarehouseService warehouseService)
{
_servInvoiceItem = servInvoiceItem;
_validationInvoiceItem = validationInvoiceItem;
_servUser = servUser;
_validationInvoiceItem = validationInvoiceItem;
_servInvoice = servInvoice;
_remittanceService = remittanceService;
_warehouseService = warehouseService;
}
[HttpPost("AddItem")]
public async Task<ActionResult<bool>> AddItem([FromBody] InvoiceItemAction<InvoiceItemDTO> model)
{
@@ -53,6 +55,10 @@ namespace Back.Controllers
if (invoice == null)
return BadRequest(new List<string> { "invoice notFound..." });
if (_servInvoice.checkFatherInvoiceByInvoiceID(user.RolUsers.First().CompanyID, model.invoiceID).Result)
return BadRequest(new List<string> {"این صورتحساب، مرجع چند صورتحساب دیگر می باشد " +'\n'+
"برای تغییر در آیتم ها ابتدا صورتحساب هایی که ارتباط دارند را حذف کنید" });
if (invoice.invoiceType == InvoiceType.Repair)
{
return BadRequest(new List<string> { "امکان افزودن کالا جدید در صورتحساب اصلاحی وجود ندارد" });
@@ -94,6 +100,7 @@ namespace Back.Controllers
return Ok(await _servInvoiceItem.Add(new InvoiceItem
{
vra=model.item.vra,
am = model.item.am,
fee = model.item.fee,
dis = model.item.dis,
@@ -123,7 +130,9 @@ namespace Back.Controllers
if (invoice == null)
return BadRequest(new List<string> { "invoice notFound..." });
if (_servInvoice.checkFatherInvoiceByInvoiceID(user.RolUsers.First().CompanyID, model.invoiceID).Result)
return BadRequest(new List<string> {"این صورتحساب، مرجع چند صورتحساب دیگر می باشد " +'\n'+
"برای تغییر در آیتم ها ابتدا صورتحساب هایی که ارتباط دارند را حذف کنید" });
//-----Validaton
var resultValidationmodel = await _validationInvoiceItem.ValidateAsync(Tuple.Create(user.RolUsers.First().CompanyID, model.invoiceID, model.item, eActionValidation.update));
@@ -178,6 +187,8 @@ namespace Back.Controllers
invoice.LastChangeUserID = Convert.ToInt32(UserID);
var copyInvoice = (InvoiceItem)invoiceitem.Clone();
if (invoice.invoiceType == InvoiceType.BackFrmSale)
invoiceitem.am = model.item.am;
else
@@ -186,18 +197,19 @@ namespace Back.Controllers
invoiceitem.fee = model.item.fee;
invoiceitem.dis = model.item.dis;
invoiceitem.CODID = model.item.CODID;
invoiceitem.vra = model.item.vra;
}
if (await _servInvoice.UpdateInvoice(invoice))
{
if (invoiceitem.am != model.item.am || invoiceitem.CODID != model.item.CODID)
if (copyInvoice.am != model.item.am || copyInvoice.CODID != model.item.CODID)
{
if (await _remittanceService.HasaRemittance(invoiceitem.invoice.ID, invoiceitem.CODID))
if (await _remittanceService.HasaRemittance(model.invoiceID, copyInvoice.CODID))
{
var inv = await _warehouseService.Inventory(user.RolUsers.First().CompanyID, model.item.CODID);
if (inv - model.item.am <= 0)
return BadRequest(new List<string> { "موجودی کالا کمتر از درخواست شماست" });
else await _remittanceService.DeleteByInvoiceIDandCODID(invoiceitem.invoice.ID, invoiceitem.CODID);
if (inv+ copyInvoice.am - model.item.am < 0)
return BadRequest(new List<string> { "خطای انبار :"+"موجودی کالا کمتر از درخواست شماست" });
else await _remittanceService.DeleteByInvoiceIDandCODID(model.invoiceID, copyInvoice.CODID);
// حواله جئدید
await _remittanceService.ADD(new Shared.DTOs.Warehouse.RemittanceDto()
@@ -205,9 +217,9 @@ namespace Back.Controllers
CODID = model.item.CODID,
Count = model.item.am,
Date = DateTime.Now.ConvertMiladiToShamsi(),
info = $"حواله خودکار از صورتحساب {invoiceitem.invoice.ID}",
info = $"حواله خودکار از صورتحساب {model.invoiceID}",
Type = TypeRemittance.Sale,
InvoiceID = invoiceitem.invoice.ID
InvoiceID = model.invoiceID
});
}
@@ -233,6 +245,10 @@ namespace Back.Controllers
if (invoiceitem == null)
return NotFound(new List<string> { "invoice Item notFound..." });
if (_servInvoice.checkFatherInvoiceByInvoiceID(user.RolUsers.First().CompanyID, InvoiceItemID).Result)
return BadRequest(new List<string> {"این صورتحساب، مرجع چند صورتحساب دیگر می باشد " +'\n'+
"برای تغییر در آیتم ها ابتدا صورتحساب هایی که ارتباط دارند را حذف کنید" });
//-----Validaton
var resultValidationmodel = await _validationInvoiceItem.ValidateAsync(Tuple.Create(user.RolUsers.First().CompanyID, invoiceitem.InvoiceID.Value, new InvoiceItemDTO(), eActionValidation.delete));
if (!resultValidationmodel.IsValid)

View File

@@ -6,18 +6,10 @@ using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.HttpResults;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json;
using Org.BouncyCastle.Asn1.Cmp;
using Org.BouncyCastle.Ocsp;
using Org.BouncyCastle.Utilities;
using Shared.DTOs;
using Shared.DTOs.Serch;
using System;
using System.Security.Cryptography;
using TaxCollectData.Library.Dto.Content;
using TaxCollectData.Library.Dto.Transfer;
using static Shared.DTOs._TaxPayer;
using static System.Collections.Specialized.BitVector32;
namespace Back.Controllers
{
@@ -152,326 +144,326 @@ namespace Back.Controllers
[HttpGet("SendInvoice/{InvoiceID}")]
public async Task<ActionResult<bool>> SendInvoice(int InvoiceID)
{
//return BadRequest(new List<string> { "در حال حاضر سامانه مودیان در دسترس نمی باشد" });
return BadRequest(new List<string> { "در حال حاضر سامانه مودیان در دسترس نمی باشد" });
var claim = HttpContext.User.Claims.First(c => c.Type == "UserID");
var UserID = claim.Value;
var user = await _servUser.GetUserByUserID(Convert.ToInt32(UserID));
if (!await _actionTaxPayer.login(user.RolUsers.First().CompanyID))
return BadRequest(new List<string> { "خطا در احراز هویت سازمان مالیاتی" });
//var claim = HttpContext.User.Claims.First(c => c.Type == "UserID");
//var UserID = claim.Value;
//var user = await _servUser.GetUserByUserID(Convert.ToInt32(UserID));
//if (!await _actionTaxPayer.login(user.RolUsers.First().CompanyID))
// return BadRequest(new List<string> { "خطا در احراز هویت سازمان مالیاتی" });
var result = await _servTaxPayer.GetInvoice(user.RolUsers.First().CompanyID, InvoiceID);
if (result == null)
return BadRequest(new List<string> { "صورتحساب یافت نشد" });
//var result = await _servTaxPayer.GetInvoice(user.RolUsers.First().CompanyID, InvoiceID);
//if (result == null)
// return BadRequest(new List<string> { "صورتحساب یافت نشد" });
else
{
if (!result.PatternID.HasValue)
return BadRequest(new List<string> { "ابتدا برای این صورتحساب الگو در نظر بگیرید" });
//else
//{
// if (!result.PatternID.HasValue)
// return BadRequest(new List<string> { "ابتدا برای این صورتحساب الگو در نظر بگیرید" });
if (result.invoiceType == InvoiceType.Bidding)
return BadRequest(new List<string> { "صورتحساب در وضعیت پیش نویس نمیتواند ارسال شود" });
// if (result.invoiceType == InvoiceType.Bidding)
// return BadRequest(new List<string> { "صورتحساب در وضعیت پیش نویس نمیتواند ارسال شود" });
if (await _servTaxPayer.ExistSuccessfulorSendorpendingInvoice(result))
return BadRequest(new List<string> { "این صورتحساب قبلا به سازمان ارسال شده" });
// if (await _servTaxPayer.ExistSuccessfulorSendorpendingInvoice(result))
// return BadRequest(new List<string> { "این صورتحساب قبلا به سازمان ارسال شده" });
if ((result.invoiceType == InvoiceType.BackFrmSale || result.invoiceType == InvoiceType.Repair)
&& !result.BillReference.HasValue)
return BadRequest(new List<string> { "در وضعیت برگشت از فروش و اصلاحی باید صورتحساب مرجع وجود داشته باشد" });
// if ((result.invoiceType == InvoiceType.BackFrmSale || result.invoiceType == InvoiceType.Repair)
// && !result.BillReference.HasValue)
// return BadRequest(new List<string> { "در وضعیت برگشت از فروش و اصلاحی باید صورتحساب مرجع وجود داشته باشد" });
if ((result.invoiceType == InvoiceType.BackFrmSale || result.invoiceType == InvoiceType.Repair)
&& !await _servTaxPayer.ExistSuccessfulorSendorpendingInvoice(result.invoice))
return BadRequest(new List<string> { "در وضعیت برگشت از فروش و اصلاحی باید صورتحساب مرجع به سامانه مودیان ارسال شده باشد" });
// if ((result.invoiceType == InvoiceType.BackFrmSale || result.invoiceType == InvoiceType.Repair)
// && !await _servTaxPayer.ExistSuccessfulorSendorpendingInvoice(result.invoice))
// return BadRequest(new List<string> { "در وضعیت برگشت از فروش و اصلاحی باید صورتحساب مرجع به سامانه مودیان ارسال شده باشد" });
if (result.invoiceType == InvoiceType.Cancellation && string.IsNullOrEmpty(result.taxid))
{
return BadRequest(new List<string> { "صورتحساب در وضعیت ابطالی باید صورتحساب مرجع آن به سامانه مودیان ارسال شده باشد" });
// if (result.invoiceType == InvoiceType.Cancellation && string.IsNullOrEmpty(result.taxid))
// {
// return BadRequest(new List<string> { "صورتحساب در وضعیت ابطالی باید صورتحساب مرجع آن به سامانه مودیان ارسال شده باشد" });
}
#region Inital Send
InvoiceHeaderDto header = new InvoiceHeaderDto();
PreparationHeaderTaxInvoice preparation = new PreparationHeaderTaxInvoice(result, _actionTaxPayer);
// }
// #region Inital Send
// InvoiceHeaderDto header = new InvoiceHeaderDto();
// PreparationHeaderTaxInvoice preparation = new PreparationHeaderTaxInvoice(result, _actionTaxPayer);
int level = result.pattern.ID;
// int level = result.pattern.ID;
//header
#region header
header = new InvoiceHeaderDto
{
//شماره منحصر به فرد مالیاتی
Taxid = preparation.Taxid,
//زمان صدور
Indatim = preparation.Indatim,
//زمان ایجاد
Indati2m = preparation.Indati2m,
// صورتحساب نوع *
Inty = preparation.Inty,
//سریال صورت حساب
Inno = preparation.Inno,
//شماره منحصر به فرد مالیاتی صورتحساب مرجع
Irtaxid = preparation.Irtaxid,
//الگوی صورتحساب *
Inp = preparation.Inp,
//موضوع صورتحساب *
Ins = preparation.Ins,
//شماره اقتصادی فروشنده به جاش شناسه ملی داده شد
Tins = preparation.Tins,
//نوع شخص خریدار
Tob = preparation.Tob,
//شماره/شناسه ملی/شناسه مشارکت مدنی / کد فراگیر
Bid = preparation.Bid,
//شماره اقتصادی خریدار
Tinb = preparation.Tinb,
//کد شعبه فروشنده
Sbc = preparation.Sbc,
//کد پستی خریدار
Bpc = preparation.Bpc,
//کد شعبه خریدار
Bbc = preparation.Bbc,
//نوع پرواز
Ft = preparation.Ft,
//شماره گذرنامه خریدار
Bpn = preparation.Bpn,
//شماره پروانه گمرکی
Scln = preparation.Scln,
//کد گمرک محل اظهار فروشنده
Scc = preparation.Scc,
//شماره کدتاژ اظهارنامه گمرکی
Cdcn = preparation.Cdcn,
//تاریخ کوتاژ اظهارنامه گمرکی
Cdcd = preparation.Cdcd,
//شناسه یکتای ثبت قزارداد فروشنده
Crn = preparation.Crn,
//شماره اشتراک/شناسه قبض بهره بردار
Billid = preparation.Billid,
//مجموع مبلغ قبل از کسر تخفیف
Tprdis = preparation.Tprdis,
//مجموع تخفیفات
Tdis = preparation.Tdis,
// مجموع مبلغ پس از کسر تخفیف
Tadis = preparation.Tadis,
//مجموع مالیات بر ارزش افزوده
Tvam = preparation.Tvam,
// مجموع سایر مالیات، عوارض و وجوه قانونی
Todam = preparation.Todam,
//صورتحساب مجموع
Tbill = preparation.Tbill,
//مجموع وزن خالض
Tonw = preparation.Tonw,
//مجموع ارزش ریالی
Torv = preparation.Torv,
//مجموع ارزش ارزی
Tocv = preparation.Tocv,
// تسویه روش
Setm = preparation.Setm,
//نقدی پرداختی مبلغ
Cap = preparation.Cap,
//پرداختی نسیه
Insp = preparation.Insp,
//مجموع سهم مالیات بر ارزش افزوده از پرداخت
Tvop = preparation.Tvop,
//مالیات موضوع 17
Tax17 = preparation.Tax17,
//شماره اقتصادی آژانس
Tinc = preparation.Tinc,
//تاریخ اعلامیه فروش
Asd=null,
//شماره اعلامیه فروش
Asn = null,
//شماره ناوگان
Cno=null,
//شهر مقصد
Dci = null,
//کشور مقصد
Dco = null,
//کد ملی/ کد فراگیر اتباع غیر ایرانی راننده) در حمل و نقل جاده ای(
Did = null,
//شماره بارنامه
Lno = null,
//شماره بارنامه مرجع
Lrno = null,
//نوع بارنامه/ نوع حمل
Lt = null,
//شهر مبدا
Oci = null,
//کشور مبدا
Ocu = null,
//شناسه ملی/ شماره ملی/ شناسه مشارکت مدنی/ کد فراگیر اتباع غیر ایرانی گیرنده
Rid = null,
//کالاهای حمل شده
Sg = new List<ShippingGoodDto>(),
//شناسه ملی/ شماره ملی/ شناسه مشارکت مدنی / کد فراگیر اتباع غیر ایرانی فرستنده
Tid =null
// //header
// #region header
// header = new InvoiceHeaderDto
// {
// //شماره منحصر به فرد مالیاتی
// Taxid = preparation.Taxid,
// //زمان صدور
// Indatim = preparation.Indatim,
// //زمان ایجاد
// Indati2m = preparation.Indati2m,
// // صورتحساب نوع *
// Inty = preparation.Inty,
// //سریال صورت حساب
// Inno = preparation.Inno,
// //شماره منحصر به فرد مالیاتی صورتحساب مرجع
// Irtaxid = preparation.Irtaxid,
// //الگوی صورتحساب *
// Inp = preparation.Inp,
// //موضوع صورتحساب *
// Ins = preparation.Ins,
// //شماره اقتصادی فروشنده به جاش شناسه ملی داده شد
// Tins = preparation.Tins,
// //نوع شخص خریدار
// Tob = preparation.Tob,
// //شماره/شناسه ملی/شناسه مشارکت مدنی / کد فراگیر
// Bid = preparation.Bid,
// //شماره اقتصادی خریدار
// Tinb = preparation.Tinb,
// //کد شعبه فروشنده
// Sbc = preparation.Sbc,
// //کد پستی خریدار
// Bpc = preparation.Bpc,
// //کد شعبه خریدار
// Bbc = preparation.Bbc,
// //نوع پرواز
// Ft = preparation.Ft,
// //شماره گذرنامه خریدار
// Bpn = preparation.Bpn,
// //شماره پروانه گمرکی
// Scln = preparation.Scln,
// //کد گمرک محل اظهار فروشنده
// Scc = preparation.Scc,
// //شماره کدتاژ اظهارنامه گمرکی
// Cdcn = preparation.Cdcn,
// //تاریخ کوتاژ اظهارنامه گمرکی
// Cdcd = preparation.Cdcd,
// //شناسه یکتای ثبت قزارداد فروشنده
// Crn = preparation.Crn,
// //شماره اشتراک/شناسه قبض بهره بردار
// Billid = preparation.Billid,
// //مجموع مبلغ قبل از کسر تخفیف
// Tprdis = preparation.Tprdis,
// //مجموع تخفیفات
// Tdis = preparation.Tdis,
// // مجموع مبلغ پس از کسر تخفیف
// Tadis = preparation.Tadis,
// //مجموع مالیات بر ارزش افزوده
// Tvam = preparation.Tvam,
// // مجموع سایر مالیات، عوارض و وجوه قانونی
// Todam = preparation.Todam,
// //صورتحساب مجموع
// Tbill = preparation.Tbill,
// //مجموع وزن خالض
// Tonw = preparation.Tonw,
// //مجموع ارزش ریالی
// Torv = preparation.Torv,
// //مجموع ارزش ارزی
// Tocv = preparation.Tocv,
// // تسویه روش
// Setm = preparation.Setm,
// //نقدی پرداختی مبلغ
// Cap = preparation.Cap,
// //پرداختی نسیه
// Insp = preparation.Insp,
// //مجموع سهم مالیات بر ارزش افزوده از پرداخت
// Tvop = preparation.Tvop,
// //مالیات موضوع 17
// Tax17 = preparation.Tax17,
// //شماره اقتصادی آژانس
// Tinc = preparation.Tinc,
// //تاریخ اعلامیه فروش
// Asd=null,
// //شماره اعلامیه فروش
// Asn = null,
// //شماره ناوگان
// Cno=null,
// //شهر مقصد
// Dci = null,
// //کشور مقصد
// Dco = null,
// //کد ملی/ کد فراگیر اتباع غیر ایرانی راننده) در حمل و نقل جاده ای(
// Did = null,
// //شماره بارنامه
// Lno = null,
// //شماره بارنامه مرجع
// Lrno = null,
// //نوع بارنامه/ نوع حمل
// Lt = null,
// //شهر مبدا
// Oci = null,
// //کشور مبدا
// Ocu = null,
// //شناسه ملی/ شماره ملی/ شناسه مشارکت مدنی/ کد فراگیر اتباع غیر ایرانی گیرنده
// Rid = null,
// //کالاهای حمل شده
// Sg = new List<ShippingGoodDto>(),
// //شناسه ملی/ شماره ملی/ شناسه مشارکت مدنی / کد فراگیر اتباع غیر ایرانی فرستنده
// Tid =null
};
#endregion header
// };
// #endregion header
//body
List<InvoiceBodyDto> InvoiceBody = new List<InvoiceBodyDto>();
foreach (var bitem in result.invoiceDetails)
{
InvoiceBodyDto item = new InvoiceBodyDto();
PreparationBodyTaxInvoice preparationBody = new PreparationBodyTaxInvoice(bitem, level);
#region body
// //body
// List<InvoiceBodyDto> InvoiceBody = new List<InvoiceBodyDto>();
// foreach (var bitem in result.invoiceDetails)
// {
// InvoiceBodyDto item = new InvoiceBodyDto();
// PreparationBodyTaxInvoice preparationBody = new PreparationBodyTaxInvoice(bitem, level);
// #region body
item = new InvoiceBodyDto
{
//شناسه کالا / خدمت
Sstid = preparationBody.Sstid,
//شرح کاال/خدمت
Sstt = preparationBody.Sstt,
// تعداد
Am = preparationBody.Am,
//واحد اندازه گیری
Mu = preparationBody.Mu,
//وزن خالص
Nw= preparationBody.Nw,
// مبلغ واحد
Fee = preparationBody.Fee,
//میزان ارز
Cfee = preparationBody.Cfee ,
//نوع ارز
Cut = preparationBody.Cut,
//نرخ برابری ارز با ریال
Exr = preparationBody.Exr,
// ارزش ریالی کاا
Ssrv= preparationBody.Ssrv,
// ارزش ارزی کاا
Sscv= preparationBody.Sscv,
//مبلغ قبل از تخفیف
Prdis = preparationBody.Prdis,
//مبلغ تخفیف
Dis = preparationBody.Dis,
//مبلغ بعد از تخفیف
Adis = preparationBody.Adis,
//نرخ مالیات بر ارزش افزوده
Vra = preparationBody.Vra,
//مبلغ مالیات بر ارزش افزوده
Vam = preparationBody.Vam,
//موضوع سایر مالیات و عوارض
Odt = preparationBody.Odt,
//نرخ سایر مالیات و عوارض
Odr = preparationBody.Odr,
//مبلغ سایر مالیات و عوارض
Odam = preparationBody.Odam,
//موضوع سایر وجوه قانونی
Olt = preparationBody.Olt,
//نرخ سایر وجوه قانونی
Olr = preparationBody.Olr,
//مبلغ سایر وجوه قانونی
Olam = preparationBody.Olam,
//اجرت ساخت
Consfee = preparationBody.Consfee,
// سود فروشنده
Spro= preparationBody.Spro,
//حقالعمل
Bros= preparationBody.Bros,
//جمع کل اجرت، حقالعمل و سود
Tcpbs= preparationBody.Tcpbs,
//سهم نقدی از پرداخت
Cop = preparationBody.Cop,
//سهم مالیات بر لرزش افزوده از پرداخت
Vop = preparationBody.Vop,
//شناسه یکتای ثبت قرارداد حق العمل کاری
Bsrn = preparationBody.Bsrn,
// مبلغ کل کالا / خدمت
Tsstam = preparationBody.Tsstam,
//عیار
Cui = preparationBody.Cui,
// نرخ خرید ارز
Cpr = preparationBody.Cpr,
//ماخذ مالیات بر ارزش افزوده در الگوی فروش ارز
Sovat = preparationBody.Sovat
};
#endregion
InvoiceBody.Add(item);
}
// item = new InvoiceBodyDto
// {
// //شناسه کالا / خدمت
// Sstid = preparationBody.Sstid,
// //شرح کاال/خدمت
// Sstt = preparationBody.Sstt,
// // تعداد
// Am = preparationBody.Am,
// //واحد اندازه گیری
// Mu = preparationBody.Mu,
// //وزن خالص
// Nw= preparationBody.Nw,
// // مبلغ واحد
// Fee = preparationBody.Fee,
// //میزان ارز
// Cfee = preparationBody.Cfee ,
// //نوع ارز
// Cut = preparationBody.Cut,
// //نرخ برابری ارز با ریال
// Exr = preparationBody.Exr,
// // ارزش ریالی کاا
// Ssrv= preparationBody.Ssrv,
// // ارزش ارزی کاا
// Sscv= preparationBody.Sscv,
// //مبلغ قبل از تخفیف
// Prdis = preparationBody.Prdis,
// //مبلغ تخفیف
// Dis = preparationBody.Dis,
// //مبلغ بعد از تخفیف
// Adis = preparationBody.Adis,
// //نرخ مالیات بر ارزش افزوده
// Vra = preparationBody.Vra,
// //مبلغ مالیات بر ارزش افزوده
// Vam = preparationBody.Vam,
// //موضوع سایر مالیات و عوارض
// Odt = preparationBody.Odt,
// //نرخ سایر مالیات و عوارض
// Odr = preparationBody.Odr,
// //مبلغ سایر مالیات و عوارض
// Odam = preparationBody.Odam,
// //موضوع سایر وجوه قانونی
// Olt = preparationBody.Olt,
// //نرخ سایر وجوه قانونی
// Olr = preparationBody.Olr,
// //مبلغ سایر وجوه قانونی
// Olam = preparationBody.Olam,
// //اجرت ساخت
// Consfee = preparationBody.Consfee,
// // سود فروشنده
// Spro= preparationBody.Spro,
// //حقالعمل
// Bros= preparationBody.Bros,
// //جمع کل اجرت، حقالعمل و سود
// Tcpbs= preparationBody.Tcpbs,
// //سهم نقدی از پرداخت
// Cop = preparationBody.Cop,
// //سهم مالیات بر لرزش افزوده از پرداخت
// Vop = preparationBody.Vop,
// //شناسه یکتای ثبت قرارداد حق العمل کاری
// Bsrn = preparationBody.Bsrn,
// // مبلغ کل کالا / خدمت
// Tsstam = preparationBody.Tsstam,
// //عیار
// Cui = preparationBody.Cui,
// // نرخ خرید ارز
// Cpr = preparationBody.Cpr,
// //ماخذ مالیات بر ارزش افزوده در الگوی فروش ارز
// Sovat = preparationBody.Sovat
// };
// #endregion
// InvoiceBody.Add(item);
// }
//Pay
List<PaymentDto> InvoicePay = new List<PaymentDto>();
if (result.setm==1 || result.setm == 3)
{
if (level != 10)
foreach (var pitem in result.payments)
{
// //Pay
// List<PaymentDto> InvoicePay = new List<PaymentDto>();
// if (result.setm==1 || result.setm == 3)
// {
// if (level != 10)
// foreach (var pitem in result.payments)
// {
PaymentDto payment = new PaymentDto();
payment = new PaymentDto
{
Iinn = pitem.iinn,
Acn = pitem.acn,
Trmn = pitem.trmn,
Pmt = pitem.pmt,
Trn = pitem.trn,
Pcn = pitem.pcn,
Pid = pitem.pid,
Pdt = pitem.pdt,
Pv = pitem.pv,
// PaymentDto payment = new PaymentDto();
// payment = new PaymentDto
// {
// Iinn = pitem.iinn,
// Acn = pitem.acn,
// Trmn = pitem.trmn,
// Pmt = pitem.pmt,
// Trn = pitem.trn,
// Pcn = pitem.pcn,
// Pid = pitem.pid,
// Pdt = pitem.pdt,
// Pv = pitem.pv,
};
// };
InvoicePay.Add(payment);
}
}
// InvoicePay.Add(payment);
// }
// }
var responseModel = await _actionTaxPayer.SendInvoice(user.RolUsers.First().CompanyID, header, InvoiceBody, InvoicePay);
if (responseModel == null)
{
return BadRequest(new List<string> { "خطا در ورود به سامانه مودیان" });
}
else if (responseModel.Status == 200 && (responseModel.Body.Errors == null || responseModel.Body.Errors.Count == 0))
{
foreach (var item in responseModel.Body.Result)
{
// var responseModel = await _actionTaxPayer.SendInvoice(user.RolUsers.First().CompanyID, header, InvoiceBody, InvoicePay);
// if (responseModel == null)
// {
// return BadRequest(new List<string> { "خطا در ورود به سامانه مودیان" });
// }
// else if (responseModel.Status == 200 && (responseModel.Body.Errors == null || responseModel.Body.Errors.Count == 0))
// {
// foreach (var item in responseModel.Body.Result)
// {
var ressenttax = new SentTax
{
InvoiceID = result.ID,
Date = DateTime.Now.ConvertMiladiToShamsi(),
Time = $"{DateTime.Now.Hour}:{DateTime.Now.Minute}:{DateTime.Now.Second}",
InvoiceType = result.invoiceType,
ReferenceNumber = item.ReferenceNumber,
uId = item.Uid,
SentStatus = SentStatus.Send,
InvoiceModel = JsonConvert.SerializeObject(result, Formatting.Indented, new JsonSerializerSettings
{
PreserveReferencesHandling = PreserveReferencesHandling.Objects
}),
ResponseModel = JsonConvert.SerializeObject(responseModel)
// var ressenttax = new SentTax
// {
// InvoiceID = result.ID,
// Date = DateTime.Now.ConvertMiladiToShamsi(),
// Time = $"{DateTime.Now.Hour}:{DateTime.Now.Minute}:{DateTime.Now.Second}",
// InvoiceType = result.invoiceType,
// ReferenceNumber = item.ReferenceNumber,
// uId = item.Uid,
// SentStatus = SentStatus.Send,
// InvoiceModel = JsonConvert.SerializeObject(result, Formatting.Indented, new JsonSerializerSettings
// {
// PreserveReferencesHandling = PreserveReferencesHandling.Objects
// }),
// ResponseModel = JsonConvert.SerializeObject(responseModel)
};
await _servTaxPayer.AddSentTax(ressenttax);
}
result.taxid = header.Taxid;
result.irtaxid = header.Irtaxid;
return Ok(await _servTaxPayer.UpdateInvoice(result));
}
else
{
string errors = "";
foreach (var item in responseModel.Body.Errors)
errors += '\n' + $"{item.ErrorCode}:{item.Detail}";
// };
// await _servTaxPayer.AddSentTax(ressenttax);
// }
// result.taxid = header.Taxid;
// result.irtaxid = header.Irtaxid;
// return Ok(await _servTaxPayer.UpdateInvoice(result));
// }
// else
// {
// string errors = "";
// foreach (var item in responseModel.Body.Errors)
// errors += '\n' + $"{item.ErrorCode}:{item.Detail}";
return BadRequest(new List<string> { errors });
}
// return BadRequest(new List<string> { errors });
// }
#endregion
// #endregion
}
//}
}
[HttpPost("GetAllSentTax")]
public async Task<ActionResult<PagingDto<SentTaxDto>>> GetSentTax([FromBody] ItemSerchGetSentTax item)
@@ -484,88 +476,90 @@ namespace Back.Controllers
[HttpGet("GetResult/{ID}")]
public async Task<ActionResult<DataInSendTaxDto>> GetResultByUid(int ID)
{
try
{
var claim = HttpContext.User.Claims.First(c => c.Type == "UserID");
var UserID = claim.Value;
var user = await _servUser.GetUserByUserID(Convert.ToInt32(UserID));
var item = await _servTaxPayer.GetSentTax(user.RolUsers.First().CompanyID, ID);
if (item == null)
return BadRequest(new List<string> { "یافت نشد" });
return BadRequest(new List<string> { "در حال حاضر سامانه مودیان در دسترس نمی باشد" });
if (string.IsNullOrEmpty(item.uId))
return BadRequest(new List<string> { "کد پیگیری یافت نشد" });
//try
//{
// var claim = HttpContext.User.Claims.First(c => c.Type == "UserID");
// var UserID = claim.Value;
// var user = await _servUser.GetUserByUserID(Convert.ToInt32(UserID));
// var item = await _servTaxPayer.GetSentTax(user.RolUsers.First().CompanyID, ID);
// if (item == null)
// return BadRequest(new List<string> { "یافت نشد" });
if (!await _actionTaxPayer.login(user.RolUsers.First().CompanyID))
return BadRequest(new List<string> { "خطا در احراز هویت سازمان مالیاتی" });
// if (string.IsNullOrEmpty(item.uId))
// return BadRequest(new List<string> { "کد پیگیری یافت نشد" });
DataInSendTaxDto desData = new DataInSendTaxDto();
// if (!await _actionTaxPayer.login(user.RolUsers.First().CompanyID))
// return BadRequest(new List<string> { "خطا در احراز هویت سازمان مالیاتی" });
// DataInSendTaxDto desData = new DataInSendTaxDto();
if (item.SentStatus == SentStatus.Unsuccessful && !string.IsNullOrEmpty(item.ErrorsModel))
{
List<MessageInSendTaxDto> inquiryerrorResult = JsonConvert.DeserializeObject<List<MessageInSendTaxDto>>(item.ErrorsModel);
// if (item.SentStatus == SentStatus.Unsuccessful && !string.IsNullOrEmpty(item.ErrorsModel))
// {
// List<MessageInSendTaxDto> inquiryerrorResult = JsonConvert.DeserializeObject<List<MessageInSendTaxDto>>(item.ErrorsModel);
InquiryResultModel inquiryResult = JsonConvert.DeserializeObject<InquiryResultModel>(item.InquiryResultModel);
if (inquiryResult.Data != null)
{
// InquiryResultModel inquiryResult = JsonConvert.DeserializeObject<InquiryResultModel>(item.InquiryResultModel);
// if (inquiryResult.Data != null)
// {
desData = new DataInSendTaxDto();
desData.SentStatus = SentStatus.Unsuccessful;
desData.error = inquiryerrorResult;
// desData = new DataInSendTaxDto();
// desData.SentStatus = SentStatus.Unsuccessful;
// desData.error = inquiryerrorResult;
}
return Ok(desData);
}
else if (item.SentStatus == SentStatus.Send
|| item.SentStatus == SentStatus.pending
|| item.SentStatus == SentStatus.IN_PROGRESS
|| item.SentStatus == SentStatus.Unsuccessful)
{
// }
// return Ok(desData);
// }
// else if (item.SentStatus == SentStatus.Send
// || item.SentStatus == SentStatus.pending
// || item.SentStatus == SentStatus.IN_PROGRESS
// || item.SentStatus == SentStatus.Unsuccessful)
// {
//ta imja
var result = await _actionTaxPayer.GetResultByUid(user.RolUsers.First().CompanyID, item.uId);
if (result == null)
return BadRequest(new List<string> { "پاسخی از سازمان دریافت نشد" });
// //ta imja
// var result = await _actionTaxPayer.GetResultByUid(user.RolUsers.First().CompanyID, item.uId);
// if (result == null)
// return BadRequest(new List<string> { "پاسخی از سازمان دریافت نشد" });
else
{
item.InquiryResultModel = JsonConvert.SerializeObject(result);
if (result.Data != null)
{
desData = JsonConvert.DeserializeObject<DataInSendTaxDto>(result.Data.ToString());
if (desData == null)
{
desData = new DataInSendTaxDto();
desData.error = JsonConvert.DeserializeObject<List<MessageInSendTaxDto>>(result.Data.ToString());
}
}
// else
// {
// item.InquiryResultModel = JsonConvert.SerializeObject(result);
// if (result.Data != null)
// {
// desData = JsonConvert.DeserializeObject<DataInSendTaxDto>(result.Data.ToString());
// if (desData == null)
// {
// desData = new DataInSendTaxDto();
// desData.error = JsonConvert.DeserializeObject<List<MessageInSendTaxDto>>(result.Data.ToString());
// }
// }
desData.SentStatus = item.SentStatus =
result.Status == "FAILED" ? SentStatus.Unsuccessful
: result.Status == "PENDING" ? SentStatus.pending
: result.Status == "SUCCESS" ? SentStatus.Successful
: result.Status == "NOT_FOUND" ? SentStatus.NOT_FOUND
: result.Status == "IN_PROGRESS" ? SentStatus.IN_PROGRESS
: SentStatus.Unknown;
// desData.SentStatus = item.SentStatus =
// result.Status == "FAILED" ? SentStatus.Unsuccessful
// : result.Status == "PENDING" ? SentStatus.pending
// : result.Status == "SUCCESS" ? SentStatus.Successful
// : result.Status == "NOT_FOUND" ? SentStatus.NOT_FOUND
// : result.Status == "IN_PROGRESS" ? SentStatus.IN_PROGRESS
// : SentStatus.Unknown;
if (item.SentStatus == SentStatus.Unsuccessful)
item.ErrorsModel = JsonConvert.SerializeObject(desData.error);
}
// if (item.SentStatus == SentStatus.Unsuccessful)
// item.ErrorsModel = JsonConvert.SerializeObject(desData.error);
// }
if (await _servTaxPayer.UpdateSentTax(item)) return Ok(desData);
// if (await _servTaxPayer.UpdateSentTax(item)) return Ok(desData);
else return BadRequest(new List<string> { "خطای در ذخیره سازی" });
}
return BadRequest(new List<string> { "در این وضعیت امکان پذیر نمی باشد" });
}
catch (Exception ex)
{
return BadRequest(new List<string> { "خطای ناشناخته" });
}
// else return BadRequest(new List<string> { "خطای در ذخیره سازی" });
// }
// return BadRequest(new List<string> { "در این وضعیت امکان پذیر نمی باشد" });
//}
//catch (Exception ex)
//{
// return BadRequest(new List<string> { "خطای ناشناخته" });
//}
}
[HttpGet("GetBillTypes")]
public async Task<ActionResult<List<IdName<int>>>> GetBillTypes()
@@ -585,26 +579,30 @@ namespace Back.Controllers
[HttpGet("EconomicCodeInformation")]
public async Task<ActionResult<EconomicCodeModelDto>> GetEconomicCodeInformation(string item)
{
var claim = HttpContext.User.Claims.First(c => c.Type == "UserID");
var UserID = claim.Value;
var user = await _servUser.GetUserByUserID(Convert.ToInt32(UserID));
if (!await _actionTaxPayer.login(user.RolUsers.First().CompanyID))
return BadRequest(new List<string> { "خطا در احراز هویت سازمان مالیاتی" });
var result=await _actionTaxPayer.GetEconomicCodeInformation(item);
if (result == null) return NotFound();
return Ok(result);
return BadRequest(new List<string> { "در حال حاضر سامانه مودیان در دسترس نمی باشد" });
//var claim = HttpContext.User.Claims.First(c => c.Type == "UserID");
//var UserID = claim.Value;
//var user = await _servUser.GetUserByUserID(Convert.ToInt32(UserID));
//if (!await _actionTaxPayer.login(user.RolUsers.First().CompanyID))
// return BadRequest(new List<string> { "خطا در احراز هویت سازمان مالیاتی" });
//var result=await _actionTaxPayer.GetEconomicCodeInformation(item);
//if (result == null) return NotFound();
//return Ok(result);
}
[HttpGet("FiscalInformation")]
public async Task<ActionResult<FiscalInformationModelDto>> GetFiscalInformation(string item)
{
var claim = HttpContext.User.Claims.First(c => c.Type == "UserID");
var UserID = claim.Value;
var user = await _servUser.GetUserByUserID(Convert.ToInt32(UserID));
if (!await _actionTaxPayer.login(user.RolUsers.First().CompanyID))
return BadRequest(new List<string> { "خطا در احراز هویت سازمان مالیاتی" });
var result=await _actionTaxPayer.GetFiscalInformation(item);
if (result == null) return NotFound();
return Ok(result);
return BadRequest(new List<string> { "در حال حاضر سامانه مودیان در دسترس نمی باشد" });
//var claim = HttpContext.User.Claims.First(c => c.Type == "UserID");
//var UserID = claim.Value;
//var user = await _servUser.GetUserByUserID(Convert.ToInt32(UserID));
//if (!await _actionTaxPayer.login(user.RolUsers.First().CompanyID))
// return BadRequest(new List<string> { "خطا در احراز هویت سازمان مالیاتی" });
//var result=await _actionTaxPayer.GetFiscalInformation(item);
//if (result == null) return NotFound();
//return Ok(result);
}
[HttpGet("CodInTaxPayerHaveBeenSentSuccessfully/{CODID}")]
public async Task<ActionResult<bool>> CodInTaxPayerHaveBeenSentSuccessfully(int CODID)

View File

@@ -13,6 +13,13 @@ namespace Back.Controllers.Warehouse
{
private readonly WarehouseService _warehouseService;
private readonly servUser _servUser;
public WarehouseController(WarehouseService warehouseService, servUser servUser)
{
_warehouseService = warehouseService;
_servUser = servUser;
}
[HttpGet("Circulation")]
public async Task<IActionResult> Circulation(string date = "", int CODID = 0, int PageIndex = 1, int PageSize = 5)
{
@@ -20,7 +27,7 @@ namespace Back.Controllers.Warehouse
var UserID = claim.Value;
var user = await _servUser.GetUserByUserID(Convert.ToInt32(UserID));
var CompanyID = user.RolUsers.First().CompanyID;
return Ok(await _warehouseService.Circulation(CompanyID,date,CODID));
return Ok(await _warehouseService.Circulation(CompanyID,date,CODID,PageIndex,PageSize));
}
[HttpGet("Inventory/{CODID}")]
public async Task<IActionResult> Inventory(int CODID)

View File

@@ -3,7 +3,6 @@ using Back.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Shared.DTOs;
using Shared.DTOs.Serch;

View File

@@ -3,7 +3,6 @@ using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;
using Back.Common;
using Shared.DTOs;
using TaxCollectData.Library.Dto.Content;
namespace Back.Data.Models
{
public class Invoice : ICloneable
@@ -148,7 +147,7 @@ namespace Back.Data.Models
{
get
{
return pattern.BillTypeID == 3 || (pattern.BillTypeID == 2 && pattern.ID == 10)
return pattern!=null && (pattern.BillTypeID == 3 || (pattern.BillTypeID == 2 && pattern.ID == 10))
? 1
: _setm;
}

View File

@@ -4,7 +4,7 @@ using System.Reflection.Metadata.Ecma335;
namespace Back.Data.Models
{
public class InvoiceItem
public class InvoiceItem : ICloneable
{
#region Key
public int ID { get; set; }
@@ -64,18 +64,16 @@ namespace Back.Data.Models
//مبلغ قبل از تخفیف
[MaxLength(18)]
public decimal? prdis { get { return am * fee; } }
//نرخ مالیات بر ازش افزوده
[MaxLength(5)]
public decimal? vra { get { return
//صادرات مالیات ندارد
invoice?.pattern?.ID == 10 ? 0
:cODItem != null ? cODItem.TaxRate
: null; } }
//واحد اندازه گیری عنوان
public string? unitTitle { get { return cODItem!=null ? cODItem.CODUnit.Title : null; } }
#endregion
#region fild
//نرخ مالیات بر ازش افزوده
[MaxLength(5)]
public decimal? vra { get; set; }
//تعداد/مقدار
[MaxLength(36)]
public decimal? am { get; set; }
@@ -147,6 +145,11 @@ namespace Back.Data.Models
[ForeignKey("CODID")]
public virtual CODItem cODItem { get; set; }
public object Clone()
{
return this.MemberwiseClone();
}
#endregion
}

View File

@@ -11,6 +11,7 @@ namespace Back.Data.Models.Warehouse
public int CODID { get; set; }
public decimal Count { get; set; }
public string Date { get; set; }
public DateTime CreateDt { get; set; }
public bool ForSale { get; set; }
public TypeReceipt Type { get; set; }
public string info { get; set; }

View File

@@ -11,6 +11,8 @@ namespace Back.Data.Models.Warehouse
public int CODID { get; set; }
public decimal Count { get; set; }
public string Date { get; set; }
public DateTime CreateDt { get; set; }
public TypeRemittance Type { get; set; }
public string info { get; set; }
public int? InvoiceID { get; set; }

15
Back/DockerCommand.txt Normal file
View File

@@ -0,0 +1,15 @@
 from run E:\TaxPayerFULL
docker build -f back\Dockerfile -t api_moadiran .
docker run --name api_moadiran -d -p 3201:8080 api_moadiran
یکی از مشکلات این پروژه یکی کنابخانه سامانه مودیان بود که وقتی خود کنابخانه رو ریختیم کنار پروژه و در داکزفایل آدرسشو دادیم درست شد ولی ما کلا حذفش کردیم
یکی هم taxtools بود که اونم باید میومد کنار پروؤه ولی ما فعلا خذفش کردیم
کلا داکر نمیتونه به درایو ها دسترسی داشته باشه همه چی باید در خود پروژه باشه
--------------------------------------------------------------------------------------------
in local => docker build -f back\Dockerfile -t mmrbnjd/api_moadiran:latest .
in local => docker push mmrbnjd/api_moadiran:latest
in server => docker pull mmrbnjd/api_moadiran:latest
in server => docker run -d -p 3201:8080 --restart always mmrbnjd/api_moadiran:latest

30
Back/Dockerfile Normal file
View File

@@ -0,0 +1,30 @@
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
WORKDIR /app
EXPOSE 8080
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
# کپی csproj ها
COPY Back/Back.csproj Back/
COPY Shared/Shared.csproj Shared/
# کپی کردن سورس لوکال و NuGet.config (از داخل Back)
#COPY Back/NuGet.config ./
#COPY Back/LocalPackages ./LocalPackages
RUN dotnet restore "./Back/Back.csproj"
COPY . .
WORKDIR "/src/Back"
RUN dotnet build "./Back.csproj" -c $BUILD_CONFIGURATION -o /app/build
FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./Back.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Back.dll"]

View File

@@ -1,25 +1,24 @@
using Newtonsoft.Json.Serialization;
using Newtonsoft.Json;

using System.Reflection;
namespace Back.Features
{
public class IgnorePropertiesResolver : DefaultContractResolver
{
private readonly HashSet<string> ignoreProps;
public IgnorePropertiesResolver(IEnumerable<string> propNamesToIgnore)
{
this.ignoreProps = new HashSet<string>(propNamesToIgnore);
}
//public class IgnorePropertiesResolver : DefaultContractResolver
//{
// private readonly HashSet<string> ignoreProps;
// public IgnorePropertiesResolver(IEnumerable<string> propNamesToIgnore)
// {
// this.ignoreProps = new HashSet<string>(propNamesToIgnore);
// }
protected override JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization)
{
JsonProperty property = base.CreateProperty(member, memberSerialization);
if (this.ignoreProps.Contains(property.PropertyName))
{
property.ShouldSerialize = _ => false;
}
return property;
}
}
// protected override JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization)
// {
// JsonProperty property = base.CreateProperty(member, memberSerialization);
// if (this.ignoreProps.Contains(property.PropertyName))
// {
// property.ShouldSerialize = _ => false;
// }
// return property;
// }
//}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,92 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Back.Migrations
{
/// <inheritdoc />
public partial class tbswarehouse : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<decimal>(
name: "Count",
table: "Remittances",
type: "decimal(18,2)",
nullable: false,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.AddColumn<bool>(
name: "Deleted",
table: "Remittances",
type: "bit",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<int>(
name: "InvoiceID",
table: "Remittances",
type: "int",
nullable: true);
migrationBuilder.AlterColumn<decimal>(
name: "Count",
table: "Receipts",
type: "decimal(18,2)",
nullable: false,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.AddColumn<bool>(
name: "Deleted",
table: "Receipts",
type: "bit",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<int>(
name: "InvoiceID",
table: "Receipts",
type: "int",
nullable: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Deleted",
table: "Remittances");
migrationBuilder.DropColumn(
name: "InvoiceID",
table: "Remittances");
migrationBuilder.DropColumn(
name: "Deleted",
table: "Receipts");
migrationBuilder.DropColumn(
name: "InvoiceID",
table: "Receipts");
migrationBuilder.AlterColumn<int>(
name: "Count",
table: "Remittances",
type: "int",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,2)");
migrationBuilder.AlterColumn<int>(
name: "Count",
table: "Receipts",
type: "int",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,2)");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,32 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Back.Migrations
{
/// <inheritdoc />
public partial class invoicetb : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<decimal>(
name: "vra",
table: "InvoiceItems",
type: "decimal(18,2)",
maxLength: 5,
nullable: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "vra",
table: "InvoiceItems");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,41 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Back.Migrations
{
/// <inheritdoc />
public partial class cdt : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<DateTime>(
name: "CreateDt",
table: "Remittances",
type: "datetime2",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<DateTime>(
name: "CreateDt",
table: "Receipts",
type: "datetime2",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "CreateDt",
table: "Remittances");
migrationBuilder.DropColumn(
name: "CreateDt",
table: "Receipts");
}
}
}

View File

@@ -668,6 +668,10 @@ namespace Back.Migrations
.HasMaxLength(18)
.HasColumnType("decimal(18,2)");
b.Property<decimal?>("vra")
.HasMaxLength(5)
.HasColumnType("decimal(18,2)");
b.HasKey("ID");
b.HasIndex("CODID");
@@ -1463,16 +1467,25 @@ namespace Back.Migrations
b.Property<int>("CODID")
.HasColumnType("int");
b.Property<int>("Count")
.HasColumnType("int");
b.Property<decimal>("Count")
.HasColumnType("decimal(18,2)");
b.Property<DateTime>("CreateDt")
.HasColumnType("datetime2");
b.Property<string>("Date")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<bool>("Deleted")
.HasColumnType("bit");
b.Property<bool>("ForSale")
.HasColumnType("bit");
b.Property<int?>("InvoiceID")
.HasColumnType("int");
b.Property<int>("Type")
.HasColumnType("int");
@@ -1498,13 +1511,22 @@ namespace Back.Migrations
b.Property<int>("CODID")
.HasColumnType("int");
b.Property<int>("Count")
.HasColumnType("int");
b.Property<decimal>("Count")
.HasColumnType("decimal(18,2)");
b.Property<DateTime>("CreateDt")
.HasColumnType("datetime2");
b.Property<string>("Date")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<bool>("Deleted")
.HasColumnType("bit");
b.Property<int?>("InvoiceID")
.HasColumnType("int");
b.Property<int>("Type")
.HasColumnType("int");

7
Back/NuGet.config Normal file
View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="local" value="./LocalPackages" />
</packageSources>
</configuration>

View File

@@ -55,7 +55,7 @@ builder.Services.AddScoped(typeof(IAsyncRepository<>), typeof(RepositoryBase<>))
builder.Services.AddScoped(typeof(RepositoryBase<>), typeof(RepositoryBase<>));
builder.Services.AddScoped<Back.Services.ServBase>();
builder.Services.AddScoped<MobileValidation> ();
builder.Services.AddScoped<Service.Main>();
//builder.Services.AddScoped<Service.Main>();
builder.Services.AddScoped<servTicket > ();
builder.Services.AddScoped<ServValidatinMsg>();
builder.Services.AddScoped<GetVerificationValidation> ();
@@ -104,10 +104,9 @@ builder.Services.AddCors(options =>
options.AddPolicy(origins,
policy =>
{
policy.WithOrigins("https://localhost:7224", "http://localhost:5107"
, "http://195.88.208.142", "http://moadiran.ir"
, "https://195.88.208.142", "https://moadiran.ir"
, "https://195.88.208.142:440", "https://moadiran.ir:440", "https://localhost:44346")
policy
//.AllowAnyOrigin()
.WithOrigins("https://app.moadiran.ir", "https://moadiran.ir", "http://156.255.1.229:3101", "http://156.255.1.229:3102/")
.AllowAnyHeader()
.WithHeaders(HeaderNames.ContentType)
.AllowAnyMethod();
@@ -135,7 +134,7 @@ builder.Services.AddAuthentication("Bearer")
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
if (true || app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();

View File

@@ -27,6 +27,17 @@
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Container (Dockerfile)": {
"commandName": "Docker",
"launchBrowser": true,
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger",
"environmentVariables": {
"ASPNETCORE_HTTPS_PORTS": "8081",
"ASPNETCORE_HTTP_PORTS": "8080"
},
"publishAllPorts": true,
"useSSL": true
}
},
"$schema": "http://json.schemastore.org/launchsettings.json",

View File

@@ -1,13 +1,8 @@
using Back.Common;
using Microsoft.IdentityModel.Tokens;
using Newtonsoft.Json;
using Shared.DTOs;
using TaxCollectData.Library.Business;
using TaxCollectData.Library.Dto.Config;
using TaxCollectData.Library.Dto.Content;
using TaxCollectData.Library.Dto.Properties;
using TaxCollectData.Library.Dto.Transfer;
using TaxCollectData.Library.Enums;
namespace Back.Services
{
@@ -26,77 +21,77 @@ namespace Back.Services
public string GenerateTaxid(string FactorNo, string InvoiceDate)
{
//return "testTaxid";
return TaxApiService.Instance.TaxIdGenerator.GenerateTaxId(_UniqueMemory,
Convert.ToInt64(FactorNo), InvoiceDate.ToMiladi());
return "testTaxid";
//return TaxApiService.Instance.TaxIdGenerator.GenerateTaxId(_UniqueMemory,
// Convert.ToInt64(FactorNo), InvoiceDate.ToMiladi());
}
public async Task<InquiryResultModel> GetResultByUid(int CompanyID, string uid)
{
//public async Task<InquiryResultModel> GetResultByUid(int CompanyID, string uid)
//{
var uidAndFiscalId = new UidAndFiscalId(uid, _UniqueMemory);
var inquiryResultModels = TaxApiService.Instance.TaxApis.InquiryByUidAndFiscalId(new() { uidAndFiscalId });
if (inquiryResultModels.Count > 0)
return inquiryResultModels[0];
return null;
}
public async Task<TaxCollectData.Library.Dto.HttpResponse<AsyncResponseModel>> SendInvoice(int CompanyID,InvoiceHeaderDto header, List<InvoiceBodyDto> InvoiceBody, List<PaymentDto> payments)
{
return await TaxApiService.Instance.TaxApis.SendInvoicesAsync(new List<InvoiceDto>()
{
new()
{
Header =header,Body =InvoiceBody,Payments = payments
}
}
, null);
}
public async Task<EconomicCodeModel?> GetEconomicCodeInformation(string Item)
{
// var uidAndFiscalId = new UidAndFiscalId(uid, _UniqueMemory);
// var inquiryResultModels = TaxApiService.Instance.TaxApis.InquiryByUidAndFiscalId(new() { uidAndFiscalId });
// if (inquiryResultModels.Count > 0)
// return inquiryResultModels[0];
// return null;
//}
//public async Task<TaxCollectData.Library.Dto.HttpResponse<AsyncResponseModel>> SendInvoice(int CompanyID,InvoiceHeaderDto header, List<InvoiceBodyDto> InvoiceBody, List<PaymentDto> payments)
//{
// return await TaxApiService.Instance.TaxApis.SendInvoicesAsync(new List<InvoiceDto>()
// {
// new()
// {
// Header =header,Body =InvoiceBody,Payments = payments
// }
// }
// , null);
//}
//public async Task<EconomicCodeModel?> GetEconomicCodeInformation(string Item)
//{
return await TaxApiService.Instance.TaxApis.GetEconomicCodeInformationAsync(Item);
// return await TaxApiService.Instance.TaxApis.GetEconomicCodeInformationAsync(Item);
}
public async Task<FiscalInformationModel?> GetFiscalInformation(string Item)
{
return await TaxApiService.Instance.TaxApis.GetFiscalInformationAsync(Item);
}
//}
//public async Task<FiscalInformationModel?> GetFiscalInformation(string Item)
//{
// return await TaxApiService.Instance.TaxApis.GetFiscalInformationAsync(Item);
//}
//-------------------internal
public async Task<bool> login(int CompanyID)
{
return false;
//try
//{
// #region TokenTax
// var resquth = await _servCompany.GetTaxAuth(CompanyID);
// if (string.IsNullOrEmpty(resquth.UniqueMemory) || string.IsNullOrEmpty(resquth.PrivateKey))
// return false;
try
{
#region TokenTax
var resquth = await _servCompany.GetTaxAuth(CompanyID);
if (string.IsNullOrEmpty(resquth.UniqueMemory) || string.IsNullOrEmpty(resquth.PrivateKey))
return false;
if (!string.IsNullOrEmpty(resquth.UniqueMemory) && !string.IsNullOrEmpty(resquth.PrivateKey))
{
// if (!string.IsNullOrEmpty(resquth.UniqueMemory) && !string.IsNullOrEmpty(resquth.PrivateKey))
// {
//string taxapi = _configuration.GetSection("TaxPayerApi").Value;
string taxapi = "https://sandboxrc.tax.gov.ir/req/api/";
_UniqueMemory = resquth.UniqueMemory;
_PrivateKey = resquth.PrivateKey;
TaxApiService.Instance.Init(_UniqueMemory,
new SignatoryConfig(_PrivateKey, null),
new NormalProperties(ClientType.SELF_TSP), taxapi);
await TaxApiService.Instance.TaxApis.GetServerInformationAsync();
}
#endregion
// //string taxapi = _configuration.GetSection("TaxPayerApi").Value;
// string taxapi = "https://sandboxrc.tax.gov.ir/req/api/";
// _UniqueMemory = resquth.UniqueMemory;
// _PrivateKey = resquth.PrivateKey;
// TaxApiService.Instance.Init(_UniqueMemory,
// new SignatoryConfig(_PrivateKey, null),
// new NormalProperties(ClientType.SELF_TSP), taxapi);
// await TaxApiService.Instance.TaxApis.GetServerInformationAsync();
// }
// #endregion
if (TaxApiService.Instance.TaxApis.GetToken() is null)
{
if (await TaxApiService.Instance.TaxApis.RequestTokenAsync() == null)
return false;
}
return true;
}
catch (Exception)
{
return false;
}
// if (TaxApiService.Instance.TaxApis.GetToken() is null)
// {
// if (await TaxApiService.Instance.TaxApis.RequestTokenAsync() == null)
// return false;
// }
// return true;
//}
//catch (Exception)
//{
// return false;
//}
}

View File

@@ -33,7 +33,7 @@ namespace Back.Services
public int? Inp { get { return _invoice.inp ?? 1; } }
public int? Ins { get { return _invoice.ins ?? 1; } }
public string? Tins { get { return string.IsNullOrEmpty(_invoice.tins) ? null : _invoice.tins; } }
public int? Tob { get { return level == 10 || _invoice.tob==0 ? null : _invoice.tob == 5 ? 1 : _invoice.tob == 6 ? 4 : _invoice.tob; } }
public int? Tob { get { return level == 10 || _invoice.tob == 0 ? null : _invoice.tob == 5 ? 1 : _invoice.tob == 6 ? 4 : _invoice.tob; } }
public string? Bid
{
get
@@ -96,14 +96,22 @@ namespace Back.Services
public decimal? Nw { get { return level == 10 ? bitem.nw : null; } }
public decimal? Fee { get { return level == 4 ? null : bitem.fee; } }
public decimal? Cfee { get { return bitem.cfee == 0 || level == 8 || level == 10 ? null : bitem.cfee; } }
public string? Cut { get{ return level == 8 || string.IsNullOrEmpty(bitem.cut) ? null : bitem.cut; } }
public string? Cut { get { return level == 8 || string.IsNullOrEmpty(bitem.cut) ? null : bitem.cut; } }
public decimal? Exr { get { return level == 8 ? null : bitem.exr; } }
public decimal? Ssrv { get { return level == 10 ? bitem.ssrv : null; } }
public decimal? Sscv { get { return level == 10 ? bitem.sscv : null; } }
public decimal? Prdis { get { return level == 10 ? null : bitem.prdis; } }
public decimal? Dis { get { return level == 10 ? null : bitem.dis; } }
public decimal? Adis { get { return level == 10 ? null : bitem.adis; } }
public decimal? Vra { get { return bitem.vra; } }
public decimal? Vra
{
get
{
return level == 14 ? 0
:
bitem.vra;
}
}
public decimal? Vam { get { return bitem.vam; } }
public string? Odt { get { return string.IsNullOrEmpty(bitem.odt) ? null : bitem.odt; } }
public decimal? Odr { get { return bitem.odr; } }

View File

@@ -16,15 +16,15 @@ namespace Back.Services
private readonly IAsyncRepository<Blog> _repoBlog;
private readonly IAsyncRepository<Question> _repoQuestion;
private readonly IAsyncRepository<SaleLead> _repoSaleLead;
private readonly Service.Main _Taxtools;
// private readonly Service.Main _Taxtools;
public ServBase(IAsyncRepository<Pricing> repoPricing,
IAsyncRepository<Blog> repoBlog, IAsyncRepository<Question> repoQuestion
, Service.Main taxtools, IAsyncRepository<SaleLead> repoSaleLead)
/* , Service.Main taxtools*/, IAsyncRepository<SaleLead> repoSaleLead)
{
_repoPricing = repoPricing;
_repoBlog = repoBlog;
_repoQuestion = repoQuestion;
_Taxtools = taxtools;
// _Taxtools = taxtools;
_repoSaleLead = repoSaleLead;
}
public async Task<List<BasePriceDto>> GetBasePrice()
@@ -89,63 +89,63 @@ namespace Back.Services
public async Task<TaxToolsDTO?> CreateCsrAndPrivateKey(CsrPrivateKeyDto model)
{
TaxToolsDTO taxTools = null;
List<Service.PrmValue> values = new List<Service.PrmValue>()
{
new Service.PrmValue(){Prm="CN",Value=model.cn},
new Service.PrmValue(){Prm="serialNumber",Value=model.sn},
new Service.PrmValue(){Prm="O",Value="Non-Governmental"},
new Service.PrmValue(){Prm="3.OU",Value=model.company},
new Service.PrmValue(){Prm="2.OU",Value=model.company},
new Service.PrmValue(){Prm="1.OU",Value=model.company},
new Service.PrmValue(){Prm="C",Value="IR"},
};
string msg = "";
if (_Taxtools.CraeteCnfFile(values, ref msg))
{
if (_Taxtools.CreateCsrAndPrivateKey(model.cn, ref msg))
{
taxTools = new TaxToolsDTO();
//خواندن
Stream stream = File.Open($"C:\\OpenSSL\\bin\\{model.cn}.Csr", FileMode.Open);
byte[] buffer = new byte[stream.Length];
stream.Read(buffer, 0, (int)stream.Length);
string csr = Encoding.UTF8.GetString(buffer);
stream.Flush();
stream.Close();
taxTools.Base64csr = Convert.ToBase64String(buffer);
taxTools.typecsr = "Csr";
stream = File.Open($"C:\\OpenSSL\\bin\\{model.cn}.key", FileMode.Open);
buffer = new byte[stream.Length];
stream.Read(buffer, 0, (int)stream.Length);
string key = Encoding.UTF8.GetString(buffer);
taxTools.Base64key = Convert.ToBase64String(buffer);
taxTools.typekey = "key";
stream.Flush();
stream.Close();
//List<Service.PrmValue> values = new List<Service.PrmValue>()
//{
// new Service.PrmValue(){Prm="CN",Value=model.cn},
// new Service.PrmValue(){Prm="serialNumber",Value=model.sn},
// new Service.PrmValue(){Prm="O",Value="Non-Governmental"},
// new Service.PrmValue(){Prm="3.OU",Value=model.company},
// new Service.PrmValue(){Prm="2.OU",Value=model.company},
// new Service.PrmValue(){Prm="1.OU",Value=model.company},
// new Service.PrmValue(){Prm="C",Value="IR"},
//};
//string msg = "";
//if (_Taxtools.CraeteCnfFile(values, ref msg))
//{
// if (_Taxtools.CreateCsrAndPrivateKey(model.cn, ref msg))
// {
// taxTools = new TaxToolsDTO();
// //خواندن
// Stream stream = File.Open($"C:\\OpenSSL\\bin\\{model.cn}.Csr", FileMode.Open);
// byte[] buffer = new byte[stream.Length];
// stream.Read(buffer, 0, (int)stream.Length);
// string csr = Encoding.UTF8.GetString(buffer);
// stream.Flush();
// stream.Close();
// taxTools.Base64csr = Convert.ToBase64String(buffer);
// taxTools.typecsr = "Csr";
// stream = File.Open($"C:\\OpenSSL\\bin\\{model.cn}.key", FileMode.Open);
// buffer = new byte[stream.Length];
// stream.Read(buffer, 0, (int)stream.Length);
// string key = Encoding.UTF8.GetString(buffer);
// taxTools.Base64key = Convert.ToBase64String(buffer);
// taxTools.typekey = "key";
// stream.Flush();
// stream.Close();
//_contextMongodb.InsertItem(new SysLog()
//{
// TraceIdentifierID = _httpContextAccessor.HttpContext.TraceIdentifier,
// Datetime = DateTime.Now.ConvertMiladiToShamsi(),
// Method = $"{_httpContextAccessor.HttpContext.Request.Method}/{this.GetType().FullName}/CreateCsrAndPrivateKey",
// Value = JsonConvert.SerializeObject(model),
// Route = _httpContextAccessor.HttpContext.Request.Path,
// Type = "User"
//});
await _repoSaleLead.AddAsync(new SaleLead
{
cn = model.cn,
company = model.company,
csr = csr,
Key = key,
Mobile = model.Mobile,
sn = model.sn
});
}
// //_contextMongodb.InsertItem(new SysLog()
// //{
// // TraceIdentifierID = _httpContextAccessor.HttpContext.TraceIdentifier,
// // Datetime = DateTime.Now.ConvertMiladiToShamsi(),
// // Method = $"{_httpContextAccessor.HttpContext.Request.Method}/{this.GetType().FullName}/CreateCsrAndPrivateKey",
// // Value = JsonConvert.SerializeObject(model),
// // Route = _httpContextAccessor.HttpContext.Request.Path,
// // Type = "User"
// //});
// await _repoSaleLead.AddAsync(new SaleLead
// {
// cn = model.cn,
// company = model.company,
// csr = csr,
// Key = key,
// Mobile = model.Mobile,
// sn = model.sn
// });
// }
}
//}
if (string.IsNullOrEmpty(msg))
// if (string.IsNullOrEmpty(msg))
{
//_contextMongodb.InsertItem(new SysLog()
//{

View File

@@ -27,13 +27,15 @@ namespace Back.Services.Warehouse
{
var model = new Receipt()
{
Date = item.Date,
Date = item.Date.Replace("/",""),
CODID = item.CODID,
Count = item.Count,
ForSale = item.ForSale,
info = item.info,
Type = item.Type,
Deleted = false
InvoiceID=item.InvoiceID,
Deleted = false,
CreateDt=DateTime.Now
};
var returnmodel = await _ReceiptRepo.AddAsync(model);
if (returnmodel != null)
@@ -60,7 +62,8 @@ namespace Back.Services.Warehouse
public async Task<ReceiptDto?> Update(ReceiptDto item)
{
var model= await _ReceiptRepo.Get(w => w.ID == item.ID).FirstOrDefaultAsync();
model.Date= item.Date;
model.Date= item.Date.Replace("/", "");
model.CODID= item.CODID;
model.Count= item.Count;
model.ForSale= item.ForSale;
@@ -83,6 +86,25 @@ namespace Back.Services.Warehouse
return await _ReceiptRepo.UpdateAsync(model);
}
public async Task<bool> DeleteByInvoiceID(int InvoiceID, int CompanyID)
{
var models = await _ReceiptRepo.Get(w => w.InvoiceID == InvoiceID && w.cODItem.CompanyID == CompanyID && !w.Deleted).ToListAsync();
foreach (var model in models)
model.Deleted = true;
if (models.Any())
return await _ReceiptRepo.UpdateRangeAsync(models);
return true;
}
//public async Task<bool> DeleteByCODIDAndInvoiceID(int InvoiceID,int CODID, int CompanyID)
//{
// var model = await _ReceiptRepo.Get(w => w.InvoiceID == InvoiceID && w.CODID==CODID && w.cODItem.CompanyID == CompanyID && !w.Deleted).FirstOrDefaultAsync();
// model.Deleted = true;
// return await _ReceiptRepo.UpdateAsync(model);
//}
public async Task<ReceiptDto?> Get(int itemID, int CompanyID)
{
return await _ReceiptRepo.Get(w => w.ID == itemID && w.cODItem.CompanyID == CompanyID && !w.Deleted)

View File

@@ -19,12 +19,14 @@ namespace Back.Services.Warehouse
{
var model = new Remittance()
{
Date = item.Date,
Date = item.Date.Replace("/", ""),
CODID = item.CODID,
Count = item.Count,
info = item.info,
Type = item.Type,
Deleted=false
InvoiceID = item.InvoiceID,
Deleted=false,
CreateDt = DateTime.Now
};
var returnmodel = await _ReceiptRepo.AddAsync(model);
if (returnmodel != null)
@@ -44,7 +46,7 @@ namespace Back.Services.Warehouse
public async Task<RemittanceDto?> Update(RemittanceDto item)
{
var model = await _ReceiptRepo.Get(w => w.ID == item.ID).FirstOrDefaultAsync();
model.Date = item.Date;
model.Date = item.Date.Replace("/", "");
model.CODID = item.CODID;
model.Count = item.Count;
model.info = item.info;
@@ -66,6 +68,23 @@ namespace Back.Services.Warehouse
model.Deleted = true;
return await _ReceiptRepo.UpdateAsync(model);
}
public async Task<bool> DeleteByInvoiceID(int InvoiceID, int CompanyID)
{
var models = await _ReceiptRepo.Get(w => w.InvoiceID == InvoiceID && w.cODItem.CompanyID == CompanyID && !w.Deleted).ToListAsync();
foreach (var model in models)
model.Deleted = true;
if(models.Any())
return await _ReceiptRepo.UpdateRangeAsync(models);
return true;
}
public async Task<bool> DeleteByCODIDAndInvoiceID(int InvoiceID, int CODID, int CompanyID)
{
var model = await _ReceiptRepo.Get(w => w.InvoiceID == InvoiceID && w.CODID == CODID && w.cODItem.CompanyID == CompanyID && !w.Deleted).FirstOrDefaultAsync();
model.Deleted = true;
return await _ReceiptRepo.UpdateAsync(model);
}
public async Task<RemittanceDto?> Get(int itemID, int CompanyID)
{

View File

@@ -1,4 +1,5 @@
using Back.Common;

using Back.Common;
using Back.Data.Contracts;
using Back.Data.Models.Warehouse;
using Microsoft.EntityFrameworkCore;
@@ -23,51 +24,65 @@ namespace Back.Services.Warehouse
_RemittanceRepo = remittanceRepo;
_ReceiptRepo = receiptRepo;
}
public async Task<PagingDto<CirculationDto>> Circulation(int CompanyID,string date="",int CODID=0,int PageIndex=1,int PageSize=5)
public async Task<PagingDto<CirculationDto>> Circulation(int CompanyID, string date = "", int CODID = 0, int PageIndex = 1, int PageSize = 5)
{
var RequestRemittance = _RemittanceRepo.Get(w => w.cODItem.CompanyID == CompanyID && !w.Deleted)
.Select(s=>new CirculationDto
.Select(s => new CirculationDto
{
CODID=s.CODID,
CODTitle=s.cODItem.Title,
Date=s.Date,
Count=s.Count,
info=s.info,
Type=TypeCirculation.Remittance,
ID= s.ID,
CODID = s.CODID,
CODTitle = s.cODItem.Title,
Date = s.Date.ShamciToFormatShamci(),
Count = s.Count,
info = s.info,
Type = TypeCirculation.Remittance,
ModelTypeID = (int)s.Type,
ModelTypeTitle= s.Type.GetDisplayName()
ModelTypeTitle = s.Type.GetEnumDisplayName(),
invoiceID = s.InvoiceID,
CreateDt = s.CreateDt,
});
if (!string.IsNullOrEmpty(date))
RequestRemittance = RequestRemittance.Where(w => w.Date == date);
if (CODID!=0)
if (CODID != 0)
RequestRemittance = RequestRemittance.Where(w => w.CODID == CODID);
//-----------
var RequestReceipt = _ReceiptRepo.Get(w => w.cODItem.CompanyID == CompanyID && !w.Deleted)
.Select(s => new CirculationDto
{
ID = s.ID,
CODID = s.CODID,
CODTitle = s.cODItem.Title,
Date = s.Date,
Date = s.Date.ShamciToFormatShamci(),
Count = s.Count,
info = s.info,
Type = TypeCirculation.Receipt,
ModelTypeID = (int)s.Type,
ModelTypeTitle = s.Type.GetDisplayName()
ModelTypeTitle = s.Type.GetEnumDisplayName(),
invoiceID = s.InvoiceID,
ForSale = s.ForSale,
CreateDt = s.CreateDt,
});
if (!string.IsNullOrEmpty(date))
RequestReceipt = RequestReceipt.Where(w => w.Date == date);
if (CODID != 0)
RequestReceipt = RequestReceipt.Where(w => w.CODID == CODID);
return await RequestReceipt.Union(RequestRemittance).OrderByDescending(o => o.Date).Paging(PageIndex, PageSize);
var itemsReceipt = await RequestReceipt.ToListAsync();
var Remittance = await RequestRemittance.ToListAsync();
return await itemsReceipt.Union(Remittance).OrderByDescending(o => o.CreateDt).Paging(PageIndex, PageSize);
// return await RequestReceipt.Union(RequestRemittance).OrderByDescending(o => o.Date).Paging(PageIndex, PageSize);
//var list = await RequestReceipt.ToListAsync();
//list.AddRange(await RequestRemittance.ToListAsync());
//return await list.OrderByDescending(o=>o.Date).AsQueryable().Paging(PageIndex, PageSize);
}
public async Task<decimal> Inventory(int CompanyID,int CODID)
public async Task<decimal> Inventory(int CompanyID, int CODID)
{
var CReceipt=await _ReceiptRepo.Get(w => w.cODItem.CompanyID == CompanyID && w.CODID == CODID && w.ForSale && !w.Deleted).SumAsync(s => s.Count);
var CRemittance=await _RemittanceRepo.Get(w => w.cODItem.CompanyID == CompanyID && w.CODID == CODID && !w.Deleted).SumAsync(s => s.Count);
var CReceipt = await _ReceiptRepo.Get(w => w.cODItem.CompanyID == CompanyID && w.CODID == CODID && w.ForSale && !w.Deleted).SumAsync(s => s.Count);
var CRemittance = await _RemittanceRepo.Get(w => w.cODItem.CompanyID == CompanyID && w.CODID == CODID && !w.Deleted).SumAsync(s => s.Count);
return CReceipt - CRemittance;
}
}

View File

@@ -4,23 +4,28 @@ using Shared.DTOs.Serch;
using Shared.DTOs;
using Back.Common;
using Microsoft.EntityFrameworkCore;
using Back.Services.Warehouse;
namespace Back.Services
{
public class servInvoice
{
private readonly RemittanceService _remittanceService;
private readonly IAsyncRepository<Invoice> _invoiceRepo;
private readonly IAsyncRepository<Coding> _CodingRepo;
private readonly IAsyncRepository<InvoiceStatusChang> _invoiceStatusChangPaymentRepo;
private readonly CheckPermission _checkPermission;
public servInvoice(IAsyncRepository<Invoice> invoiceRepo, CheckPermission checkPermission
, IAsyncRepository<InvoiceStatusChang> invoiceStatusChangPaymentRepo, IAsyncRepository<Coding> codingRepo)
public servInvoice(RemittanceService remittanceService, IAsyncRepository<Invoice> invoiceRepo, IAsyncRepository<Coding> codingRepo, IAsyncRepository<InvoiceStatusChang> invoiceStatusChangPaymentRepo, CheckPermission checkPermission)
{
_invoiceStatusChangPaymentRepo = invoiceStatusChangPaymentRepo;
_remittanceService = remittanceService;
_invoiceRepo = invoiceRepo;
_checkPermission = checkPermission;
_CodingRepo = codingRepo;
_invoiceStatusChangPaymentRepo = invoiceStatusChangPaymentRepo;
_checkPermission = checkPermission;
}
public async Task<List<Coding>> GetCodingPMT()
{
return await _CodingRepo.Get(w => w.FildID == 71).ToListAsync();
@@ -65,6 +70,7 @@ namespace Back.Services
tbill = item.tbill,
Des = item.Des,
PreparedtoSendtoTax = item.PreparedtoSendtoTax,
HasaRemittance= await _remittanceService.HasaRemittance(ID),
tdis = item.tdis,
tvam = item.tvam,
Udate = item.Udate.ShamciToFormatShamci(),

View File

@@ -4,7 +4,6 @@ using Back.Data.Infrastructure.Repository;
using Back.Data.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.IdentityModel.Tokens;
using Org.BouncyCastle.Crypto.Tls;
using Shared.DTOs;
using System.ComponentModel.Design;
using System.Data.SqlTypes;

View File

@@ -37,9 +37,13 @@ namespace Back.Validations
if (!servCOD.ExistCodByCompanyID(model.Item3.CODID, model.Item1).Result)
context.AddFailure("کالا یافت نشد");
}
else context.AddFailure("کالا صحیح نمی باشد");
if (!model.Item3.vra.HasValue)
context.AddFailure("نرخ مالیات را وارد کنید");
});
RuleFor(r => r.Item3.am)
.NotEmpty().WithMessage("تعداد مشخص نشده")

View File

@@ -5,7 +5,6 @@ using Back.Services;
using FluentValidation;
using Microsoft.EntityFrameworkCore;
using Shared.DTOs;
using TaxCollectData.Library.Dto.Content;
namespace Back.Validations
{

View File

@@ -1,9 +1,8 @@
using FluentValidation;
using TaxCollectData.Library.Dto.Content;
namespace Back.Validations
{
public class TaxSystemRules : AbstractValidator<Tuple<InvoiceHeaderDto, List<InvoiceBodyDto>, PaymentDto>>
{
}
//public class TaxSystemRules : AbstractValidator<Tuple<InvoiceHeaderDto, List<InvoiceBodyDto>, PaymentDto>>
//{
//}
}

View File

@@ -1,9 +1,9 @@
using Back.Data.Contracts;
using FluentValidation;
using Shared.DTOs.Warehouse;
using Net.Pkcs11Interop.Common;
using Back.Services;
using Back.Data.Models;
using Back.Common;
namespace Back.Validations.Warehouse.Receipt
{
@@ -16,7 +16,7 @@ namespace Back.Validations.Warehouse.Receipt
RuleFor(model => model)
.Custom((model, context) => {
if (servCOD.ExistCodByCompanyID(model.Item1.CODID, model.Item2).Result)
if (!servCOD.ExistCodByCompanyID(model.Item1.CODID, model.Item2).Result)
context.AddFailure("کد کالا یافت نشد");
});
@@ -33,6 +33,21 @@ namespace Back.Validations.Warehouse.Receipt
context.AddFailure("توضیحی برای رسید در نظر بگیرید");
});
RuleFor(r => r.Item1.Date)
.Custom((InvoiceDate, context) =>
{
if (string.IsNullOrEmpty(InvoiceDate))
context.AddFailure("تاریخ نمی تواند خالی باشد");
else if (InvoiceDate.Length != 8)
context.AddFailure("تاریخ صحیح نمی باشد");
else if (InvoiceDate.Trim().ToMiladi() > DateTime.Now)
context.AddFailure("تاریخ از امروز جلوتر باشد");
});
RuleFor(r => r.Item2)
.Custom((CompanyID, context) =>
{

View File

@@ -1,4 +1,5 @@
using Back.Data.Contracts;
using Back.Common;
using Back.Data.Contracts;
using Back.Services;
using Back.Services.Warehouse;
using FluentValidation;
@@ -13,6 +14,18 @@ namespace Back.Validations.Warehouse.Receipt
public UpdateValidation(IAsyncRepository<Back.Data.Models.Warehouse.Receipt> _ReceiptRepo, ServCOD servCOD, WarehouseService warehouseService)
{
CascadeMode = CascadeMode.Stop;
RuleFor(r => r.Item1.Date)
.Custom((InvoiceDate, context) =>
{
if (string.IsNullOrEmpty(InvoiceDate))
context.AddFailure("تاریخ نمی تواند خالی باشد");
else if (InvoiceDate.Length != 8)
context.AddFailure("تاریخ صحیح نمی باشد");
else if (InvoiceDate.Trim().ToMiladi() > DateTime.Now)
context.AddFailure("تاریخ از امروز جلوتر باشد");
});
RuleFor(model => model)
.Custom((model, context) =>
{
@@ -26,17 +39,11 @@ namespace Back.Validations.Warehouse.Receipt
context.AddFailure("رسید یافت نشد");
else
{
if (ORGitem.CODID != model.Item1.CODID)
{
if (servCOD.ExistCodByCompanyID(model.Item1.CODID, model.Item2).Result)
context.AddFailure("کد کالا یافت نشد");
}
else
{
if (ORGitem.CODID != model.Item1.CODID)
{
context.AddFailure("در رسید امکان ویرایش کالا انکان پذیر نیست");
context.AddFailure("در رسید امکان ویرایش کالا امکان پذیر نیست");
}
else
{
@@ -69,7 +76,7 @@ namespace Back.Validations.Warehouse.Receipt
}
}
}
});

View File

@@ -1,4 +1,5 @@
using Back.Services;
using Back.Common;
using Back.Services;
using Back.Services.Warehouse;
using FluentValidation;
using Shared.DTOs.Warehouse;
@@ -11,10 +12,23 @@ namespace Back.Validations.Warehouse.Remittance
{
CascadeMode = CascadeMode.Stop;
RuleFor(r => r.Item1.Date)
.Custom((InvoiceDate, context) =>
{
if (string.IsNullOrEmpty(InvoiceDate))
context.AddFailure("تاریخ نمی تواند خالی باشد");
else if (InvoiceDate.Length != 8)
context.AddFailure("تاریخ صحیح نمی باشد");
else if (InvoiceDate.Trim().ToMiladi() > DateTime.Now)
context.AddFailure("تاریخ از امروز جلوتر باشد");
});
RuleFor(model => model)
.Custom((model, context) =>
{
if (servCOD.ExistCodByCompanyID(model.Item1.CODID, model.Item2).Result)
if (!servCOD.ExistCodByCompanyID(model.Item1.CODID, model.Item2).Result)
context.AddFailure("کد کالا یافت نشد");
});

View File

@@ -4,6 +4,7 @@ using Back.Services;
using FluentValidation;
using Shared.DTOs.Warehouse;
using Microsoft.EntityFrameworkCore;
using Back.Common;
namespace Back.Validations.Warehouse.Remittance
{
@@ -12,6 +13,20 @@ namespace Back.Validations.Warehouse.Remittance
public UpdateValidation(IAsyncRepository<Back.Data.Models.Warehouse.Remittance> _Repo, ServCOD servCOD, WarehouseService warehouseService)
{
CascadeMode = CascadeMode.Stop;
RuleFor(r => r.Item1.Date)
.Custom((InvoiceDate, context) =>
{
if (string.IsNullOrEmpty(InvoiceDate))
context.AddFailure("تاریخ نمی تواند خالی باشد");
else if (InvoiceDate.Length != 8)
context.AddFailure("تاریخ صحیح نمی باشد");
else if (InvoiceDate.Trim().ToMiladi() > DateTime.Now)
context.AddFailure("تاریخ از امروز جلوتر باشد");
});
RuleFor(model => model)
.Custom((model, context) => {
var ORGitem = _Repo.Get(w => w.ID == model.Item1.ID && !w.Deleted).Include(i => i.cODItem).FirstOrDefault();
@@ -27,7 +42,7 @@ namespace Back.Validations.Warehouse.Remittance
if (ORGitem.CODID != model.Item1.CODID)
{
context.AddFailure("در حئاله امکان ویرایش کالا انکان پذیر نیست");
context.AddFailure("در حواله امکان ویرایش کالا امکان پذیر نیست");
}
else
{

View File

@@ -1,17 +0,0 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"ConnectionStrings": {
"Base": "Data Source=195.88.208.142;Initial Catalog=TaxPayer020713;User ID=sa;Password=M439610m@;TrustServerCertificate=True"
},
"Fixedvalues": {
"Jwt_Lifetime_Minutes": "144000"
},
"CreateReportFileName": "E:\\CreateReport\\CreateReport.exe",
"ReportLog": "E:\\Report\\log.txt"
}

View File

@@ -6,5 +6,14 @@
}
},
"AllowedHosts": "*",
"TaxPayerApi": "https://tp.tax.gov.ir/req/api/"
"TaxPayerApi": "https://tp.tax.gov.ir/req/api/",
"ConnectionStrings": {
"Base": "Data Source=156.255.1.229;Initial Catalog=TaxPayer020713;User ID=sa;Password=SAPassw0rd;TrustServerCertificate=True"
},
"Fixedvalues": {
"Jwt_Lifetime_Minutes": "144000"
},
"CreateReportFileName": "E:\\CreateReport\\CreateReport.exe",
"ReportLog": "E:\\Report\\log.txt"
}

View File

@@ -1,17 +0,0 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"ConnectionStrings": {
"Base": "Data Source=.;Initial Catalog=TaxPayer020713;User ID=sa;Password=M439610m@;TrustServerCertificate=True"
},
"Fixedvalues": {
"Jwt_Lifetime_Minutes": "144000"
},
"CreateReportFileName": "E:\\CreateReport\\CreateReport.exe",
"ReportLog": "E:\\Report\\log.txt"
}

View File

@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Security.Principal;
using System.Text;
using System.Threading.Tasks;
@@ -87,7 +88,7 @@ namespace Shared.DTOs
[MaxLength(10)]
[Display(Name = "سریال صورتحساب داخلی حافظه مالیاتی")]
public string? inno { get; set; }
public bool HasaRemittance { get; set; }
}
public class InvoiceItemDTO
@@ -113,7 +114,6 @@ namespace Shared.DTOs
//مبلغ قبل از تخفیف
public decimal? prdis { get; set; }
//مبلغ بعد از تخفیف
public decimal? adis { get; set; }
}

View File

@@ -11,13 +11,14 @@ namespace Shared.DTOs.Warehouse
public enum TypeCirculation
{
[Display(Name = "رسید")]
Receipt,
Receipt=10,
[Display(Name = "حواله")]
Remittance
Remittance=20
}
public class CirculationDto
{
public int ID { get; set; }
public int CODID { get; set; }
[Display(Name = "کالا")]
public string? CODTitle { get; set; }
@@ -35,5 +36,7 @@ namespace Shared.DTOs.Warehouse
public TypeCirculation Type { get; set; }
[Display(Name = "نوع سند")]
public string msgType { get { return Type.GetEnumDisplayName(); } }
public int? invoiceID { get; set; }
public DateTime CreateDt { get; set; }
}
}

View File

@@ -11,7 +11,7 @@ namespace Shared.DTOs.Warehouse
{
public int? ID { get; set; }
public int CODID { get; set; }
public string CODTitle { get; set; }
public string? CODTitle { get; set; }
public decimal Count { get; set; }
public string Date { get; set; }
public TypeRemittance Type { get; set; }

48
TaxPayerFULL.sln Normal file
View File

@@ -0,0 +1,48 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.9.34723.18
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Front", "TaxPayerFull\Front.csproj", "{0D25B253-4DAC-4D94-9BAD-C1E02F35F58B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Back", "Back\Back.csproj", "{94DE9132-9D4E-468B-9BC4-134957BF48FE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Shared", "Shared\Shared.csproj", "{07963EE9-ADA6-4A30-890B-6643BA332D3A}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "View", "View", "{25C58D68-C8E7-4623-9159-1FC010E73EEA}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "moadiran", "moadiran\moadiran.csproj", "{E209C152-76D5-469F-A969-B5BE5970CA7A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0D25B253-4DAC-4D94-9BAD-C1E02F35F58B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0D25B253-4DAC-4D94-9BAD-C1E02F35F58B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0D25B253-4DAC-4D94-9BAD-C1E02F35F58B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0D25B253-4DAC-4D94-9BAD-C1E02F35F58B}.Release|Any CPU.Build.0 = Release|Any CPU
{94DE9132-9D4E-468B-9BC4-134957BF48FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{94DE9132-9D4E-468B-9BC4-134957BF48FE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{94DE9132-9D4E-468B-9BC4-134957BF48FE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{94DE9132-9D4E-468B-9BC4-134957BF48FE}.Release|Any CPU.Build.0 = Release|Any CPU
{07963EE9-ADA6-4A30-890B-6643BA332D3A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{07963EE9-ADA6-4A30-890B-6643BA332D3A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{07963EE9-ADA6-4A30-890B-6643BA332D3A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{07963EE9-ADA6-4A30-890B-6643BA332D3A}.Release|Any CPU.Build.0 = Release|Any CPU
{E209C152-76D5-469F-A969-B5BE5970CA7A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E209C152-76D5-469F-A969-B5BE5970CA7A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E209C152-76D5-469F-A969-B5BE5970CA7A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E209C152-76D5-469F-A969-B5BE5970CA7A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{E209C152-76D5-469F-A969-B5BE5970CA7A} = {25C58D68-C8E7-4623-9159-1FC010E73EEA}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {7631EF02-9C92-4BD7-BE06-54BA375F457F}
EndGlobalSection
EndGlobal

View File

@@ -16,7 +16,7 @@
{
<ul>
@if (_SuccessfulSubmissiontoTaxPayer)
{
<li style="color:red">با این کالا صورتحسابی به سامانه مودیان ارسال کرده اید <br />نمیتوانید آن را ویرایش کنید</li>
@@ -30,7 +30,16 @@
}
<li style="color:dodgerblue">زمان ویرایش دقت کنید<br /> تغییرات میتواند روی فاکتورهای صادر شده تائیر بگذارد</li>
}
@if (InventoryValue > 0)
{
<li style="color:seagreen">موجودی کالا در انبار : @InventoryValue</li>
}
else
{
<li style="color:red">این کالا در انبار موجودی ندارد</li>
}
</ul>
}
<div class="row g-3">
@@ -38,14 +47,13 @@
<label class="col-sm-4 col-form-label" style="color:red" for="inputTitle">نام کالا</label>
@if (Cod.ID == 0 || !_UsedInTheInvoice)
{
<InputText style="text-align:center" @bind-Value="Cod.Title" type="text" class="form-control" id="inputTitle" placeholder="نام کالا"
/>
<InputText style="text-align:center" @bind-Value="Cod.Title" type="text" class="form-control" id="inputTitle" placeholder="نام کالا" />
}
else
{
<InputText style="text-align:center" @bind-Value="Cod.Title" type="text" class="form-control" id="inputTitle" placeholder="نام کالا" readonly />
}
</div>
<div class="form-group col-md-6">
<label class="col-sm-5 col-form-label" style="color:red" for="inputUnitID">واحد اندازه گیزی</label>
@@ -90,19 +98,19 @@
</div>
</div>
</form>
<div class="row g-3">
<div class="row g-3">
<div class="col-md-10">
@if (Cod.ID == 0)
{
<Button class="mt-3" Color="ButtonColor.Success" @onclick="OnClickAdd" Type="ButtonType.Button">
جدید
</Button>
}
else
{
@if (Cod.ID == 0)
{
<Button class="mt-3" Color="ButtonColor.Success" @onclick="OnClickAdd" Type="ButtonType.Button">
جدید
</Button>
}
else
{
@if (!_SuccessfulSubmissiontoTaxPayer)
{
<Button Disabled="SpinnerVisible" class="mt-3" Color="ButtonColor.Success" @onclick="OnClickUpdate" Type="ButtonType.Button">
@@ -112,19 +120,20 @@ else
حذف
</Button>
}
@if (_UsedInTheInvoice)
{
<Button Disabled="SpinnerVisible" class=" mt-3" Color="ButtonColor.Link" @onclick="OnClickGoToInvoice" Type="ButtonType.Button">
صورتحساب های مرتبط
</Button>
}
}
@if (_UsedInTheInvoice)
{
<Button Disabled="SpinnerVisible" class=" mt-3" Color="ButtonColor.Link" @onclick="OnClickGoToInvoice" Type="ButtonType.Button">
صورتحساب های مرتبط
</Button>
}
}
</div>
<div class="col-md-2" >
<div class="col-md-2">
<Spinner Visible="SpinnerVisible" Color="SpinnerColor.Primary" />
</div>
</div>
</div>
@code {
public bool SpinnerVisible { get; set; } = false;
@@ -154,6 +163,9 @@ else
alertMessage = "";
await UsedInTheInvoice();
await SuccessfulSubmissiontoTaxPayer();
// موجودی
await Inventory();
//
SpinnerVisible = false;
await base.OnParametersSetAsync();
}
@@ -165,7 +177,7 @@ else
}
public async Task UsedInTheInvoice()
{
if (Cod.ID!=0)
if (Cod.ID != 0)
{
var rsp = await hc.Get($"Cod/UsedInTheInvoice/{Cod.ID}");
if (rsp.IsSuccessStatusCode)
@@ -175,6 +187,16 @@ else
}
}
public decimal InventoryValue { get; set; } = 0;
public async Task Inventory()
{
if (Cod.ID != 0)
{
var rsp = await hc.Get($"Warehouse/Inventory/{Cod.ID}");
if (rsp.IsSuccessStatusCode)
InventoryValue = await rsp.Content.ReadFromJsonAsync<decimal>();
}
}
public async Task SuccessfulSubmissiontoTaxPayer()
{
SpinnerVisible = true;
@@ -187,7 +209,7 @@ else
else _SuccessfulSubmissiontoTaxPayer = false;
}
SpinnerVisible = false ;
SpinnerVisible = false;
}
private void ShowSuccessAlert(string msg)
{
@@ -234,7 +256,7 @@ else
SpinnerVisible = true;
if (Cod.UnitID > 0 && Cod.TaxRate >= 0 && !string.IsNullOrEmpty(Cod.Title))
{
var rsp = await hc.Put<RCOD>("Cod/Update", Cod);
if (rsp.IsSuccessStatusCode)
{
@@ -295,11 +317,11 @@ else
message2: "اطمینان دارید?");
if (confirmation)
await OnClickDelete();
await OnClickDelete();
}
}
}

View File

@@ -21,8 +21,7 @@
<select @bind="itemDTO.CODID" @bind:after="async () =>
{
await AfterAsync();
if(itemDTO.ID==null)
itemDTO.vra=cods.Where(w=>w.ID==itemDTO.CODID).Select(s=>s.Tax).FirstOrDefault();
itemDTO.vra=await GetVra(itemDTO.CODID);
}" class="form-control" aria-label="Default select example" id="inputcod">
@if (itemDTO.CODID > 0)
{
@@ -54,7 +53,7 @@
</div>
<div class="form-group col-md-3">
<label class="col-sm-6 col-form-label">نرخ مالیات</label>
<InputNumber @bind-Value="itemDTO.vra" type="text" class="form-control" id="inputvra" placeholder="نرخ مالیات" readonly />
<InputNumber @bind-Value="itemDTO.vra" type="text" class="form-control" id="inputvra" placeholder="نرخ مالیات" />
</div>
<div class="form-group col-md-4">
<label class="col-sm-4 col-form-label" style="color:red" for="inputFullName">تعداد</label>
@@ -98,24 +97,24 @@
</div>
</form>
<div class="row g-3">
<div class="row g-3">
<div class="col-md-10">
@if (itemDTO.ID == null)
{
<Button Disabled="SpinnerVisible" class="mt-3" Color="ButtonColor.Success" @onclick="OnClickAdd" Type="ButtonType.Button">
جدید
</Button>
}
else
{
<Button Disabled="SpinnerVisible" class="mt-3" Color="ButtonColor.Success" @onclick="OnClickUpdate" Type="ButtonType.Button">
ثبت تغییرات
</Button>
<Button Disabled="SpinnerVisible" class="mt-3" Color="ButtonColor.Danger" @onclick="ShowConfirmationDeleteAsync" Type="ButtonType.Button">
حذف
</Button>
}
</div>
@if (itemDTO.ID == null)
{
<Button Disabled="SpinnerVisible" class="mt-3" Color="ButtonColor.Success" @onclick="OnClickAdd" Type="ButtonType.Button">
جدید
</Button>
}
else
{
<Button Disabled="SpinnerVisible" class="mt-3" Color="ButtonColor.Success" @onclick="OnClickUpdate" Type="ButtonType.Button">
ثبت تغییرات
</Button>
<Button Disabled="SpinnerVisible" class="mt-3" Color="ButtonColor.Danger" @onclick="ShowConfirmationDeleteAsync" Type="ButtonType.Button">
حذف
</Button>
}
</div>
<div class="col-md-2">
<Spinner Visible="SpinnerVisible" Color="SpinnerColor.Primary" />
</div>
@@ -146,7 +145,8 @@ else
protected override async Task OnParametersSetAsync()
{
SpinnerVisible = false;
if (!itemDTO.ID.HasValue)
itemDTO.vra = 0;
result = new ActionInResultComponent()
{
Status = ComponentStatus.fild
@@ -157,9 +157,9 @@ else
}
}
@functions {
private void ShowMessage(ToastType toastType,string msg) => messages.Add(CreateToastMessage(toastType,msg));
private void ShowMessage(ToastType toastType, string msg) => messages.Add(CreateToastMessage(toastType, msg));
private ToastMessage CreateToastMessage(ToastType toastType,string msg)
private ToastMessage CreateToastMessage(ToastType toastType, string msg)
=> new ToastMessage
{
Type = toastType,
@@ -172,6 +172,16 @@ else
alertIconName = IconName.CheckCircleFill;
alertMessage = msg;
}
private async Task<decimal> GetVra(int CODID)
{
var rsp = await hc.Get($"COD/GetVra/{CODID}");
if (rsp.IsSuccessStatusCode)
{
return await rsp.Content.ReadFromJsonAsync<decimal>();
}
return 0;
}
private void ShowDangerAlert(string msg)
{
Hidealert = false;
@@ -266,10 +276,10 @@ else
}
var rsp = await hc.Put<InvoiceItemAction<InvoiceItemDTO>>($"InvoiceItem/UpdateItem"
, new InvoiceItemAction<InvoiceItemDTO>
{
invoiceID=InvoiceID,
{
invoiceID = InvoiceID,
item = itemDTO
});
});
if (rsp.IsSuccessStatusCode)
{
var request = await rsp.Content.ReadFromJsonAsync<bool>();

View File

@@ -118,6 +118,24 @@
</td>
</tr>
}
if (Selected.promotionDetails.Any(w => w.PermissionID == 18))
{
<tr>
<td>@Selected.promotionDetails.Where(w => w.PermissionID == 18).Select(s => s.PermissionTitle).FirstOrDefault()</td>
<td>@Selected.promotionDetails.Where(w => w.PermissionID == 18).Select(s => s.APrice).FirstOrDefault().ToString("N0") ريال</td>
<td>
@if (Selected.ID < 0)
{
<InputNumber @bind-Value="values[4]" @bind-Value:after="OnInput" type="text" class="form-control" id="inputax" style="text-align:center;" placeholder="تعداد" />
}
else
{
<input value="@Selected.promotionDetails.Where(w => w.PermissionID == 18).Select(s => s.CreditAmount).FirstOrDefault()" style="text-align:center;" class="form-control" type="text" readonly>
}
</td>
</tr>
}
}
</tbody>
@@ -154,7 +172,7 @@
public List<PromotionDto> Promotions { get; set; } = new();
public PromotionDto? Selected { get; set; } = null;
// invoice cod cus tax
int[] values = { 0,0,0,0};
int[] values = { 0,0,0,0,0};
decimal TotalPrice = 0;
}
@functions {
@@ -176,7 +194,7 @@
{
orderSelectName = "نوع سفارش";
Selected = null;
values =new int[] { 0,0,0,0};
values =new int[] { 0,0,0,0,0};
TotalPrice = 0;
Promotions = await fv.GetPromotion();
orderstype = new List<IdName<int>>();
@@ -220,6 +238,10 @@
if (itemtax != null)
itemtax.CreditAmount = values[3];
var itemwarehouse = Selected.promotionDetails.Where(w => w.PermissionID == 18).FirstOrDefault();
if (itemwarehouse != null)
itemwarehouse.CreditAmount = values[4];
TotalPrice = Selected.TotalPrice;
}
@@ -230,8 +252,8 @@
SpinnerVisible = true;
if (Selected != null)
{
if (Selected.ID < 0 && (values[0] < 0 || values[1] < 0 || values[2] < 0 || values[3] < 0)) return;
if (Selected.ID < 0 && values[0] == 0 && values[1] == 0 && values[2] == 0 && values[3] == 0) return;
if (Selected.ID < 0 && (values[0] < 0 || values[1] < 0 || values[2] < 0 || values[3] < 0 || values[4] < 0)) return;
if (Selected.ID < 0 && values[0] == 0 && values[1] == 0 && values[2] == 0 && values[3] == 0 && values[4] == 0) return;
//---------
var itemFac = Selected.promotionDetails.Where(w => w.PermissionID == 3).FirstOrDefault();
@@ -249,6 +271,10 @@
var itemtax = Selected.promotionDetails.Where(w => w.PermissionID == 16).FirstOrDefault();
if (itemtax != null)
itemtax.CreditAmount = values[3];
var itemwarehouse = Selected.promotionDetails.Where(w => w.PermissionID == 18).FirstOrDefault();
if (itemwarehouse != null)
itemwarehouse.CreditAmount = values[4];
//---------
var rsp = await hc.Post<PromotionDto>($"Orders/AddOrder", Selected);
if (rsp.IsSuccessStatusCode)

View File

@@ -0,0 +1,355 @@
@using Front.Services
@using Shared
@using Shared.DTOs
@using Shared.DTOs.Warehouse
@using Shared.Enums
@inject HttpClientController hc;
<ConfirmDialog @ref="dialog" />
<form>
@* alert *@
<div class="row">
<Alert hidden="@Hidealert" Color="@alertColor" Dismissable="false">
<Icon Name="@alertIconName" class="me-2"></Icon>
@alertMessage
</Alert>
</div>
@if (_UsedFromInvoice)
{
<ul>
<li style="color:red"> این سند از فاکتور صادر شده، ویرایش مستقیم آن ممکن نیست</li>
<br />
</ul>
}
<div class="row g-3">
<div class="form-group col-md-6">
<label class="col-sm-4 col-form-label" style="color:red" for="inputFullName">کالا</label>
<AutoComplete @bind-Value="model.CODTitle"
TItem="CODIdName<int>"
DataProvider="CODDataProvider"
PropertyName="Title"
Placeholder="جستجو در کالا..."
Disabled="!NewItem"
OnChanged="(CODIdName<int> cod) => OnAutoCompleteChanged(cod)" />
</div>
<div class="form-group col-md-3">
<label class="col-sm-4 col-form-label" style="color:red">مقدار</label>
<InputNumber @bind-Value="model.Count" style="text-align:center" type="text" class="form-control" placeholder="مقدار" />
</div>
<div class="form-group col-md-3">
<label class="col-sm-5 col-form-label" for="inputInvoicIssueDate">تاریخ</label>
<InputText style=" text-align: center;" @bind-Value="model.Date" type="text" class="form-control" id="inputInvoicIssueDate" placeholder="تاریخ" />
</div>
</div>
<div class="row g-3">
<div class="col-md-4">
<label class="col-sm-4 col-form-label" style="color:red">نوع سند</label>
<select style="text-align:center" @bind="model.ModelTypeID" class="form-control" aria-label="Default select example">
<option value="0" style="color: #b5b5b5" selected>نوع سند ...</option>
@if (model.Type == TypeCirculation.Receipt)
{
<option value="1">خرید</option>
<option value="2">امانت</option>
}
@if (model.Type == TypeCirculation.Remittance)
{
<option value="3">فروش</option>
<option value="4">امانت</option>
}
</select>
</div>
<div class="form-group col-md-8">
<label class="col-form-label" for="inputdes">توضیحات</label>
<InputText @bind-Value="model.info" type="text" class="form-control" id="inputdes" placeholder="توضیحات" />
</div>
</div>
@* <div class="col-md-2">
<select style="text-align:center" @bind="Doctype" class="form-control" aria-label="Default select example">
<option value="0" style="color: #b5b5b5" selected>نوع ...</option>
<option value="10">رسید</option>
<option value="20">حواله</option>
</select>
</div> *@
@if (model.Type == TypeCirculation.Receipt)
{
<div class="row g-3">
<div class="form-group col-md-4" style="margin-top:30px">
<Switch @bind-Value="forsale" Label="اجازه فروش" />
</div>
</div>
}
</form>
<div class="row g-3">
<div class="col-md-10">
@if (NewItem)
{
<Button class="mt-3" Color="ButtonColor.Success" @onclick="OnClickAddOrUpdate" Type="ButtonType.Button">
جدید
</Button>
}
else
{
@if (!_UsedFromInvoice)
{
<Button Disabled="SpinnerVisible" class="mt-3" Color="ButtonColor.Success" @onclick="OnClickAddOrUpdate" Type="ButtonType.Button">
ثبت تغییرات
</Button>
<Button Disabled="SpinnerVisible" class=" mt-3" Color="ButtonColor.Danger" @onclick="ShowConfirmationDeleteAsync" Type="ButtonType.Button">
حذف
</Button>
}
}
</div>
<div class="col-md-2">
<Spinner Visible="SpinnerVisible" Color="SpinnerColor.Primary" />
</div>
</div>
@code {
[Parameter] public CirculationDto model { get; set; }
[Parameter] public EventCallback<ActionInResultComponent> OnMultipleOfThree { get; set; }
[Parameter] public bool NewItem { get; set; }
[Parameter] public List<CODIdName<int>> CODrequest { get; set; }
private ConfirmDialog dialog = default!;
AlertColor alertColor = AlertColor.Primary;
IconName alertIconName = IconName.CheckCircleFill;
bool Hidealert = true;
string alertMessage = "";
bool _UsedFromInvoice = false;
public bool SpinnerVisible { get; set; } = false;
private bool forsale { get; set; } = true;
}
@functions {
protected override async Task OnParametersSetAsync()
{
if (NewItem)
forsale = true;
else
forsale = model.ForSale.HasValue ? model.ForSale.Value : false;
_UsedFromInvoice = model.invoiceID.HasValue;
if (NewItem)
model.Date = DateTime.Now.ConvertMiladiToShamsiinFront().ShamciToFormatShamciinFront();
await base.OnParametersSetAsync();
}
private void ShowSuccessAlert(string msg)
{
Hidealert = false;
alertColor = AlertColor.Success;
alertIconName = IconName.CheckCircleFill;
alertMessage = msg;
}
private void ShowDangerAlert(string msg)
{
Hidealert = false;
alertColor = AlertColor.Danger;
alertIconName = IconName.ExclamationTriangleFill;
alertMessage = msg;
}
public async Task OnClickDelete()
{
if (NewItem)
return;
SpinnerVisible = true;
await Delete();
SpinnerVisible = false;
}
private async Task Delete()
{
string route = model.Type == TypeCirculation.Receipt ? "Receipt" : "Remittance";
var rsp = await hc.Delete($"{route}/{model.ID}");
if (rsp.IsSuccessStatusCode)
{
ActionInResultComponent result = new ActionInResultComponent();
result.Status = ComponentStatus.success;
result.Action = ComponentAction.delete;
await OnMultipleOfThree.InvokeAsync(result);
}
else if (rsp.StatusCode == System.Net.HttpStatusCode.NotFound)
{
ShowDangerAlert("سندی یافت نشد");
}
else ShowDangerAlert("خطایی در اجرای عملیات رخ داده");
}
private async Task Addorupdate()
{
if ((model.Type == TypeCirculation.Receipt && !await ValidateReceipt())
|| (model.Type == TypeCirculation.Remittance && !await ValidateRemittance()))
return;
string controller = model.Type == TypeCirculation.Receipt ? "Receipt" : "Remittance";
string route = NewItem ? "ADD" : "Update";
ActionInResultComponent result = new ActionInResultComponent();
HttpResponseMessage rsp = new HttpResponseMessage();
if (NewItem)
{
if (model.Type == TypeCirculation.Receipt)
rsp = await hc.Post($"{controller}/{route}", new ReceiptDto()
{
CODID = model.CODID,
Count = model.Count,
Date = model.Date,
ForSale = model.ForSale.Value,
info = model.info,
Type = (TypeReceipt)model.ModelTypeID,
});
if (model.Type == TypeCirculation.Remittance)
rsp = await hc.Post($"{controller}/{route}", new RemittanceDto()
{
CODID = model.CODID,
Count = model.Count,
Date = model.Date,
info = model.info,
Type = (TypeRemittance)model.ModelTypeID,
});
result.Action = ComponentAction.add;
}
else
{
if (model.Type == TypeCirculation.Receipt)
rsp = await hc.Put($"{controller}/{route}", new ReceiptDto()
{
ID = model.ID,
CODID = model.CODID,
Count = model.Count,
Date = model.Date,
ForSale = model.ForSale.Value,
info = model.info,
Type = (TypeReceipt)model.ModelTypeID,
});
if (model.Type == TypeCirculation.Remittance)
rsp = await hc.Put($"{controller}/{route}", new RemittanceDto()
{
ID = model.ID,
CODID = model.CODID,
Count = model.Count,
Date = model.Date,
info = model.info,
Type = (TypeRemittance)model.ModelTypeID,
});
result.Action = ComponentAction.update;
}
if (rsp.IsSuccessStatusCode)
{
result.Status = ComponentStatus.success;
await OnMultipleOfThree.InvokeAsync(result);
}
else
{
try
{
var request = await rsp.Content.ReadFromJsonAsync<List<string>>();
ShowDangerAlert(request[0]);
}
catch (Exception)
{
ShowDangerAlert("حظای سیستمی");
}
}
}
public async Task OnClickAddOrUpdate()
{
SpinnerVisible = true;
await Addorupdate();
SpinnerVisible = false;
}
private async Task ShowConfirmationDeleteAsync()
{
if (!NewItem)
{
var confirmation = await dialog.ShowAsync(
title: "عملیات حذف سند انبار",
message1: $"{model.info}",
message2: "اطمینان دارید?");
if (confirmation)
await OnClickDelete();
}
}
private async Task<bool> ValidateRemittance()
{
if (model.Type == TypeCirculation.Remittance)
{
if (model.ModelTypeID != 3 && model.ModelTypeID != 4)
ShowDangerAlert("نوع سند صحیح نمی باشد");
else return await Validate();
}
return false;
}
private async Task<bool> ValidateReceipt()
{
if (model.Type == TypeCirculation.Receipt)
{
model.ForSale = forsale;
if (model.ModelTypeID != 1 && model.ModelTypeID != 2)
ShowDangerAlert("نوع سند صحیح نمی باشد");
else return await Validate();
}
return false;
}
private async Task<bool> Validate()
{
if (model.CODID == null || model.CODID == 0)
ShowDangerAlert("کالایی انتخاب کنید");
else if (model.Count <= 0)
ShowDangerAlert("تعدادی وارد کنید");
else if (string.IsNullOrEmpty(model.Date))
ShowDangerAlert("تاریخ را مشخص کنید");
else if (model.Date.Replace("/", "").Length != 8)
ShowDangerAlert("تاریخ صحیح نمی باشد");
else if (string.IsNullOrEmpty(model.info))
ShowDangerAlert("توضیحی مشخص کنید");
else return true;
return false;
}
private async Task<AutoCompleteDataProviderResult<CODIdName<int>>> CODDataProvider(AutoCompleteDataProviderRequest<CODIdName<int>> request)
{
return await Task.FromResult(request.ApplyTo(CODrequest.OrderBy(cod => cod.ID)));
}
private void OnAutoCompleteChanged(CODIdName<int> cOD)
{
model.CODID = cOD.ID;
}
}

View File

@@ -0,0 +1,10 @@
 from run E:\TaxPayerFULL
docker build -f TaxPayerFULL\Dockerfile -t app_moadiran .
docker run --name app_moadiran -d -p 82:5107 app_moadiran
--------------------------------------------------------------------------------------------
in local => docker build -f TaxPayerFULL\Dockerfile -t mmrbnjd/app_moadiran:latest .
in local => docker push mmrbnjd/app_moadiran:latest
in server => docker pull mmrbnjd/app_moadiran:latest
in server => docker run -d -p 3102:5107 --restart always mmrbnjd/app_moadiran:latest

77
TaxPayerFull/Dockerfile Normal file
View File

@@ -0,0 +1,77 @@
# مرحله ۱: Build با caching بهتر
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
WORKDIR /src
# نصب dependencyها (apt-get) در یک layer
RUN apt-get update && apt-get install -y python3 make cmake clang zlib1g-dev \
&& rm -rf /var/lib/apt/lists/*
# کپی csprojها جداگانه برای cache بهتر
COPY TaxPayerFull/Front.csproj Front/
COPY Shared/Shared.csproj Shared/
# نصب wasm-tools (فقط اگر تغییر کند cache می‌ماند)
RUN dotnet workload install wasm-tools
# restore تنها بر اساس csprojها
RUN dotnet restore Front/Front.csproj
# کپی باقی پروژه
COPY TaxPayerFull/. TaxPayerFull/
COPY Shared/. Shared/
# انتشار Blazor WASM
RUN dotnet publish "TaxPayerFull/Front.csproj" -c Release -o /app \
-p:TreatWarningsAsErrors=false \
-p:RunAOTCompilation=false \
-p:PublishTrimmed=false
# مرحله ۲: Nginx
FROM nginx:alpine AS final
WORKDIR /usr/share/nginx/html
RUN rm -rf ./*
COPY --from=build /app/wwwroot ./
# کانفیگ Nginx
RUN printf 'server {\n\
listen 5107;\n\
server_name localhost;\n\
root /usr/share/nginx/html;\n\
index index.html;\n\
\n\
location / {\n\
try_files $uri $uri/ /index.html;\n\
}\n\
\n\
location /_framework/ {\n\
expires 1y;\n\
add_header Cache-Control "public, immutable";\n\
}\n\
location /_content/ {\n\
expires 1y;\n\
add_header Cache-Control "public, immutable";\n\
}\n\
location /assets/ {\n\
expires 7d;\n\
add_header Cache-Control "public";\n\
}\n\
location /css/ { expires 7d; add_header Cache-Control "public"; }\n\
location /fonts/ { expires 7d; add_header Cache-Control "public"; }\n\
location /img/ { expires 7d; add_header Cache-Control "public"; }\n\
location /js/ { expires 7d; add_header Cache-Control "public"; }\n\
\n\
location ~ \\.dll$ { add_header Content-Type application/octet-stream; }\n\
location ~ \\.wasm$ { add_header Content-Type application/wasm; }\n\
location ~ \\.pdb$ { add_header Content-Type application/octet-stream; }\n\
location ~ \\.dat$ { add_header Content-Type application/octet-stream; }\n\
\n\
gzip on;\n\
gzip_types text/plain application/xml text/css application/javascript application/json application/wasm;\n\
gzip_min_length 256;\n\
\n\
error_page 404 /index.html;\n\
}' > /etc/nginx/conf.d/default.conf
EXPOSE 5107
CMD ["nginx", "-g", "daemon off;"]

View File

@@ -169,7 +169,7 @@ namespace Front
}
public async Task SetUlr(string Type)
{
await _hc.Post<UlrDto>("Base/Ulr", new UlrDto { Type = Type });
// await _hc.Post<UlrDto>("Base/Ulr", new UlrDto { Type = Type });

View File

@@ -1,6 +1,7 @@
@using System.Reflection
@using System.ComponentModel.DataAnnotations
@using Shared.DTOs
@using Shared.DTOs.Warehouse
@typeparam T
<div class="row">
@@ -44,12 +45,61 @@
if (property.CustomAttributes.Any(w => w.AttributeType.Name == "DisplayAttribute"))
{
if (property.PropertyType == typeof(Nullable<System.Decimal>) || property.PropertyType == typeof(System.Decimal))
if (property.PropertyType == typeof(Nullable<System.Decimal>)
|| property.PropertyType == typeof(System.Decimal) && item.ToString() != "Shared.DTOs.Warehouse.CirculationDto")
{
<td>
@decimal.Parse(property.GetValue(item, null).ToString()).ToString("N0") ريال
</td>
}
else if (property.PropertyType == typeof(Nullable<System.Boolean>)
|| property.PropertyType == typeof(System.Boolean))
{
var res = property.GetValue(item, null);
if (res == null)
{
<td>
...
</td>
}
else
{
if (res.ToString().ToLower()=="true")
{
<td>
دارد
</td>
}
else
{
<td>
ندارد
</td>
}
}
}
else if (property.Name.ToLower() == "msgtype" && item.ToString() == "Shared.DTOs.Warehouse.CirculationDto")
{
var convertmodel = (CirculationDto)Convert.ChangeType(item, typeof(CirculationDto));
switch (convertmodel.Type)
{
case TypeCirculation.Receipt:
<td style="background-color:#ffab00">@property.GetValue(item, null)</td>
break;
case TypeCirculation.Remittance:
<td style="background-color:#66c732">@property.GetValue(item, null)</td>
break;
default:
<td>@property.GetValue(item, null)</td>
break;
}
}
else if (property.Name.ToLower() == "id" && item.ToString() != "Shared.DTOs.SentTaxDto")
{
if (id > 0)

File diff suppressed because one or more lines are too long

View File

@@ -1,5 +1,6 @@
<PageTitle>انبارداری</PageTitle>
@page "/Warehouse"
@using Front.CUSComponent
@using Front.Services
@using Shared.DTOs
@using Shared.DTOs.Warehouse
@@ -11,7 +12,7 @@
@* search *@
<div class="row">
<h4 class="fw-bold py-3 mb-4">
<span class="text-muted fw-light">سرویس ها /</span> مشتری
<span class="text-muted fw-light">سرویس ها /</span> انبارداری
</h4>
<div class="col-md-12">
<div class="card mb-2">
@@ -20,7 +21,7 @@
<ul class="list-group fa-padding" style="border: 2px solid #0d6efd">
<li class="list-group-item" data-toggle="modal" data-target="#issue">
<div class="row g-3">
=
=
<div class="col-md-2">
<input @bind-value="date" placeholder="تاریخ" style="text-align:center" dir="ltr" class="form-control" type="number">
</div>
@@ -55,20 +56,23 @@
@* action *@
<div class="row">
<div class="col-md-12">
<div class="mb-2">
<div class="row">
<div class="col-md-12">
<ul class="list-group fa-padding" >
<li class="list-group-item" data-toggle="modal" data-target="#issue">
<div class="row g-3">
<div class="col-auto">
<Button Disabled="SpinnerVisible" Type="ButtonType.Submit" Color="ButtonColor.Primary" @onclick="()=>Item(new CirculationDto(){Type=TypeCirculation.Receipt})">رسید جدید</Button>
<Button Disabled="SpinnerVisible" Type="ButtonType.Submit" Color="ButtonColor.Warning" @onclick="()=>Item(new CirculationDto(){Type=TypeCirculation.Receipt})">رسید جدید</Button>
</div>
<div class="col-auto">
<Button Disabled="SpinnerVisible" Type="ButtonType.Submit" Color="ButtonColor.Primary" @onclick="()=>Item(new CirculationDto(){Type=TypeCirculation.Remittance})">حواله جدید</Button>
<div class="col-auto" >
<Button Disabled="SpinnerVisible" Type="ButtonType.Submit" Color="ButtonColor.Success" @onclick="()=>Item(new CirculationDto(){Type=TypeCirculation.Remittance})">حواله جدید</Button>
</div>
</div>
</div>
</div>
</li>
</ul>
</div>
</div>
@* alert *@
<div class="row">
<Alert hidden="@Hidealert" Color="@alertColor" Dismissable="false">
@@ -157,7 +161,15 @@
string query = "";
if (!string.IsNullOrEmpty(date))
query = $"date={date}&";
{
if (date.Replace("/","").Length==10)
query = $"date={date}&";
else
{
ShowDangerAlert("تاریخ صحیح نمی باشد");
return;
}
}
if (CODID != null && CODID != 0)
query += $"CODID={CODID}&";
@@ -183,44 +195,42 @@
}
public async Task CallBackItem(ActionInResultComponent result)
{
if (result.Status == ComponentStatus.success && result.Action==ComponentAction.delete)
ShowSuccessAlert("حذف با موفقیت انجام شد");
if (result.Status == ComponentStatus.success && result.Action == ComponentAction.update)
ShowSuccessAlert("ویرایش با موفقیت انجام شد");
if (result.Status == ComponentStatus.success && result.Action == ComponentAction.add)
ShowSuccessAlert("سند جدید اضافه شد");
if (result.Status==ComponentStatus.success)
{
await Load(1);
await modal.HideAsync();
}
}
public async Task Item(CirculationDto circulationDto)
{
//رسید
string title = "";
//رسید
if (circulationDto.Type == TypeCirculation.Receipt)
{
//جدید
if (circulationDto.CODID==0)
{
}
else
{
}
}
//حواله
title = "رسید";
//حواله
if (circulationDto.Type == TypeCirculation.Remittance)
{
//جدید
if (circulationDto.CODID == 0)
{
title = "حواله";
}
else
{
}
}
// var parameters = new Dictionary<string, object>();
if (circulationDto.CODID == 0)
title += " جدید";
else title = "اطلاعات " + title;
var parameters = new Dictionary<string, object>();
// if (ID == 0) parameters.Add("Cus", new RCustomer() { ID = 0 });
// else parameters.Add("Cus", request.list.Where(w => w.ID == ID).First().Clone());
// parameters.Add("OnMultipleOfThree", EventCallback.Factory.Create<ActionInResultComponent>(this, CallBackCustomerItem));
// await modal.ShowAsync<CustomerItem>(title: ID == 0 ? "مشتری جدید" : "ویرایش اطلاعات", parameters: parameters);
parameters.Add("OnMultipleOfThree", EventCallback.Factory.Create<ActionInResultComponent>(this, CallBackItem));
parameters.Add("model", circulationDto);
parameters.Add("NewItem", circulationDto.CODID == 0);
parameters.Add("CODrequest", CODrequest);
await modal.ShowAsync<WarehouseItem>(title: title, parameters: parameters);
}

View File

@@ -31,16 +31,17 @@ builder.Services.AddScoped(sp => new UserAuthenticationDTO()
enterDate =new DateTime(),
exitDate = new DateTime(),
}) ;
string BaseAddress = builder.Configuration.GetSection("BaseAddress").Value;
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(BaseAddress) });
// Server
//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://195.88.208.142:7075/api/") });
//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("https://moadiran.ir:444/api/") });
//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://156.255.1.229:3101:444/api/") });
//Home
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://localhost:5271/api/") });
//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://localhost:5271/api/") });
//farzan
//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://localhost:5271/api/") });
//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("https://localhost:7075/api/") });
CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("fa-Ir");

21
TaxPayerFull/default.conf Normal file
View File

@@ -0,0 +1,21 @@
server {
listen 8084;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
location ~* \.(?:ico|css|js|gif|jpe?g|png|woff2?|eot|ttf|svg)$ {
expires 6M;
access_log off;
add_header Cache-Control "public";
}
location = /index.html {
add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0";
}
}

12
TaxPayerFull/nginx.conf Normal file
View File

@@ -0,0 +1,12 @@
worker_processes 1;
events { worker_connections 1024; }
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
}

View File

@@ -0,0 +1,10 @@
{
"BaseAddress": "https://service.moadiran.ir/api/",
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}

View File

@@ -37,7 +37,15 @@
<a class="dismiss">🗙</a>
</div>
<script src="_framework/blazor.webassembly.js"></script>
<script>navigator.serviceWorker.register('service-worker.js');</script>
<script>
if ('serviceWorker' in navigator) {
window.addEventListener('load', () => {
navigator.serviceWorker.register('/service-worker.js')
.then(reg => console.log('Service Worker registered', reg))
.catch(err => console.error('Service Worker registration failed:', err));
});
}
</script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
<!-- Add chart.js reference if chart components are used in your application. -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/4.0.1/chart.umd.js" integrity="sha512-gQhCDsnnnUfaRzD8k1L5llCCV6O9HN09zClIzzeJ8OJ9MpGmIlCxm+pdCkqTwqJ4JcjbojFr79rl2F1mzcoLMQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>

48
docker-compose.yml Normal file
View File

@@ -0,0 +1,48 @@
version: '3.9'
services:
webapi:
build:
context: .
dockerfile: back/Dockerfile
image: moadiran.webapi:latest
container_name: moadiran-webapi
environment:
- ASPNETCORE_ENVIRONMENT=Production
ports:
- "1013:8080"
# networks:
# - moadirannet
land:
build:
context: .
dockerfile: moadiran/Dockerfile
image: moadiran.land:latest
container_name: moadiran-land
environment:
- ASPNETCORE_ENVIRONMENT=Production
ports:
- "81:7050"
depends_on:
- webapi
# networks:
# - moadirannet
webapp:
build:
context: .
dockerfile: TaxPayerFull/Dockerfile
image: moadiran.webapp:latest
container_name: moadiran-webapp
ports:
- "82:5107"
depends_on:
- webapi
# networks:
# - moadirannet

View File

@@ -0,0 +1,5 @@
{
"version": 1,
"isRoot": true,
"tools": {}
}

View File

@@ -0,0 +1,11 @@
 from run E:\TaxPayerFULL
docker build -f moadiran\Dockerfile -t land_moadiran .
docker run --name land_moadiran -d -p 81:8080 land_moadiran
--------------------------------------------------------------------------------------------
in local => docker build -f moadiran\Dockerfile -t mmrbnjd/land_moadiran:latest .
in local => docker push mmrbnjd/land_moadiran:latest
in server => docker pull mmrbnjd/land_moadiran:latest
in server => docker run -d -p 3101:8080 --restart always mmrbnjd/land_moadiran:latest

30
moadiran/Dockerfile Normal file
View File

@@ -0,0 +1,30 @@
# See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
# This stage is used when running from VS in fast mode (Default for Debug configuration)
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
USER $APP_UID
WORKDIR /app
EXPOSE 8080
# This stage is used to build the service project
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["moadiran/moadiran.csproj", "moadiran/"]
COPY ["Shared/Shared.csproj", "Shared/"]
RUN dotnet restore "./moadiran/moadiran.csproj"
COPY . .
WORKDIR "/src/moadiran"
RUN dotnet build "./moadiran.csproj" -c $BUILD_CONFIGURATION -o /app/build
# This stage is used to publish the service project to be copied to the final stage
FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./moadiran.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
# This stage is used in production or when running from VS in regular mode (Default when not using the Debug configuration)
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "moadiran.dll"]

View File

@@ -21,8 +21,8 @@
<meta property="og:type" content="article" />
<meta property="og:title" content="@Item?.PageTitle" />
<meta property="og:description" content="@description" />
<meta property="og:image" content="https://moadiran.ir/img/blog/@Item?.Photo" />
<meta property="og:url" content="https://moadiran.ir/BlogDetails/@ItemID" />
<meta property="og:image" content="https://moadiran.irimg/blog/@Item?.Photo" />
<meta property="og:url" content="https://moadiran.irBlogDetails/@ItemID" />
<meta property="og:site_name" content="Moadiran" />
<meta name="author" content="مهدی ربیع نژاد">

View File

@@ -9,8 +9,8 @@
<meta property="og:type" content="website" />
<meta property="og:title" content="سامانه مؤدیران" />
<meta property="og:description" content="مدیریت صورتحساب های الکترونیکی" />
<meta property="og:image" content="https://moadiran.ir/img/logo/moadiran.png" />
<meta property="og:url" content="https://moadiran.ir" />
<meta property="og:image" content="https://moadiran.irimg/logo/moadiran.png" />
<meta property="og:url" content="http://156.255.1.229:3101" />
<meta property="og:site_name" content="Moadiran" />
</HeadContent>
@@ -56,7 +56,7 @@
مدیریت صورتحساب ها و ارسال به سامانه مودیان
</p>
<NavLink class="tp-btn" href="https://moadiran.ir:440/Sign-in">
<NavLink class="tp-btn" href="https://app.moadiran.ir/Sign-in">
<span>شروع کنید</span>
<b></b>
</NavLink>
@@ -221,7 +221,7 @@
</div>
<div class="tp-about__btn">
<NavLink class="tp-btn" href="https://moadiran.ir:440/Sign-in">
<NavLink class="tp-btn" href="https://app.moadiran.ir/Sign-in">
<span>شروع کنید</span>
<b></b>
</NavLink>
@@ -351,7 +351,7 @@
<div class="tp-service__top-content">
<p>راه حلی برای مدیریت بهتر صورتحساب ها</p>
<NavLink class="tp-btn-orange" href="https://moadiran.ir:440/Sign-in">
<NavLink class="tp-btn-orange" href="https://app.moadiran.ir/Sign-in">
<span>شروع کنید</span>
<b></b>
</NavLink>

View File

@@ -17,8 +17,8 @@
<meta property="og:type" content="article" />
<meta property="og:title" content="دانشنامه سامانه مؤدیران" />
<meta property="og:description" content="دانشنامه هایی درباره صورتحساب های الکترونیکی" />
<meta property="og:image" content="https://moadiran.ir/img/logo/moadiran.png" />
<meta property="og:url" content="https://moadiran.ir/ListBlog" />
<meta property="og:image" content="https://moadiran.irimg/logo/moadiran.png" />
<meta property="og:url" content="https://moadiran.irListBlog" />
<meta property="og:site_name" content="Moadiran" />
</HeadContent>

View File

@@ -34,13 +34,15 @@ builder.Services.AddScoped(sp => new UserAuthenticationDTO()
exitDate = new DateTime(),
});
string BaseAddress = builder.Configuration.GetSection("BaseAddress").Value;
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(BaseAddress) });
// Server
//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://195.88.208.142:7075/api/") });
// builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("https://moadiran.ir:444/api/") });
//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://156.255.1.229:3101:444/api/") });
//Home
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://localhost:5271/api/") });
//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://localhost:5271/api/") });
//farzan
//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://localhost:5271/api/") });

View File

@@ -1,21 +1,13 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:60550",
"sslPort": 44360
}
},
"profiles": {
"moadiran": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:7050;http://localhost:5219",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"dotnetRunMessages": true,
"applicationUrl": "https://localhost:7050;http://localhost:5219"
},
"IIS Express": {
"commandName": "IISExpress",
@@ -23,6 +15,25 @@
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Container (Dockerfile)": {
"commandName": "Docker",
"launchBrowser": true,
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
"environmentVariables": {
"ASPNETCORE_HTTPS_PORTS": "8081",
"ASPNETCORE_HTTP_PORTS": "8080"
},
"publishAllPorts": true,
"useSSL": true
}
},
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:60550",
"sslPort": 44360
}
}
}
}

View File

@@ -1,4 +1,5 @@
{
"BaseAddress": "http://156.255.1.229:3201/api/",
"Logging": {
"LogLevel": {
"Default": "Information",

View File

@@ -4,6 +4,8 @@
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>a89579cc-1c94-4d4e-93a1-86ce286e98ac</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>
<ItemGroup>
@@ -12,6 +14,7 @@
<ItemGroup>
<PackageReference Include="Blazor.Bootstrap" Version="2.2.0" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.21.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Shared\Shared.csproj" />

View File

@@ -2,4 +2,4 @@
Allow: /
User-Agent: *
DisAllow : https://moadiran.ir:440/Sign-in
DisAllow : https://app.moadiran.ir/Sign-in

2
next.txt Normal file
View File

@@ -0,0 +1,2 @@
حئاله دستی هم از تعتبار کم کنه
تغییر در مالیات کالا رو فاکتورها بدون اثر باشه